/* ==================== AUTHENTICATION SYSTEM STYLES ==================== */
/* V-MENTOR AI 2026 - Login/Register System */

/* Auth Modal Overlay */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.auth-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Auth Container */
.auth-container {
    background: white;
    border-radius: 1.5rem;
    max-width: 450px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(50px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Auth Header */
.auth-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
}

.auth-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.auth-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.auth-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.auth-subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* Auth Body */
.auth-body {
    padding: 2rem;
}

/* Tab Switcher */
.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: #f3f4f6;
    padding: 0.25rem;
    border-radius: 0.75rem;
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: #6b7280;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.3s;
}

.auth-tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Auth Forms */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-label i {
    color: #667eea;
    margin-right: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    transition: all 0.3s;
    outline: none;
}

.form-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input.error {
    border-color: #ef4444;
}

.form-error {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: none;
}

.form-error.show {
    display: block;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 0.5rem;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    display: none;
}

.password-strength.show {
    display: block;
}

.password-strength-bar {
    height: 100%;
    width: 0;
    transition: all 0.3s;
    border-radius: 2px;
}

.password-strength-bar.weak {
    width: 33%;
    background: #ef4444;
}

.password-strength-bar.medium {
    width: 66%;
    background: #f59e0b;
}

.password-strength-bar.strong {
    width: 100%;
    background: #10b981;
}

.password-strength-text {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: none;
}

.password-strength-text.show {
    display: block;
}

/* Remember Me Checkbox */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-checkbox label {
    font-size: 0.875rem;
    color: #6b7280;
    cursor: pointer;
}

/* Auth Buttons */
.auth-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.auth-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.auth-btn-primary:active {
    transform: translateY(0);
}

.auth-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.auth-divider span {
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Social Login Buttons */
.social-login {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.social-btn {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.social-btn:hover {
    border-color: #667eea;
    background: #f9fafb;
}

.social-btn.google {
    color: #ea4335;
}

.social-btn.facebook {
    color: #1877f2;
}

/* Footer Links */
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.auth-footer a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ==================== USER PROFILE DROPDOWN ==================== */
.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea15, #764ba215);
    border: 2px solid #667eea40;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.user-profile-btn:hover {
    background: linear-gradient(135deg, #667eea25, #764ba225);
    border-color: #667eea;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.user-name {
    font-weight: 600;
    color: #374151;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown.active {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.dropdown-header {
    padding: 1rem;
    background: linear-gradient(135deg, #f0f9ff, #fef3c7);
    border-bottom: 1px solid #e5e7eb;
}

.dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dropdown-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
}

.dropdown-user-details h4 {
    margin: 0;
    font-size: 0.9375rem;
    color: #1f2937;
}

.dropdown-user-details p {
    margin: 0.25rem 0 0;
    font-size: 0.75rem;
    color: #6b7280;
}

.dropdown-menu {
    padding: 0.5rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #f3f4f6;
    color: #667eea;
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    color: #667eea;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0.5rem 0;
}

.dropdown-item.logout {
    color: #ef4444;
}

.dropdown-item.logout:hover {
    background: #fef2f2;
}

.dropdown-item.logout i {
    color: #ef4444;
}

/* ==================== PROFILE PAGE ==================== */
.profile-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.profile-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 2rem;
    border-radius: 1.5rem;
    margin-bottom: 2rem;
}

.profile-header-content {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 4px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
}

.profile-info h1 {
    margin: 0 0 0.5rem;
    font-size: 2rem;
}

.profile-info p {
    margin: 0;
    opacity: 0.9;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.profile-content {
    background: white;
    padding: 2rem;
    border-radius: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.test-results-list {
    display: grid;
    gap: 1rem;
}

.test-result-item {
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s;
}

.test-result-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.test-result-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.test-result-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
}

.test-result-date {
    font-size: 0.75rem;
    color: #9ca3af;
}

.test-result-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.result-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea15, #764ba215);
    border: 1px solid #667eea40;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #667eea;
}

/* ==================== LOADING SPINNER ==================== */
.auth-loading {
    display: none;
    margin-left: 0.5rem;
}

.auth-loading.show {
    display: inline-block;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .auth-container {
        max-width: 100%;
    }
    
    .social-login {
        grid-template-columns: 1fr;
    }
    
    .profile-header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-stats {
        grid-template-columns: 1fr;
    }
    
    .test-result-summary {
        grid-template-columns: 1fr;
    }
}

/* ==================== WELCOME MESSAGE ==================== */
.welcome-message {
    background: linear-gradient(135deg, #f0f9ff, #fef3c7);
    border: 2px solid #dbeafe;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: none;
}

.welcome-message.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

.welcome-message h3 {
    margin: 0 0 0.5rem;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.welcome-message p {
    margin: 0;
    color: #6b7280;
}

/* ==================== FORM ALERTS & BADGES ==================== */
.form-alert-error,
.form-alert-success {
    display: none;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    line-height: 1.45;
}

.form-alert-error.show {
    display: block;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.form-alert-success.show {
    display: block;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

.dropdown-count-badge {
    margin-left: auto;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    padding: 0 0.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==================== ACCOUNT & HISTORY MODAL ==================== */
.account-modal-container {
    max-width: 860px;
}

.account-modal-header {
    text-align: left;
    padding: 1.75rem 2rem;
}

.account-header-user {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-right: 2.5rem;
}

.account-avatar-large {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    border: 3px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 800;
    flex-shrink: 0;
}

.account-header-meta .auth-title {
    font-size: 1.45rem;
}

.account-joined-date {
    font-size: 0.8rem;
    opacity: 0.85;
    margin: 0.25rem 0 0;
}

.account-modal-body {
    padding: 1.75rem 2rem;
}

.account-tabs {
    margin-bottom: 1.5rem;
}

.account-tabs .auth-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.account-tab-panel {
    display: none;
}

.account-tab-panel.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

.account-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.account-stat-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    padding: 1rem;
    text-align: center;
}

.account-stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #4f46e5;
}

.account-stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.history-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 1rem;
    border-radius: 0.9rem;
    margin-bottom: 1.25rem;
}

.history-filter-field {
    flex: 1;
    min-width: 150px;
}

.history-filter-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 0.35rem;
}

.history-filter-field .form-input {
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
}

.history-filter-actions {
    display: flex;
    gap: 0.5rem;
}

.history-card {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem 1.4rem;
}

.history-date-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    color: #4338ca;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.55rem;
}

.history-match-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    white-space: nowrap;
}

.history-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.history-badges-row .result-badge {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
}

.history-holland-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.history-holland-pill {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 0.45rem;
    border: 1px solid;
}

.history-subjects-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
}

.history-row-label {
    color: #6b7280;
    font-weight: 600;
}

.history-subject-chip {
    background: #f3f4f6;
    color: #374151;
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    font-weight: 500;
    font-size: 0.78rem;
}

.history-top-careers {
    font-size: 0.82rem;
    color: #4b5563;
    background: #f9fafb;
    padding: 0.6rem 0.85rem;
    border-radius: 0.6rem;
    margin-bottom: 0.9rem;
}

.history-top-careers strong {
    color: #1f2937;
    margin-right: 0.35rem;
}

.history-card-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding-top: 0.65rem;
    border-top: 1px solid #f3f4f6;
}

.btn-sm {
    padding: 0.5rem 0.95rem;
    font-size: 0.825rem;
}

.btn-danger-outline {
    background: transparent;
    color: #ef4444;
    border: 1.5px solid #fca5a5;
}

.btn-danger-outline:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

.history-empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: #f9fafb;
    border: 2px dashed #e5e7eb;
    border-radius: 1rem;
    color: #6b7280;
}

.history-empty-state > i {
    font-size: 2.5rem;
    color: #9ca3af;
    margin-bottom: 0.75rem;
}

.history-empty-state h4 {
    margin: 0 0 0.4rem;
    color: #1f2937;
}

.history-empty-state p {
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.profile-password-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #6b7280;
}

.profile-password-divider::before,
.profile-password-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.profile-password-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ==================== RESULT SAVE / HISTORY BANNER ==================== */
.result-save-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.4rem;
    border-radius: 0.9rem;
    margin-bottom: 1.5rem;
    border: 2px solid;
}

.result-banner-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.result-banner-left i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.result-banner-left strong {
    display: block;
    font-size: 0.98rem;
}

.result-banner-left p {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
}

.result-banner-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.result-save-banner.is-saved {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}

.result-save-banner.is-saved .result-banner-left i {
    color: #10b981;
}

.result-save-banner.is-unsaved {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e3a8a;
}

.result-save-banner.is-unsaved .result-banner-left i {
    color: #3b82f6;
}

.result-save-banner.is-viewing {
    background: #eef2ff;
    border-color: #a5b4fc;
    color: #312e81;
}

.result-save-banner.is-viewing .result-banner-left i {
    color: #6366f1;
}

.result-save-banner.is-saving {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.vm-toast-notify {
    position: fixed;
    top: 90px;
    right: 1.5rem;
    z-index: 9999;
    padding: 0.9rem 1.35rem;
    border-radius: 0.75rem;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    max-width: 380px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
    animation: vmNotifyIn 0.28s ease;
}

.vm-toast-notify.vm-toast-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.vm-toast-notify.vm-toast-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.vm-toast-notify.vm-toast-info {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.vm-toast-notify.hide {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.28s ease;
}

@keyframes vmNotifyIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ==================== DARK MODE OVERRIDES ==================== */
[data-theme="dark"] .account-stat-box,
[data-theme="dark"] .history-filter-bar,
[data-theme="dark"] .history-empty-state,
[data-theme="dark"] .history-top-careers {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .history-card {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .history-subject-chip {
    background: var(--bg-input) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .history-date-pill {
    background: rgba(102, 126, 234, 0.16) !important;
    border-color: rgba(102, 126, 234, 0.35) !important;
    color: #c7d2fe !important;
}

[data-theme="dark"] .history-card-actions {
    border-top-color: var(--border-color) !important;
}

[data-theme="dark"] .form-label,
[data-theme="dark"] .history-filter-field label,
[data-theme="dark"] .history-top-careers strong,
[data-theme="dark"] .test-result-title,
[data-theme="dark"] .history-empty-state h4 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .result-save-banner.is-saved {
    background: rgba(16, 185, 129, 0.14) !important;
    color: #a7f3d0 !important;
}

[data-theme="dark"] .result-save-banner.is-unsaved,
[data-theme="dark"] .result-save-banner.is-viewing {
    background: rgba(99, 102, 241, 0.16) !important;
    color: #c7d2fe !important;
}

.header .logo,
.header .nav-link,
.header-actions .btn,
.user-profile-btn,
.user-name {
    white-space: nowrap;
}

.header-actions {
    align-items: center;
    flex-shrink: 0;
}

[data-theme="dark"] .user-name {
    color: #f0f4ff !important;
}

[data-theme="dark"] .user-profile-btn {
    background: rgba(102, 126, 234, 0.2) !important;
    border-color: rgba(129, 140, 248, 0.5) !important;
}

[data-theme="dark"] .dropdown-user-details h4 {
    color: #f0f4ff !important;
}

[data-theme="dark"] .dropdown-user-details p {
    color: #a8b4cc !important;
}

@media (max-width: 1024px) {
    .header .nav {
        display: none;
    }
}

@media (max-width: 768px) {
    .account-stats-grid,
    .profile-password-row {
        grid-template-columns: 1fr;
    }

    .history-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ==================== AI MEDIA STUDIO (IMAGE / PDF GENERATOR + QUEUE) ==================== */
#aiMediaModal {
    z-index: 3200;
}

#aiPreviewModal {
    z-index: 3400;
}

.ai-studio-modal {
    max-width: 640px;
}

.ai-preview-modal {
    max-width: 920px;
    width: min(920px, 96vw);
}

.ai-studio-modal .auth-header,
.ai-preview-modal .auth-header {
    padding: 1.5rem 3.25rem 1.35rem;
}

.ai-studio-modal .auth-header h2,
.ai-preview-modal .auth-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.ai-queue-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    margin-left: 0.35rem;
    line-height: 1;
}

.ai-locked-summary {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 1.5px solid rgba(102, 126, 234, 0.25);
    border-radius: 14px;
    padding: 0.95rem 1.1rem;
    margin-bottom: 0.95rem;
}

.ai-locked-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.ai-locked-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.14);
    color: #4f46e5;
    font-size: 0.75rem;
    font-weight: 700;
}

.ai-locked-date {
    font-size: 0.78rem;
    color: var(--gray-600);
    font-weight: 600;
}

.ai-locked-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.45rem;
}

.ai-locked-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    font-size: 0.82rem;
    color: var(--gray-700);
}

.ai-locked-metrics strong {
    color: #4f46e5;
}

.ai-limit-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    border-radius: 12px;
    padding: 0.75rem 0.95rem;
    font-size: 0.83rem;
    line-height: 1.45;
    margin-bottom: 1rem;
}

.ai-limit-notice i {
    margin-top: 0.15rem;
    color: #d97706;
    flex-shrink: 0;
}

.ai-studio-field {
    margin-bottom: 1.05rem;
}

.ai-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.45rem;
}

.ai-type-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    text-align: left;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    border: 2px solid var(--gray-200);
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.ai-type-card:hover {
    border-color: #a5b4fc;
    transform: translateY(-1px);
}

.ai-type-card.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.08);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.16);
}

.ai-type-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.ai-type-icon.is-pdf {
    background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
}

.ai-type-info strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.2rem;
}

.ai-type-info span {
    display: block;
    font-size: 0.77rem;
    line-height: 1.35;
    color: var(--gray-600);
}

.ai-style-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.45rem;
}

.ai-style-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.48rem 0.85rem;
    border-radius: 999px;
    border: 1.5px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-800);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.ai-style-chip:hover {
    border-color: #a5b4fc;
}

.ai-style-chip.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.12);
    color: #4f46e5;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.16);
}

.ai-style-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.65);
}

.ai-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.ai-label-row .form-label {
    margin-bottom: 0;
}

.ai-prompt-counter {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gray-500);
}

.ai-prompt-counter.is-near-limit {
    color: #d97706;
}

.ai-prompt-textarea {
    width: 100%;
    min-height: 82px;
    resize: vertical;
    line-height: 1.5;
    font-family: inherit;
}

.ai-field-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.76rem;
    color: var(--gray-500);
}

.ai-studio-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--gray-200);
}

.ai-queue-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.22);
    border-radius: 14px;
    padding: 0.9rem 1.05rem;
    margin-bottom: 1rem;
}

.ai-queue-banner strong {
    display: block;
    font-size: 0.92rem;
    color: var(--gray-900);
    margin-bottom: 0.2rem;
}

.ai-queue-banner p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.ai-queue-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-queue-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.ai-queue-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ai-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.68rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.ai-type-pill.is-image {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}

.ai-type-pill.is-pdf {
    background: rgba(244, 63, 94, 0.12);
    color: #e11d48;
}

.ai-style-chip-mini {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 0.75rem;
    font-weight: 600;
}

.ai-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.72rem;
    border-radius: 999px;
    font-size: 0.77rem;
    font-weight: 700;
}

.ai-status-pill.is-queued {
    background: #fef3c7;
    color: #b45309;
}

.ai-status-pill.is-processing {
    background: #e0e7ff;
    color: #4338ca;
}

.ai-status-pill.is-completed {
    background: #d1fae5;
    color: #047857;
}

.ai-status-pill.is-failed {
    background: #fee2e2;
    color: #b91c1c;
}

.ai-queue-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
    font-size: 0.81rem;
    color: var(--gray-600);
    margin: 0.35rem 0 0.5rem;
}

.ai-queue-prompt {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    background: var(--gray-50);
    color: var(--gray-700);
    font-size: 0.82rem;
    line-height: 1.45;
}

.ai-queue-prompt.is-muted {
    color: var(--gray-500);
}

.ai-queue-error {
    margin-top: 0.45rem;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.81rem;
}

.ai-queue-actions {
    justify-content: space-between;
    align-items: center;
}

.ai-once-lock-note {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--gray-500);
}

.ai-action-slot {
    display: inline-flex;
}

.btn-ai-studio {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.28);
}

.btn-ai-studio:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.36);
}

.btn-ai-done {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.28);
}

.btn-ai-done:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.36);
}

.btn-ai-queued {
    background: #eef2ff;
    color: #4338ca;
    border: 1.5px solid #c7d2fe;
}

.btn-ai-retry {
    background: #fff1f2;
    color: #be123c;
    border: 1.5px solid #fecdd3;
}

.ai-preview-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--gray-200);
}

.ai-preview-stage {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-poster-frame {
    width: 100%;
    display: flex;
    justify-content: center;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    padding: 0.75rem;
}

.ai-poster-preview-img {
    max-width: 100%;
    max-height: 68vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.ai-preview-iframe {
    width: 100%;
    height: 68vh;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    background: #ffffff;
}

.ai-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    padding: 2.5rem 1rem;
    color: var(--gray-600);
    text-align: center;
}

.ai-preview-loading i {
    font-size: 2rem;
    color: #667eea;
}

/* Dark Mode Overrides for AI Media Studio */
[data-theme="dark"] .ai-locked-summary {
    background: rgba(99, 102, 241, 0.14) !important;
    border-color: rgba(129, 140, 248, 0.35) !important;
}

[data-theme="dark"] .ai-locked-chip {
    background: rgba(129, 140, 248, 0.22) !important;
    color: #c7d2fe !important;
}

[data-theme="dark"] .ai-locked-title,
[data-theme="dark"] .ai-type-info strong,
[data-theme="dark"] .ai-queue-banner strong {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .ai-locked-date,
[data-theme="dark"] .ai-locked-metrics,
[data-theme="dark"] .ai-type-info span,
[data-theme="dark"] .ai-field-hint,
[data-theme="dark"] .ai-queue-banner p,
[data-theme="dark"] .ai-queue-meta,
[data-theme="dark"] .ai-once-lock-note,
[data-theme="dark"] .ai-preview-loading {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .ai-locked-metrics strong {
    color: #a5b4fc !important;
}

[data-theme="dark"] .ai-limit-notice {
    background: rgba(245, 158, 11, 0.14) !important;
    border-color: rgba(245, 158, 11, 0.45) !important;
    color: #fde68a !important;
}

[data-theme="dark"] .ai-type-card,
[data-theme="dark"] .ai-style-chip {
    background: var(--bg-input) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .ai-type-card.selected,
[data-theme="dark"] .ai-style-chip.selected {
    background: rgba(99, 102, 241, 0.22) !important;
    border-color: #818cf8 !important;
    color: #e0e7ff !important;
}

[data-theme="dark"] .ai-studio-actions,
[data-theme="dark"] .ai-preview-actions {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .ai-queue-banner {
    background: rgba(99, 102, 241, 0.14) !important;
    border-color: rgba(129, 140, 248, 0.35) !important;
}

[data-theme="dark"] .ai-queue-card {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .ai-style-chip-mini,
[data-theme="dark"] .ai-queue-prompt,
[data-theme="dark"] .ai-poster-frame {
    background: var(--bg-input) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .ai-queue-error {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .btn-ai-queued {
    background: rgba(99, 102, 241, 0.22) !important;
    border-color: rgba(129, 140, 248, 0.45) !important;
    color: #c7d2fe !important;
}

[data-theme="dark"] .btn-ai-retry {
    background: rgba(244, 63, 94, 0.18) !important;
    border-color: rgba(251, 113, 133, 0.45) !important;
    color: #fda4af !important;
}
