/* ==========================================
   WC DIGITAL FILES - FRONTEND STYLES
   ========================================== */

:root {
    --wcdf-primary: #2563eb;
    --wcdf-primary-dark: #1d4ed8;
    --wcdf-secondary: #64748b;
    --wcdf-success: #10b981;
    --wcdf-danger: #ef4444;
    --wcdf-warning: #f59e0b;
    --wcdf-light: #f8fafc;
    --wcdf-dark: #1e293b;
    --wcdf-border: #e2e8f0;
    --wcdf-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --wcdf-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --wcdf-radius: 12px;
    --wcdf-radius-sm: 8px;
}

/* ==========================================
   ACCOUNT DASHBOARD
   ========================================== */

.wcdf-account {
    max-width: 1400px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}
form {
    margin-bottom: 0!important;
}
.button, button, fieldset, input, select, textarea, table {
    margin-bottom: 0!important;
    box-shadow: none!important;
}
.wcdf-auth-box input {
    margin-bottom: 15px!important;
}
/* Tabs Navigation */
.wcdf-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--wcdf-border);
    padding-bottom: 0;
    flex-wrap: wrap;
}

.wcdf-tabs .wcdf-tab,
.wcdf-tabs button,
.wcdf-tabs li {
    background: transparent;
    border: none;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--wcdf-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.wcdf-tabs .wcdf-tab:hover,
.wcdf-tabs button:hover,
.wcdf-tabs li:hover {
    color: var(--wcdf-primary);
    background: var(--wcdf-light);
    border-radius: var(--wcdf-radius-sm) var(--wcdf-radius-sm) 0 0;
}

.wcdf-tabs .wcdf-tab.active,
.wcdf-tabs button.active,
.wcdf-tabs li.active {
    color: var(--wcdf-primary);
    border-bottom-color: var(--wcdf-primary);
    background: var(--wcdf-light);
    border-radius: var(--wcdf-radius-sm) var(--wcdf-radius-sm) 0 0;
}

/* Tab Content */
.wcdf-tab-content {
    display: none;
    animation: wcdfFadeIn 0.3s ease;
}

.wcdf-tab-content.active {
    display: block;
}

@keyframes wcdfFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   WALLET BOX
   ========================================== */

.wcdf-wallet-box {
    background: linear-gradient(135deg, var(--wcdf-primary) 0%, var(--wcdf-primary-dark) 100%);
    color: #fff;
    padding: 28px 32px;
    border-radius: var(--wcdf-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    box-shadow: var(--wcdf-shadow-lg);
}

.wcdf-wallet-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wcdf-wallet-balance {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.wcdf-wallet-box .button,
.wcdf-wallet-box button {
    background: #fff;
    color: var(--wcdf-primary);
    border: none;
    padding: 12px 24px;
    border-radius: var(--wcdf-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--wcdf-shadow);
}

.wcdf-wallet-box .button:hover,
.wcdf-wallet-box button:hover {
    transform: translateY(-2px);
    box-shadow: var(--wcdf-shadow-lg);
}

/* ==========================================
   FORMS
   ========================================== */

.wcdf-account-section {
    background: #fff;
    padding: 28px;
    border-radius: var(--wcdf-radius);
    box-shadow: var(--wcdf-shadow);
    border: 1px solid var(--wcdf-border);
}

.wcdf-account-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--wcdf-dark);
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--wcdf-border);
}

.wcdf-form-row {
    margin-bottom: 18px;
}

.wcdf-form-row label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--wcdf-dark);
    margin-bottom: 6px;
}

.wcdf-form-row input[type="text"],
.wcdf-form-row input[type="email"],
.wcdf-form-row input[type="password"],
.wcdf-form-row input[type="number"],
.wcdf-form-row input[type="tel"],
.wcdf-form-row textarea,
.wcdf-form-row select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--wcdf-border);
    border-radius: var(--wcdf-radius-sm);
    font-size: 15px;
    transition: all 0.2s ease;
    background: #fff;
}

.wcdf-form-row input:focus,
.wcdf-form-row textarea:focus,
.wcdf-form-row select:focus {
    outline: none;
    border-color: var(--wcdf-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.wcdf-form-msg {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--wcdf-radius-sm);
    font-size: 14px;
}

.wcdf-form-msg:empty {
    display: none;
}

/* Buttons */
.wcdf-account .button,
.wcdf-account button[type="submit"] {
    background: var(--wcdf-primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--wcdf-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0!important;
}

.wcdf-account .button:hover,
.wcdf-account button[type="submit"]:hover {
    background: var(--wcdf-primary-dark);
    transform: translateY(-1px);
}

.wcdf-account .button.primary,
.wcdf-account button.primary {
    background: var(--wcdf-primary);
}

.wcdf-account hr {
    border: none;
    border-top: 1px solid var(--wcdf-border);
    margin: 28px 0;
}

/* Logout Button */
.wcdf-account a[href*="logout"] {
    display: block;
    text-align: center;
    align-items: center;
    gap: 8px;
    background: var(--wcdf-danger);
    color: #fff !important;
    padding: 12px 24px!important;
    border-radius: var(--wcdf-radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.wcdf-account a[href*="logout"]:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* ==========================================
   TABLES (Orders, History)
   ========================================== */

.wcdf-account table,
.wcdf-orders-table,
table.shop_table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--wcdf-radius);
    overflow: hidden;
    box-shadow: var(--wcdf-shadow);
    border: 1px solid var(--wcdf-border);
}

.wcdf-account table thead,
.wcdf-orders-table thead,
table.shop_table thead {
    background: var(--wcdf-light);
}

.wcdf-account table th,
.wcdf-orders-table th,
table.shop_table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--wcdf-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--wcdf-border);
}

.wcdf-account table td,
.wcdf-orders-table td,
table.shop_table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--wcdf-border);
    font-size: 14px;
    color: var(--wcdf-dark);
}

.wcdf-account table tbody tr:last-child td,
.wcdf-orders-table tbody tr:last-child td,
table.shop_table tbody tr:last-child td {
    border-bottom: none;
}

.wcdf-account table tbody tr:hover,
.wcdf-orders-table tbody tr:hover,
table.shop_table tbody tr:hover {
    background: var(--wcdf-light);
}

/* Table Buttons */
.wcdf-account table .button,
.wcdf-view-order {
    background: var(--wcdf-light);
    color: var(--wcdf-primary);
    border: 1px solid var(--wcdf-border);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcdf-account table .button:hover,
.wcdf-view-order:hover {
    background: var(--wcdf-primary);
    color: #fff;
    border-color: var(--wcdf-primary);
}

/* ==========================================
   POPUPS
   ========================================== */

.wcdf-buy-popup,
.wcdf-auth-popup,
#wcdf-buy-popup,
#wcdf-wallet-popup,
#wcdf-order-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
}

.wcdf-buy-overlay,
.wcdf-auth-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.wcdf-buy-box,
.wcdf-auth-box {
    position: relative;
    background: #fff;
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    border-radius: var(--wcdf-radius);
    box-shadow: var(--wcdf-shadow-lg);
    animation: wcdfSlideUp 0.3s ease;
}

@keyframes wcdfSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.wcdf-buy-box h3,
.wcdf-auth-box h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--wcdf-dark);
    margin: 0 0 20px 0;
}

/* Auth Popup Specific */
.wcdf-auth-box input[type="text"],
.wcdf-auth-box input[type="password"],
.wcdf-auth-box input[type="email"] {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 14px;
    border: 1px solid var(--wcdf-border);
    border-radius: var(--wcdf-radius-sm);
    font-size: 15px;
    transition: all 0.2s ease;
}

.wcdf-auth-box input:focus {
    outline: none;
    border-color: var(--wcdf-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.wcdf-auth-box button[type="submit"] {
    width: 100%;
    background: var(--wcdf-primary);
    color: #fff;
    border: none;
    padding: 14px 24px;
    border-radius: var(--wcdf-radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcdf-auth-box button[type="submit"]:hover {
    background: var(--wcdf-primary-dark);
}

.wcdf-auth-box .wcdf-form-msg {
    margin-top: 14px;
    text-align: center;
}

.wcdf-auth-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    color: var(--wcdf-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.wcdf-auth-close:hover {
    color: var(--wcdf-dark);
}

/* Buy Popup */
#wcdf-buy-popup .wcdf-buy-box,
#wcdf-wallet-popup .wcdf-buy-box {
    max-width: 600px;
}

#wcdf-buy-qty {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--wcdf-border);
    border-radius: var(--wcdf-radius-sm);
    font-size: 16px;
    margin-bottom: 16px;
}

#wcdf-popup-total {
    font-size: 20px;
    font-weight: 700;
    color: var(--wcdf-primary);
    padding: 16px;
    background: var(--wcdf-light);
    border-radius: var(--wcdf-radius-sm);
    text-align: center;
    margin-bottom: 20px;
}

/* Popup Buttons */
#wcdf-confirm-buy,
.wcdf-popup-confirm {
    background: var(--wcdf-success);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: var(--wcdf-radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#wcdf-confirm-buy:hover,
.wcdf-popup-confirm:hover {
    background: #059669;
}

#wcdf-cancel-buy,
#wcdf-wallet-close,
.wcdf-popup-close {
    background: var(--wcdf-light)!important;
    color: var(--wcdf-secondary)!important;
    border: 1px solid var(--wcdf-border)!important;
    padding: 2px 28px!important;
    border-radius: var(--wcdf-radius-sm)!important;
    font-size: 15px!important;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0px;
    margin-right: 0!important;
}

#wcdf-cancel-buy:hover,
#wcdf-wallet-close:hover,
.wcdf-popup-close:hover {
    background: var(--wcdf-border)!important;
}

/* Wallet Popup QR */
#wcdf-wallet-popup img {
    display: block;
    margin: 16px auto;
    border-radius: var(--wcdf-radius-sm);
    box-shadow: var(--wcdf-shadow);
}

/* ==========================================
   PRODUCT BUTTONS (Shop Page)
   ========================================== */

.wcdf-buy-now,
.wcdf-login-required, .wcdf-wallet-header {
    background: var(--wcdf-primary) !important;
    color: #fff !important;
    border: none !important;
    padding: 2px 20px !important;
    border-radius: var(--wcdf-radius-sm) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 0px !important;
    margin-right: 0!important;
    text-transform: none!important;
}

.wcdf-buy-now:hover {
    background: var(--wcdf-primary-dark) !important;
    transform: translateY(-2px);
}

/* Stock Display */
.wcdf-stock-info {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
    margin: 8px 0;
}

.wcdf-stock-available {
    background: #dcfce7;
    color: #166534;
}

.wcdf-stock-out {
    background: #fee2e2;
    color: #991b1b;
}

/* ==========================================
   ORDER DETAIL
   ========================================== */

.wcdf-order-detail {
    padding: 20px 0;
}

.wcdf-order-detail h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--wcdf-dark);
    margin: 0 0 16px 0;
}

.wcdf-order-detail p {
    line-height: 1.8;
    color: var(--wcdf-secondary);
}

.wcdf-order-files {
    margin-top: 16px;
}

.wcdf-order-files .button {
    background: var(--wcdf-success);
    color: #fff;
    border: none;
    padding: 2px 16px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    margin-right: 0;
    margin-bottom: 0!important;
}

.wcdf-order-files .button:hover {
    background: #059669;
}

/* ==========================================
   WALLET HISTORY
   ========================================== */

.wcdf-wallet-history {
    margin-top: 24px;
}

.wcdf-wallet-history h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.wcdf-tx-deposit {
    color: var(--wcdf-success);
    font-weight: 600;
}

.wcdf-tx-purchase {
    color: var(--wcdf-danger);
    font-weight: 600;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .wcdf-account {
        padding: 0 12px;
    }

    .wcdf-tabs {
        gap: 4px;
    }

    .wcdf-tabs .wcdf-tab,
    .wcdf-tabs button,
    .wcdf-tabs li {
        padding: 10px 14px;
        font-size: 13px;
    }

    .wcdf-wallet-box {
        flex-direction: column;
        text-align: center;
        gap: 16px;
        padding: 24px 20px;
    }

    .wcdf-wallet-balance {
        font-size: 28px;
    }

    .wcdf-account-section {
        padding: 20px 16px;
    }

    .wcdf-buy-box,
    .wcdf-auth-box {
        margin: 20px 16px;
        padding: 24px 20px;
    }

    .wcdf-account table,
    .wcdf-orders-table,
    table.shop_table {
        font-size: 13px;
    }

    .wcdf-account table th,
    .wcdf-account table td,
    table.shop_table th,
    table.shop_table td {
        padding: 10px 12px;
    }

    /* Responsive table */
    .wcdf-account table thead {
        display: none;
    }

    .wcdf-account table tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid var(--wcdf-border);
        border-radius: var(--wcdf-radius-sm);
    }

    .wcdf-account table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid var(--wcdf-border);
    }

    .wcdf-account table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--wcdf-secondary);
        font-size: 12px;
        text-transform: uppercase;
    }

    .wcdf-account table td:last-child {
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    .wcdf-tabs {
        flex-direction: column;
    }

    .wcdf-tabs .wcdf-tab,
    .wcdf-tabs button,
    .wcdf-tabs li {
        border-bottom: none;
        border-left: 3px solid transparent;
        border-radius: 0;
        margin-bottom: 0;
    }

    .wcdf-tabs .wcdf-tab.active,
    .wcdf-tabs button.active,
    .wcdf-tabs li.active {
        border-bottom: none;
        border-left-color: var(--wcdf-primary);
    }
}

/* ==========================================
   ANIMATIONS & EFFECTS
   ========================================== */

.wcdf-loading {
    position: relative;
    pointer-events: none;
}

.wcdf-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--wcdf-border);
    border-top-color: var(--wcdf-primary);
    border-radius: 50%;
    animation: wcdfSpin 0.6s linear infinite;
}

@keyframes wcdfSpin {
    to { transform: rotate(360deg); }
}

/* Success/Error States */
.wcdf-success-msg {
    background: #dcfce7;
    color: #166534;
    padding: 12px 16px;
    border-radius: var(--wcdf-radius-sm);
    border: 1px solid #bbf7d0;
}

.wcdf-error-msg {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: var(--wcdf-radius-sm);
    border: 1px solid #fecaca;
}
/* ==========================================
   AUTH POPUP - MULTI FORM
   ========================================== */

.wcdf-auth-form {
    display: none;
}

.wcdf-auth-form.active {
    display: block;
    animation: wcdfFadeIn 0.3s ease;
}

.wcdf-auth-links {
    margin-top: 20px;
    padding-top: 0px;
    text-align: center;
}

.wcdf-auth-links a {
    display: block;
    color: var(--wcdf-secondary);
    text-decoration: none;
    font-size: 14px;
    padding: 0;
    transition: color 0.2s ease;
}

.wcdf-auth-links a:hover {
    color: var(--wcdf-primary);
}

.wcdf-auth-links a strong {
    color: var(--wcdf-primary);
}

/* Form Messages */
.wcdf-auth-box .wcdf-form-msg {
    display: none;
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--wcdf-radius-sm);
    font-size: 14px;
    text-align: center;
}

.wcdf-auth-box .wcdf-form-msg.success {
    display: block;
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.wcdf-auth-box .wcdf-form-msg.error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Button disabled state */
.wcdf-auth-box button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Password confirm field */
.wcdf-auth-box input[name="password_confirm"] {
    margin-bottom: 14px;
}
/* ==========================================
   WALLET BALANCE UPDATE ANIMATION
   Thêm vào cuối file frontend.css
   ========================================== */

.wcdf-balance-updated {
    animation: wcdfBalancePulse 1s ease;
}

@keyframes wcdfBalancePulse {
    0%, 100% {
        transform: scale(1);
        color: inherit;
    }
    25% {
        transform: scale(1.1);
        color: #10b981;
    }
    50% {
        transform: scale(1);
        color: #10b981;
    }
    75% {
        transform: scale(1.05);
        color: #10b981;
    }
}

/* Thêm transition để mượt hơn */
.wcdf-wallet-amount,
.wcdf-wallet-balance {
    transition: all 0.3s ease;
}