/**
 * Public CSS
 * Twiks Hoasted Domain Manager
 */

/* General Styles */
.twiks-hdm-public-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.twiks-hdm-public-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.twiks-hdm-public-card h2 {
    margin-top: 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    color: #333;
}

/* Domain Search */
.twiks-hdm-domain-search {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.twiks-hdm-search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.twiks-hdm-search-input:focus {
    outline: none;
    border-color: #2271b1;
}

.twiks-hdm-search-select {
    padding: 12px 15px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 16px;
    background: #fff;
    cursor: pointer;
}

.twiks-hdm-search-btn {
    padding: 12px 25px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.twiks-hdm-search-btn:hover {
    background: #135e96;
}

.twiks-hdm-search-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Domain Cards */
.twiks-hdm-domain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.twiks-hdm-domain-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.twiks-hdm-domain-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.twiks-hdm-domain-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.twiks-hdm-domain-name {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.twiks-hdm-domain-status {
    margin-top: 5px;
}

/* Badges */
.twiks-hdm-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.twiks-hdm-badge-success {
    background: #e7f7ed;
    color: #00a32a;
}

.twiks-hdm-badge-warning {
    background: #fff8e5;
    color: #d63638;
}

.twiks-hdm-badge-danger {
    background: #fbeaea;
    color: #d63638;
}

.twiks-hdm-badge-info {
    background: #e7f3ff;
    color: #2271b1;
}

.twiks-hdm-badge-default {
    background: #f0f0f1;
    color: #333;
}

/* Domain Info */
.twiks-hdm-domain-info {
    margin-bottom: 20px;
}

.twiks-hdm-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.twiks-hdm-info-row:last-child {
    border-bottom: none;
}

.twiks-hdm-info-label {
    color: #666;
    font-size: 14px;
}

.twiks-hdm-info-value {
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.twiks-hdm-info-value.highlight {
    color: #2271b1;
}

/* Domain Actions */
.twiks-hdm-domain-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.twiks-hdm-btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

.twiks-hdm-btn-primary {
    background: #2271b1;
    color: #fff;
}

.twiks-hdm-btn-primary:hover {
    background: #135e96;
}

.twiks-hdm-btn-secondary {
    background: #f0f0f1;
    color: #333;
}

.twiks-hdm-btn-secondary:hover {
    background: #e0e0e0;
}

.twiks-hdm-btn-success {
    background: #00a32a;
    color: #fff;
}

.twiks-hdm-btn-success:hover {
    background: #008a26;
}

.twiks-hdm-btn-danger {
    background: #d63638;
    color: #fff;
}

.twiks-hdm-btn-danger:hover {
    background: #b92b2d;
}

.twiks-hdm-btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.twiks-hdm-btn-full {
    width: 100%;
}

/* Nameservers */
.twiks-hdm-nameservers {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.twiks-hdm-nameservers h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.twiks-hdm-ns-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.twiks-hdm-ns-list li {
    padding: 5px 0;
    color: #666;
}

/* Expiring Warning */
.twiks-hdm-expiring-warning {
    background: #fff8e5;
    border: 1px solid #ffd54f;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    color: #856404;
}

.twiks-hdm-expiring-warning strong {
    display: block;
    margin-bottom: 5px;
}

/* Empty State */
.twiks-hdm-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.twiks-hdm-empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ccc;
}

.twiks-hdm-empty-state-text {
    font-size: 16px;
    margin-bottom: 20px;
}

/* Loading */
.twiks-hdm-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: twiks-hdm-spin 1s linear infinite;
}

@keyframes twiks-hdm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.twiks-hdm-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.twiks-hdm-loading-overlay .twiks-hdm-loading {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

/* Modal */
.twiks-hdm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.twiks-hdm-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.twiks-hdm-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e1e1e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.twiks-hdm-modal-title {
    font-size: 20px;
    font-weight: bold;
    margin: 0;
    color: #333;
}

.twiks-hdm-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.twiks-hdm-modal-close:hover {
    color: #333;
}

.twiks-hdm-modal-body {
    padding: 20px;
}

.twiks-hdm-modal-footer {
    padding: 20px;
    border-top: 1px solid #e1e1e1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Notification */
.twiks-hdm-notification {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.twiks-hdm-notification-success {
    background: #e7f7ed;
    border-left: 4px solid #00a32a;
    color: #00a32a;
}

.twiks-hdm-notification-error {
    background: #fbeaea;
    border-left: 4px solid #d63638;
    color: #d63638;
}

.twiks-hdm-notification-warning {
    background: #fff8e5;
    border-left: 4px solid #d63638;
    color: #856404;
}

/* Responsive */
@media (max-width: 768px) {
    .twiks-hdm-domain-search {
        flex-direction: column;
    }
    
    .twiks-hdm-search-input,
    .twiks-hdm-search-select,
    .twiks-hdm-search-btn {
        width: 100%;
    }
    
    .twiks-hdm-domain-grid {
        grid-template-columns: 1fr;
    }
    
    .twiks-hdm-info-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .twiks-hdm-domain-actions {
        flex-direction: column;
    }
    
    .twiks-hdm-btn {
        width: 100%;
    }
}

/* WooCommerce My Account Integration */
.woocommerce-account .twiks-hdm-public-wrapper {
    padding: 0;
}

.woocommerce-account .twiks-hdm-public-card {
    border: none;
    box-shadow: none;
    padding: 0;
}

/* -----------------------------------------------------------------------
   Form Groups
   Used in domain-registration-flow.php and modal inputs.
   ----------------------------------------------------------------------- */
.twiks-hdm-form-group {
    margin-bottom: 20px;
}

.twiks-hdm-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

/* Make inputs/selects inside form-groups fill the available width */
.twiks-hdm-form-group .twiks-hdm-search-input,
.twiks-hdm-form-group .twiks-hdm-search-select {
    width: 100%;
    box-sizing: border-box;
}

/* Checkbox row inside a form-group */
.twiks-hdm-form-group label input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
}

/* Modal body form-groups need a bit of breathing room */
.twiks-hdm-modal-body .twiks-hdm-form-group:last-child {
    margin-bottom: 0;
}

/* -----------------------------------------------------------------------
   Button warning variant (used for Stop Auto Renew)
   ----------------------------------------------------------------------- */
.twiks-hdm-btn-warning {
    background: #dba617;
    color: #fff;
}

.twiks-hdm-btn-warning:hover {
    background: #b88810;
    color: #fff;
}

/* -----------------------------------------------------------------------
   Domain Table Layout (My Domains)
   ----------------------------------------------------------------------- */

.twiks-hdm-domain-search-bar {
    position: relative;
    margin-bottom: 20px;
}

.twiks-hdm-domain-search-bar .twiks-hdm-search-input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    font-size: 16px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    transition: border-color 0.3s;
}

.twiks-hdm-domain-search-bar .twiks-hdm-search-input:focus {
    outline: none;
    border-color: #2271b1;
}

.twiks-hdm-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    opacity: 0.6;
    pointer-events: none;
}

.twiks-hdm-domain-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
    background: #fff;
}

.twiks-hdm-domain-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.twiks-hdm-domain-table thead {
    background: #f8f9fa;
}

.twiks-hdm-domain-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e1e1e1;
    white-space: nowrap;
}

.twiks-hdm-domain-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e1e1e1;
    vertical-align: middle;
}

.twiks-hdm-domain-table tbody tr:hover {
    background: #f8f9fa;
}

.twiks-hdm-domain-table tbody tr.twiks-hdm-expiring {
    background: #fff8e5;
}

.twiks-hdm-domain-table tbody tr.twiks-hdm-expiring:hover {
    background: #fff3cd;
}

/* Domain column */
.twiks-hdm-col-domain {
    min-width: 200px;
}

.twiks-hdm-col-domain .twiks-hdm-domain-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.twiks-hdm-expiry-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: #d63638;
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Status column */
.twiks-hdm-col-status {
    min-width: 100px;
}

/* Expiry column */
.twiks-hdm-col-expiry {
    min-width: 120px;
}

.twiks-hdm-text-warning {
    color: #d63638;
    font-weight: 600;
}

/* Price column */
.twiks-hdm-col-price {
    min-width: 100px;
    font-weight: 500;
    color: #00a32a;
}

.twiks-hdm-price {
    color: #00a32a;
    font-weight: 600;
}

.twiks-hdm-price-empty {
    color: #999;
}

/* Hosting column */
.twiks-hdm-col-hosting {
    min-width: 120px;
}

.twiks-hdm-hosting-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
}

.twiks-hdm-hosting-linked {
    background: #e7f7ed;
    color: #00a32a;
}

.twiks-hdm-hosting-none {
    background: #f0f0f1;
    color: #666;
}

/* Actions column */
.twiks-hdm-col-actions {
    width: 50px;
    text-align: center;
}

.twiks-hdm-btn-expand {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    color: #666;
}

.twiks-hdm-btn-expand:hover {
    background: #f0f0f1;
    color: #333;
}

.twiks-hdm-btn-expand[aria-expanded="true"] {
    color: #2271b1;
}

.twiks-hdm-expand-icon {
    font-size: 12px;
}

/* Domain count badge */
.twiks-hdm-domain-count {
    font-size: 16px;
    font-weight: 400;
    color: #666;
    margin-left: 8px;
}

/* No results message */
.twiks-hdm-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Expandable details row */
.twiks-hdm-details-row {
    background: #f8f9fa;
}

.twiks-hdm-details-row td {
    padding: 0;
    border-bottom: 1px solid #e1e1e1;
}

.twiks-hdm-details-content {
    padding: 20px;
}

.twiks-hdm-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.twiks-hdm-details-section h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e1e1e1;
    font-size: 14px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.twiks-hdm-details-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.twiks-hdm-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.twiks-hdm-detail-label {
    color: #666;
}

.twiks-hdm-detail-value {
    color: #333;
    font-weight: 500;
}

.twiks-hdm-status-yes {
    color: #00a32a;
    font-weight: 600;
}

.twiks-hdm-status-no {
    color: #d63638;
    font-weight: 600;
}

.twiks-hdm-details-actions {
    grid-column: 1 / -1;
}

.twiks-hdm-details-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Responsive table */
@media (max-width: 768px) {
    .twiks-hdm-domain-table th,
    .twiks-hdm-domain-table td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .twiks-hdm-col-domain {
        min-width: 150px;
    }

    .twiks-hdm-col-domain .twiks-hdm-domain-name {
        font-size: 14px;
    }

    .twiks-hdm-details-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .twiks-hdm-details-content {
        padding: 15px;
    }

    .twiks-hdm-details-buttons {
        flex-direction: column;
    }

    .twiks-hdm-details-buttons .twiks-hdm-btn {
        width: 100%;
        text-align: center;
    }
}

/* Hide some columns on very small screens */
@media (max-width: 480px) {
    .twiks-hdm-domain-table .twiks-hdm-col-hosting,
    .twiks-hdm-domain-table .twiks-hdm-col-price {
        display: none;
    }

    .twiks-hdm-details-section.twiks-hdm-details-actions {
        grid-column: 1;
    }
}

/* -----------------------------------------------------------------------
   Tab Navigation
   ----------------------------------------------------------------------- */

.twiks-hdm-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e1e1e1;
    padding-bottom: 0;
}

.twiks-hdm-tab {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.twiks-hdm-tab:hover {
    color: #2271b1;
    background: #f0f4f8;
}

.twiks-hdm-tab.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
    background: #fff;
}

.twiks-hdm-tab-count {
    font-size: 13px;
    color: #999;
    font-weight: 400;
}

.twiks-hdm-tab.active .twiks-hdm-tab-count {
    color: #2271b1;
}

@media (max-width: 480px) {
    .twiks-hdm-tabs {
        flex-direction: column;
        gap: 0;
    }

    .twiks-hdm-tab {
        width: 100%;
        justify-content: center;
        border-bottom: 1px solid #e1e1e1;
        margin-bottom: 0;
    }

    .twiks-hdm-tab.active {
        border-bottom-color: #2271b1;
    }
}

/* -----------------------------------------------------------------------
   Tab Content
   ----------------------------------------------------------------------- */

.twiks-hdm-tab-content {
    display: none;
}

.twiks-hdm-tab-content.active {
    display: block;
    animation: twiksFadeIn 0.3s ease;
}

@keyframes twiksFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -----------------------------------------------------------------------
   Hosting Cards
   ----------------------------------------------------------------------- */

.twiks-hdm-hosting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.twiks-hdm-hosting-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.twiks-hdm-hosting-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.twiks-hdm-hosting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e1e1;
}

.twiks-hdm-hosting-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.twiks-hdm-hosting-status {
    background: #e7f7ed;
    color: #00a32a;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.twiks-hdm-hosting-info {
    margin-bottom: 15px;
}

.twiks-hdm-hosting-info .twiks-hdm-info-row {
    margin-bottom: 8px;
}

.twiks-hdm-hosting-domains {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.twiks-hdm-hosting-domains h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.twiks-hdm-domain-count-badge {
    background: #2271b1;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.twiks-hdm-linked-domains-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.twiks-hdm-linked-domains-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e1e1e1;
}

.twiks-hdm-linked-domains-list li:last-child {
    border-bottom: none;
}

.twiks-hdm-goto-domain {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
}

.twiks-hdm-goto-domain:hover {
    text-decoration: underline;
}

.twiks-hdm-no-domains {
    margin: 0;
    color: #999;
    font-style: italic;
    font-size: 13px;
}

.twiks-hdm-hosting-actions {
    display: flex;
    gap: 10px;
}

@media (max-width: 768px) {
    .twiks-hdm-hosting-grid {
        grid-template-columns: 1fr;
    }
}

/* -------------------------------------------------------------------------
   Domain availability result messages
   ------------------------------------------------------------------------- */

.twiks-hdm-result-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    margin-top: 12px;
}

.twiks-hdm-result-error {
    background-color: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.twiks-hdm-result-error::before {
    content: '✕';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 22px;
    background: #dc2626;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.twiks-hdm-result-success {
    background-color: #f0fdf4;
    border: 1px solid #86efac;
    color: #14532d;
}

.twiks-hdm-result-success::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 22px;
    background: #16a34a;
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

/* Suggestions grid */
.twiks-hdm-suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    margin-bottom: 8px;
}

.twiks-hdm-suggestion-domain {
    flex: 1;
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.twiks-hdm-suggestion-price {
    color: #475569;
    font-size: 13px;
    white-space: nowrap;
}