/* PDF to Excel - Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; min-height: 100vh; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f7fa; min-height: 100vh; display: flex; flex-direction: column; align-items: center; }

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}
.loading-logo-img {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    animation: bounce 1s ease-in-out infinite;
    object-fit: contain;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}
.loading-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #6d28d9;
    margin-bottom: 1rem;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #c4b5fd;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

header { width: 100%; background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%); padding: 1rem 2rem; display: flex; justify-content: center; box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3); position: relative; }
.header-content { max-width: 1400px; width: 100%; display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: 0.75rem; }
.logo img { height: 40px; width: auto; object-fit: contain; }
.logo-text { font-size: 1.5rem; font-weight: 700; color: white; text-shadow: 0 2px 4px rgba(0,0,0,0.1); }

.header-right { display: flex; align-items: center; gap: 1rem; }

/* Desktop Navigation */
.desktop-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

/* User info item for mobile menu */
.user-info-item {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 1px solid #c4b5fd;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    margin-bottom: 0.5rem;
}

.user-info-item span {
    color: #6d28d9;
    font-weight: 600;
}

/* Highlight class for mobile menu buttons */
.highlight {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
    color: white !important;
    border-color: transparent !important;
}

.highlight > span:first-child {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}

/* Footer styles */
.footer {
    width: 100%;
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    padding: 0.75rem 1rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.footer-text {
    color: white;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.footer-subtext {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.65rem;
    line-height: 1.4;
}

/* Usage info card (below upload section) */
.usage-info-card { 
    margin-top: 1rem; 
    padding: 0.75rem 1rem; 
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%); 
    border-radius: 8px; 
    text-align: center;
    border: 1px solid #c4b5fd;
}
.usage-info-card span { 
    font-size: 0.85rem; 
    color: #6d28d9; 
    font-weight: 500; 
}
.usage-info-card.logged-in { 
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); 
    border-color: #6ee7b7;
}
.usage-info-card.logged-in span { 
    color: #047857; 
}

/* Offline Indicator */
.offline-indicator { position: fixed; bottom: 1rem; left: 1rem; padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.8rem; font-weight: 500; z-index: 1000; display: none; }
.offline-indicator.offline { background: #ef4444; color: white; display: flex; align-items: center; gap: 0.5rem; }
.offline-indicator.ready { background: #10b981; color: white; display: flex; align-items: center; gap: 0.5rem; }

.container { max-width: 1400px; margin: 0 auto; padding: 2rem; }

.card { background: white; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1.5rem; margin-bottom: 1.5rem; }
.card-title { font-size: 1rem; font-weight: 600; color: #374151; margin-bottom: 1rem; }

/* Main Layout - 3 columns */
.main-layout { display: grid; grid-template-columns: 280px 1fr 280px; gap: 1.5rem; }

/* Upload */
.upload-area { border: 2px dashed #7c3aed; border-radius: 12px; padding: 1.5rem 1rem; text-align: center; cursor: pointer; transition: all 0.2s; }
.upload-area:hover { background: #f5f3ff; }
.upload-area.disabled { opacity: 0.5; cursor: not-allowed; }
.upload-area.dragover { background: #f5f3ff; border-color: #7c3aed; }
.upload-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.file-input { display: none; }

/* PDF List */
.pdf-list { max-height: 200px; overflow-y: auto; margin-top: 1rem; }
.pdf-item { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.75rem; background: #f9fafb; border-radius: 6px; margin-bottom: 0.5rem; cursor: pointer; border: 2px solid transparent; }
.pdf-item:hover { background: #f5f3ff; }
.pdf-item.active { border-color: #7c3aed; background: #f5f3ff; }
.pdf-item.active:hover { background: #ede9fe; }
.pdf-item-name { font-size: 0.8rem; color: #374151; font-weight: 500; }
.pdf-item-date { font-size: 0.7rem; color: #9ca3af; }
.pdf-item-delete { background: none; border: none; color: #ef4444; cursor: pointer; font-size: 0.8rem; padding: 0.25rem; }

/* Fields */
.field-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.field-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; background: #f9fafb; border-radius: 6px; border: 2px solid transparent; }
.field-item:hover { background: #f5f3ff; }
.field-item.selected { border-color: #7c3aed; background: #f5f3ff; }
.field-item.selected:hover { background: #ede9fe; }
.field-item input[type="radio"] { accent-color: #7c3aed; }
.field-item label { flex: 1; font-size: 0.875rem; cursor: pointer; }
.delete-btn { background: none; border: none; color: #9ca3af; cursor: pointer; font-size: 0.8rem; }
.delete-btn:hover { color: #ef4444; }

.add-field { display: flex; gap: 0.5rem; margin-top: 1rem; }
.add-field input { flex: 1; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.875rem; }
.add-field input:focus { outline: none; border-color: #7c3aed; }

/* Extracted List */
.extracted-list { margin-top: 1rem; max-height: 150px; overflow-y: auto; }
.extracted-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; background: #f5f3ff; border-radius: 6px; margin-bottom: 0.5rem; font-size: 0.75rem; }
.field-name { font-weight: 600; color: #7c3aed; }
.field-value { flex: 1; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Preview */
.pdf-preview { min-height: 500px; max-height: 600px; overflow-y: auto; background: #e5e7eb; border-radius: 8px; position: relative; padding: 1rem; }
.pdf-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 450px; color: #9ca3af; }
.pdf-page-container { position: relative; margin: 0 auto 1rem; display: inline-block; }
.pdf-page-container canvas { display: block; box-shadow: 0 2px 10px rgba(0,0,0,0.2); }
.highlight-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; cursor: crosshair; }
.highlight-box { position: absolute; border-radius: 3px; cursor: pointer; transition: opacity 0.2s; }
.highlight-box.processing { border-style: dashed; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Info Banner */
.info-banner { background: #f5f3ff; border: 1px solid #c4b5fd; border-radius: 6px; padding: 0.5rem 1rem; margin-bottom: 1rem; font-size: 0.8rem; color: #6d28d9; display: none; }
.info-banner.active { display: flex; align-items: center; gap: 0.5rem; }

/* Section separator */
.template-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; }

/* Intro Section */
.intro-section { background: white; border-radius: 16px; padding: 2rem; margin-bottom: 1.5rem; color: #374151; border: 1px solid #e5e7eb; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.intro-header { display: flex; justify-content: center; align-items: center; cursor: pointer; user-select: none; position: relative; }
.intro-header:hover .intro-title { color: #6d28d9; }
.intro-toggle-icon { position: absolute; right: 0; font-size: 1.25rem; color: #7c3aed; transition: transform 0.3s ease; }
.intro-section.collapsed .intro-toggle-icon { transform: rotate(-90deg); }
.intro-content { overflow: hidden; transition: max-height 0.3s ease, opacity 0.3s ease; }
.intro-section.collapsed .intro-content { max-height: 0; opacity: 0; margin-top: 0; }
.intro-section:not(.collapsed) .intro-content { max-height: 1000px; opacity: 1; margin-top: 1rem; }
.intro-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; text-align: center; color: #7c3aed; transition: color 0.2s; }
.intro-subtitle { font-size: 1.1rem; color: #6b7280; text-align: center; margin-bottom: 0; }
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1rem; }
.step-card { background: #f9fafb; border-radius: 12px; padding: 1.5rem 1rem 1.25rem; text-align: center; position: relative; border: 1px solid #e5e7eb; }
.step-number { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: #7c3aed; color: white; width: 26px; height: 26px; border-radius: 50%; font-size: 0.85rem; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(124, 58, 237, 0.3); }
.step-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.step-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.35rem; color: #374151; }
.step-desc { font-size: 0.9rem; color: #4b5563; line-height: 1.4; }
.step-detail { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid #e5e7eb; text-align: left; }
.step-detail-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; margin-bottom: 0.5rem; color: #374151; }
.step-detail-icon { width: 22px; height: 22px; background: #f5f3ff; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; }
.highlight-demo { display: flex; align-items: center; gap: 0.25rem; margin-top: 0.5rem; }
.highlight-box-demo { flex: 1; height: 14px; background: #f3f4f6; border-radius: 2px; border: 1px dashed #d1d5db; }
.highlight-box-demo.filled { background: rgba(124, 58, 237, 0.3); border-style: solid; border-color: #7c3aed; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 1.5rem; border-radius: 8px; font-weight: 500; font-size: 0.875rem; cursor: pointer; border: none; transition: all 0.2s; }
.btn-primary { background: #7c3aed; color: white; }
.btn-primary:hover { background: #6d28d9; }
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; transform: translateY(-2px); }
.btn-success:enabled { animation: glow 2s infinite; }
.btn-outline { background: white; border: 1px solid #d1d5db; color: #374151; }
.btn-outline:hover { background: #f9fafb; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.75rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }

@keyframes glow { 
    0%, 100% { box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4); } 
    50% { box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6); } 
}

/* Status */
.status { display: none; padding: 1rem; border-radius: 8px; font-size: 0.875rem; margin-top: 0.75rem; }
.status.success { display: block; background: #d1fae5; color: #065f46; }
.status.error { display: block; background: #fee2e2; color: #991b1b; }

/* OCR Status */
.ocr-status { background: #fef3c7; border: 1px solid #fcd34d; border-radius: 6px; padding: 0.75rem; margin-bottom: 1rem; font-size: 0.875rem; color: #92400e; display: none; }
.ocr-status.active { display: block; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-overlay.active { display: flex; }
.modal { background: white; border-radius: 16px; padding: 2rem; max-width: 500px; width: 90%; }
.modal h2 { margin-bottom: 1.5rem; text-align: center; }

/* Social Buttons */
.social-btn { width: 100%; padding: 0.75rem; border-radius: 8px; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 0.75rem; transition: all 0.2s; }
.social-btn.google { background: white; border: 1px solid #d1d5db; color: #374151; }
.social-btn.google:hover { background: #f9fafb; }
.social-btn.apple { background: #000; border: none; color: white; }
.social-btn.apple:hover { background: #333; }
.divider { display: flex; align-items: center; margin: 1rem 0; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid #e5e7eb; }
.divider span { padding: 0 1rem; color: #9ca3af; font-size: 0.875rem; }

/* Password field */
.password-field { position: relative; }
.password-toggle { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: #9ca3af; padding: 0.25rem; }
.password-toggle:hover { color: #6b7280; }

/* ============================================
   AUTH MODAL - Premium Design
   ============================================ */

.auth-modal-container {
    display: flex;
    background: white;
    border-radius: 24px;
    overflow: hidden;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: authModalSlideIn 0.3s ease-out;
}

@keyframes authModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Left Side - Branding */
.auth-modal-branding {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 50%, #4c1d95 100%);
    padding: 2.5rem;
    width: 380px;
    position: relative;
    overflow: hidden;
}

.auth-branding-content {
    position: relative;
    z-index: 2;
}

.auth-branding-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.auth-branding-title {
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.auth-branding-subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: rgba(255,255,255,0.1);
    padding: 0.875rem 1rem;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.15);
    transition: all 0.2s;
}

.auth-feature-item:hover {
    background: rgba(255,255,255,0.15);
    transform: translateX(5px);
}

.auth-feature-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.auth-feature-title {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
}

.auth-feature-desc {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.auth-branding-decoration {
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* Right Side - Form */
.auth-modal-form-side {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
    position: relative;
}

.auth-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 1rem;
    transition: all 0.2s;
}

.auth-close-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.auth-form-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-form-header h2 {
    font-size: 1.5rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.auth-form-header p {
    color: #6b7280;
    font-size: 0.9rem;
}

.auth-error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-error-message::before {
    content: "⚠️";
}

/* Input Groups */
.auth-input-group {
    margin-bottom: 1.25rem;
}

.auth-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.auth-label-icon {
    font-size: 1rem;
}

.auth-input-wrapper {
    position: relative;
}

.auth-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: #fafafa;
}

.auth-input:focus {
    outline: none;
    border-color: #7c3aed;
    background: white;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.auth-input::placeholder {
    color: #9ca3af;
}

.auth-input-with-toggle {
    padding-right: 3rem;
}

.auth-password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 0.25rem;
    transition: color 0.2s;
}

.auth-password-toggle:hover {
    color: #7c3aed;
}

.auth-password-hint {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.auth-password-hint span {
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* Remember Me Checkbox */
.auth-remember-me {
    margin-bottom: 1.25rem;
}

.auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
}

.auth-checkbox {
    display: none;
}

.auth-checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    position: relative;
    transition: all 0.2s;
}

.auth-checkbox:checked + .auth-checkbox-custom {
    background: #7c3aed;
    border-color: #7c3aed;
}

.auth-checkbox:checked + .auth-checkbox-custom::after {
    content: "✓";
    color: white;
    font-size: 0.75rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Forgot Link */
.auth-forgot-link {
    text-align: right;
    margin-bottom: 1rem;
}

.auth-forgot-link button {
    background: none;
    border: none;
    color: #7c3aed;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-forgot-link button:hover {
    color: #5b21b6;
    text-decoration: underline;
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
}

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

.auth-submit-icon {
    font-size: 1.1rem;
}

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

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e5e7eb;
}

.auth-divider span {
    padding: 0 1rem;
    color: #9ca3af;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Social Buttons */
.auth-social-buttons {
    display: flex;
    gap: 0.75rem;
}

.auth-social-btn {
    flex: 1;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.auth-google-btn {
    background: white;
    border: 2px solid #e5e7eb;
    color: #374151;
}

.auth-google-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.auth-apple-btn {
    background: #000;
    border: 2px solid #000;
    color: white;
}

.auth-apple-btn:hover {
    background: #333;
    border-color: #333;
}

/* Switch Text */
.auth-switch-text {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.auth-switch-text button {
    background: none;
    border: none;
    color: #7c3aed;
    cursor: pointer;
    font-weight: 600;
    margin-left: 0.25rem;
    transition: color 0.2s;
}

.auth-switch-text button:hover {
    color: #5b21b6;
    text-decoration: underline;
}

/* Auth Modal Responsive */
@media (max-width: 768px) {
    .auth-modal-container {
        flex-direction: column;
        max-width: 450px;
    }
    
    .auth-modal-branding {
        display: none;
    }
    
    .auth-modal-form-side {
        padding: 1.5rem;
    }
    
    .auth-form-header h2 {
        font-size: 1.25rem;
    }
    
    .auth-social-buttons {
        flex-direction: column;
    }
}

/* Responsive */
@media (max-width: 1100px) {
    .main-layout { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .main-layout { grid-template-columns: 1fr; }
    .container { padding: 1rem; }
    header { padding: 0.75rem 1rem; }
    .steps-grid { grid-template-columns: repeat(2, 1fr); }
    .intro-section { padding: 1.5rem 1rem; }
}

@media (max-width: 480px) {
    .steps-grid { grid-template-columns: 1fr; }
}

/* Dashboard Styles */
.dashboard { background: white; border-radius: 16px; padding: 1.5rem; margin-bottom: 1.5rem; border: 1px solid #e5e7eb; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.dashboard-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.dashboard-welcome h2 { font-size: 1.5rem; color: #374151; margin-bottom: 0.25rem; }
.dashboard-welcome p { color: #6b7280; font-size: 0.9rem; }
.dashboard-stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat-card { display: flex; align-items: center; gap: 0.75rem; background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%); padding: 1rem 1.25rem; border-radius: 12px; border: 1px solid #c4b5fd; min-width: 140px; }
.stat-icon { font-size: 2rem; }
.stat-info { display: flex; flex-direction: column; gap: 0.25rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: #7c3aed; }
.stat-label { font-size: 0.75rem; color: #6d28d9; }
.dashboard-card { background: #f9fafb; border-radius: 12px; padding: 1.25rem; border: 1px solid #e5e7eb; }
.dashboard-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.dashboard-card-header h3 { font-size: 1rem; color: #374151; }

.templates-grid { display: flex; flex-direction: column; gap: 0.75rem; max-height: 300px; overflow-y: auto; }
.template-item { display: flex; justify-content: space-between; align-items: center; background: white; padding: 0.75rem 1rem; border-radius: 8px; border: 1px solid #e5e7eb; }
.template-info { flex: 1; }
.template-name { font-weight: 600; color: #374151; font-size: 0.9rem; }
.template-fields { font-size: 0.75rem; color: #6b7280; margin-top: 0.25rem; }
.template-actions { display: flex; gap: 0.5rem; }
.template-actions button { padding: 0.35rem 0.75rem; font-size: 0.75rem; border-radius: 6px; cursor: pointer; }

.history-list { display: flex; flex-direction: column; gap: 0.75rem; max-height: 300px; overflow-y: auto; }
.history-item { background: white; padding: 0.75rem 1rem; border-radius: 8px; border: 1px solid #e5e7eb; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.history-date { font-size: 0.75rem; color: #9ca3af; }
.history-pdfs { font-size: 0.8rem; color: #374151; }
.history-fields { font-size: 0.75rem; color: #6b7280; margin-top: 0.25rem; }
.history-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

.empty-state { text-align: center; color: #9ca3af; font-size: 0.85rem; padding: 1.5rem; background: white; border-radius: 8px; border: 1px dashed #d1d5db; }

/* Dashboard Tabs */
.dashboard-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; border-bottom: 2px solid #e5e7eb; padding-bottom: 0.5rem; }
.tab-btn { padding: 0.5rem 1rem; background: none; border: none; cursor: pointer; font-size: 0.875rem; color: #6b7280; border-radius: 6px; transition: all 0.2s; }
.tab-btn:hover { background: #f5f3ff; color: #7c3aed; }
.tab-btn.active { background: #7c3aed; color: white; }

@media (max-width: 900px) {
    .dashboard-content { grid-template-columns: 1fr; }
    .dashboard-header { flex-direction: column; gap: 1rem; }
    .dashboard-stats { width: 100%; justify-content: space-between; }
    .stat-card { flex: 1; min-width: auto; }
}

@media (max-width: 600px) {
    .stat-card { flex-direction: column; text-align: center; gap: 0.5rem; padding: 0.75rem; }
    .dashboard-stats { flex-wrap: wrap; }
}

/* Account Settings Styles */
.account-settings { display: flex; flex-direction: column; gap: 1.5rem; }
.settings-section { background: white; padding: 1.25rem; border-radius: 8px; border: 1px solid #e5e7eb; }
.settings-section h4 { font-size: 0.95rem; color: #374151; margin-bottom: 1rem; font-weight: 600; }
.settings-section p { font-size: 0.85rem; color: #6b7280; margin-bottom: 1rem; line-height: 1.5; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; color: #374151; margin-bottom: 0.35rem; }
.form-group input { width: 100%; padding: 0.6rem 0.85rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.875rem; transition: border-color 0.2s; }
.form-group input:focus { outline: none; border-color: #7c3aed; }
.form-group small { display: block; margin-top: 0.25rem; font-size: 0.75rem; color: #9ca3af; }

.settings-message { margin-top: 1rem; padding: 0.75rem; border-radius: 6px; font-size: 0.85rem; display: none; }
.settings-message.success { display: block; background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.settings-message.error { display: block; background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.danger-zone { border-color: #fca5a5; background: #fef2f2; }
.danger-zone h4 { color: #dc2626; }

.btn-danger { background: #ef4444; color: white; border: none; padding: 0.6rem 1rem; border-radius: 6px; font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: background 0.2s; }
.btn-danger:hover { background: #dc2626; }

.dashboard-content { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }

@media (max-width: 1100px) {
    .dashboard-content { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .dashboard-content { grid-template-columns: 1fr; }
}

/* Delete Account Modal */
.delete-modal { background: white; border-radius: 16px; overflow: hidden; }
.delete-modal-header { text-align: center; padding: 1.5rem 1rem; background: #f3e8ff; }
.delete-modal-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.delete-modal-header h2 { color: #7c3aed; font-size: 1.25rem; margin: 0; }
.delete-modal-body { padding: 1.5rem; text-align: center; }
.delete-modal-footer { display: flex; gap: 0.75rem; padding: 1rem 1.5rem; background: #f9fafb; border-top: 1px solid #e5e7eb; }
.delete-modal-footer .btn { flex: 1; padding: 0.6rem 1rem; border-radius: 8px; font-weight: 500; cursor: pointer; }

/* Admin Panel Styles */
.admin-messages-list { max-height: 500px; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.admin-message-item { background: white; border-radius: 8px; padding: 1rem; border: 1px solid #e5e7eb; border-left: 4px solid #9ca3af; }
.admin-message-item.new { border-left-color: #7c3aed; background: #f5f3ff; }
.admin-message-item.read { border-left-color: #3b82f6; }
.admin-message-item.responded { border-left-color: #10b981; }
.admin-message-item.closed { border-left-color: #6b7280; opacity: 0.7; }
.admin-message-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.admin-message-from { font-weight: 600; color: #374151; font-size: 0.9rem; }
.admin-message-date { font-size: 0.75rem; color: #9ca3af; }
.admin-message-subject { font-size: 0.85rem; color: #6b7280; margin-bottom: 0.5rem; }
.admin-message-body { font-size: 0.85rem; color: #374151; padding: 0.75rem; background: #f9fafb; border-radius: 6px; margin-bottom: 0.75rem; }
.admin-message-status { margin-bottom: 0.5rem; }
.admin-message-actions { display: flex; gap: 0.5rem; align-items: center; }
.admin-message-actions select { padding: 0.4rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.8rem; }
.status-badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.7rem; font-weight: 500; text-transform: uppercase; }
.status-badge.new { background: #ede9fe; color: #5b21b6; }
.status-badge.read { background: #dbeafe; color: #1e40af; }
.status-badge.responded { background: #d1fae5; color: #065f46; }
.status-badge.closed { background: #e5e7eb; color: #374151; }

/* Admin Dashboard Styles */
.admin-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.admin-stat-card { background: white; border-radius: 12px; padding: 1.5rem; text-align: center; border: 1px solid #e5e7eb; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.admin-stat-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.admin-stat-value { font-size: 2rem; font-weight: 700; color: #7c3aed; }
.admin-stat-label { font-size: 0.9rem; color: #6b7280; margin-top: 0.25rem; }
.admin-stat-sub { font-size: 0.75rem; color: #10b981; margin-top: 0.25rem; }

.admin-users-list { display: flex; flex-direction: column; gap: 0.75rem; max-height: 500px; overflow-y: auto; }
.admin-user-item { display: flex; justify-content: space-between; align-items: center; background: white; padding: 1rem; border-radius: 8px; border: 1px solid #e5e7eb; }
.admin-user-info { display: flex; flex-direction: column; gap: 0.25rem; }
.admin-user-email { font-weight: 600; color: #374151; }
.admin-user-name { font-size: 0.85rem; color: #6b7280; }
.admin-user-date { font-size: 0.75rem; color: #9ca3af; }
.admin-user-actions { display: flex; gap: 0.5rem; align-items: center; }
.admin-badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 600; }
.admin-badge.admin { background: #7c3aed; color: white; }
.admin-badge.user { background: #e5e7eb; color: #6b7280; }
.admin-tab-content { min-height: 200px; }

/* Collapsible Settings Sections */
.settings-section.collapsible { overflow: hidden; }
.collapsible-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 0.75rem 1rem; background: white; border-radius: 8px; transition: background 0.2s; user-select: none; }
.collapsible-header:hover { background: #f9fafb; }
.collapsible-header h4 { margin: 0; font-size: 0.95rem; color: #374151; display: flex; align-items: center; gap: 0.5rem; }
.collapse-icon { color: #9ca3af; font-size: 0.75rem; transition: transform 0.3s; }
.collapsible-header.active .collapse-icon { transform: rotate(180deg); }
.collapsible-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; padding: 0 1rem; }
.collapsible-content.open { max-height: 500px; padding: 1rem; overflow-y: auto; }

/* Danger zone for collapsible */
.settings-section.collapsible.danger-zone .collapsible-header { background: #fef2f2; }
.settings-section.collapsible.danger-zone .collapsible-header h4 { color: #dc2626; }

/* Analytics Dashboard Styles */
.admin-analytics-content { padding: 0.5rem; }
.analytics-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.analytics-stat-card { background: white; border-radius: 10px; padding: 1rem; text-align: center; border: 1px solid #e5e7eb; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }
.analytics-stat-icon { font-size: 1.75rem; margin-bottom: 0.25rem; }
.analytics-stat-value { font-size: 1.5rem; font-weight: 700; color: #6d28d9; }
.analytics-stat-label { font-size: 0.8rem; color: #6b7280; margin-top: 0.1rem; }
.analytics-stat-sub { font-size: 0.7rem; color: #10b981; margin-top: 0.15rem; }

.analytics-chart { display: flex; align-items: flex-end; gap: 4px; height: 150px; background: white; border-radius: 10px; padding: 1rem; border: 1px solid #e5e7eb; margin-top: 0.5rem; }
.chart-bar { flex: 1; background: linear-gradient(to top, #7c3aed, #a78bfa); border-radius: 4px 4px 0 0; min-height: 8px; position: relative; transition: height 0.3s; cursor: pointer; }
.chart-bar:hover { background: linear-gradient(to top, #6d28d9, #7c3aed); }
.chart-label { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 0.6rem; color: #9ca3af; white-space: nowrap; }

.analytics-events-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 300px; overflow-y: auto; background: white; border-radius: 10px; padding: 1rem; border: 1px solid #e5e7eb; margin-top: 0.5rem; }
.analytics-event-item { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.75rem; background: #f9fafb; border-radius: 6px; }
.event-type-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 12px; font-size: 0.7rem; font-weight: 500; text-transform: uppercase; }
.event-type-badge.page_view { background: #e0e7ff; color: #3730a3; }
.event-type-badge.signup { background: #d1fae5; color: #065f46; }
.event-type-badge.login { background: #dbeafe; color: #1e40af; }
.event-type-badge.pdf_upload { background: #fef3c7; color: #92400e; }
.event-type-badge.extraction { background: #fce7f3; color: #9d174d; }
.event-type-badge.download { background: #cffafe; color: #0e7490; }
.event-type-badge.contact { background: #ede9fe; color: #5b21b6; }
.event-date { font-size: 0.75rem; color: #9ca3af; }

/* User-deleted message styling for admin view */
.admin-message-item.user-deleted {
    opacity: 0.8;
    border-left: 4px solid #f97316 !important;
    background: #fffbeb;
}
.admin-message-item.user-deleted .admin-message-body {
    background: #fef3c7;
}
.admin-deleted-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: #fed7aa;
    color: #c2410c;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Notification badge for tabs */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* User notification badge in header */
.user-notification-badge {
    color: #fbbf24;
    font-size: 0.65rem;
    animation: glow-pulse 1.5s ease-in-out infinite;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
}

@keyframes glow-pulse {
    0%, 100% { opacity: 1; text-shadow: 0 0 8px rgba(251, 191, 36, 0.8); }
    50% { opacity: 0.7; text-shadow: 0 0 12px rgba(251, 191, 36, 1); }
}

/* ============================================
   DARK MODE STYLES
   ============================================ */

/* Dark mode color scheme */
:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f9fafb;
    --text-primary: #374151;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --border-light: #d1d5db;
    --accent-light: #f5f3ff;
    --accent-border: #c4b5fd;
    --shadow-color: rgba(0,0,0,0.1);
}

.dark-mode {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --border-light: #4b5563;
    --accent-light: #2d2640;
    --accent-border: #5b21b6;
    --shadow-color: rgba(0,0,0,0.3);
}

/* Dark mode body - works when class is on html or body */
.dark-mode,
.dark-mode body {
    background: var(--bg-primary);
}

/* Dark mode loading screen */
.dark-mode .loading-screen {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.dark-mode .loading-text {
    color: #a78bfa;
}

.dark-mode .loading-spinner {
    border-color: #4c1d95;
    border-top-color: #a78bfa;
}

/* Dark mode auth modal */
.dark-mode .auth-modal-container {
    background: var(--bg-secondary);
}

.dark-mode .auth-modal-branding {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 50%, #4c1d95 100%);
}

.dark-mode .auth-form-header h2 {
    color: var(--text-primary);
}

.dark-mode .auth-form-header p {
    color: var(--text-secondary);
}

.dark-mode .auth-input {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.dark-mode .auth-input:focus {
    border-color: #7c3aed;
    background: var(--bg-secondary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.2);
}

.dark-mode .auth-label {
    color: var(--text-primary);
}

.dark-mode .auth-checkbox-custom {
    border-color: var(--border-light);
}

.dark-mode .auth-checkbox:checked + .auth-checkbox-custom {
    background: #7c3aed;
    border-color: #7c3aed;
}

.dark-mode .auth-divider::before,
.dark-mode .auth-divider::after {
    border-bottom-color: var(--border-color);
}

.dark-mode .auth-divider span {
    color: var(--text-muted);
}

.dark-mode .auth-google-btn {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.dark-mode .auth-google-btn:hover {
    background: var(--bg-secondary);
}

/* Dark mode cards */
.dark-mode .card,
.dark-mode .dashboard,
.dark-mode .intro-section,
.dark-mode .modal,
.dark-mode .dashboard-card,
.dark-mode .template-item,
.dark-mode .history-item,
.dark-mode .settings-section,
.dark-mode .admin-message-item,
.dark-mode .admin-user-item,
.dark-mode .analytics-stat-card,
.dark-mode .admin-stat-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Dark mode text */
.dark-mode .card-title,
.dark-mode .dashboard-welcome h2,
.dark-mode .dashboard-card-header h3,
.dark-mode .settings-section h4,
.dark-mode .admin-message-from,
.dark-mode .admin-user-email,
.dark-mode .template-name,
.dark-mode .history-pdfs,
.dark-mode .step-title,
.dark-mode .step-desc,
.dark-mode .intro-title {
    color: var(--text-primary);
}

/* Dark mode secondary text */
.dark-mode .dashboard-welcome p,
.dark-mode .template-fields,
.dark-mode .history-fields,
.dark-mode .history-date,
.dark-mode .admin-message-date,
.dark-mode .admin-user-name,
.dark-mode .step-detail-item {
    color: var(--text-secondary);
}

/* Dark mode inputs */
.dark-mode input,
.dark-mode select,
.dark-mode textarea {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.dark-mode input::placeholder,
.dark-mode textarea::placeholder {
    color: var(--text-muted);
}

.dark-mode input:focus,
.dark-mode select:focus,
.dark-mode textarea:focus {
    border-color: #7c3aed;
}

/* Dark mode buttons */
.dark-mode .btn-outline {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.dark-mode .btn-outline:hover {
    background: var(--bg-secondary);
}

/* Dark mode PDF list */
.dark-mode .pdf-item {
    background: var(--bg-tertiary);
}

.dark-mode .pdf-item:hover,
.dark-mode .pdf-item.active {
    background: var(--accent-light);
}

.dark-mode .pdf-item-name {
    color: var(--text-primary);
}

/* Dark mode fields */
.dark-mode .field-item {
    background: var(--bg-tertiary);
}

.dark-mode .field-item.selected {
    background: var(--accent-light);
    border-color: #7c3aed;
}

/* Dark mode extracted items */
.dark-mode .extracted-item {
    background: var(--accent-light);
}

.dark-mode .field-name {
    color: #a78bfa;
}

/* Dark mode upload area */
.dark-mode .upload-area:hover {
    background: var(--accent-light);
}

/* Dark mode usage card */
.dark-mode .usage-info-card {
    background: var(--accent-light);
    border-color: var(--accent-border);
}

.dark-mode .usage-info-card span {
    color: #a78bfa;
}

/* Dark mode stat cards */
.dark-mode .stat-card {
    background: var(--accent-light);
    border-color: var(--accent-border);
}

.dark-mode .stat-value {
    color: #a78bfa;
}

.dark-mode .stat-label {
    color: #c4b5fd;
}

/* Dark mode admin stats */
.dark-mode .admin-stat-value,
.dark-mode .analytics-stat-value {
    color: #a78bfa;
}

/* Dark mode tables/lists */
.dark-mode .templates-grid,
.dark-mode .history-list,
.dark-mode .admin-users-list,
.dark-mode .admin-messages-list {
    background: transparent;
}

/* Dark mode empty states */
.dark-mode .empty-state {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
    color: var(--text-muted);
}

/* Dark mode tabs */
.dark-mode .tab-btn {
    color: var(--text-secondary);
}

.dark-mode .tab-btn:hover {
    background: var(--accent-light);
    color: #a78bfa;
}

/* Dark mode collapsible */
.dark-mode .collapsible-header {
    background: var(--bg-secondary);
}

.dark-mode .collapsible-header:hover {
    background: var(--bg-tertiary);
}

/* Dark mode analytics chart */
.dark-mode .analytics-chart,
.dark-mode .analytics-events-list {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.dark-mode .analytics-event-item {
    background: var(--bg-tertiary);
}

/* Dark mode modal overlay */
.dark-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

/* Dark mode delete modal header */
.dark-mode .delete-modal-header {
    background: var(--accent-light);
}

/* Dark mode password toggle */
.dark-mode .password-toggle {
    color: var(--text-muted);
}

.dark-mode .password-toggle:hover {
    color: var(--text-secondary);
}

/* Dark mode OCR status */
.dark-mode .ocr-status {
    background: #422006;
    border-color: #b45309;
    color: #fcd34d;
}

/* Dark mode info banner */
.dark-mode .info-banner {
    background: var(--accent-light);
    border-color: var(--accent-border);
    color: #c4b5fd;
}

/* Dark mode step cards */
.dark-mode .step-card {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

/* Dark mode status messages */
.dark-mode .status.success {
    background: #064e3b;
    color: #6ee7b7;
}

.dark-mode .status.error {
    background: #7f1d1d;
    color: #fca5a5;
}

.dark-mode .settings-message.success {
    background: #064e3b;
    color: #6ee7b7;
    border-color: #047857;
}

.dark-mode .settings-message.error {
    background: #7f1d1d;
    color: #fca5a5;
    border-color: #dc2626;
}

/* Dark mode danger zone */
.dark-mode .danger-zone {
    background: #450a0a;
    border-color: #7f1d1d;
}

.dark-mode .danger-zone h4 {
    color: #f87171;
}

/* Dark mode admin badge */
.dark-mode .admin-badge.user {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Dark mode PDF preview */
.dark-mode .pdf-preview {
    background: var(--bg-tertiary);
}

.dark-mode .pdf-placeholder {
    color: var(--text-muted);
}

/* Dark mode dropdown menus */
.dark-mode #userMenu {
    background: var(--bg-secondary);
    box-shadow: 0 4px 12px var(--shadow-color);
}

/* Dark mode select dropdown options */
.dark-mode select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Transition for smooth mode switching */
body, .card, .dashboard, .intro-section, .modal, input, select, textarea,
.btn, .pdf-item, .field-item, .stat-card, .step-card, .template-item,
.history-item, .admin-message-item, .admin-user-item {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   MOBILE OPTIMIZATIONS - Touch & Responsive
   ============================================ */

/* Touch-friendly targets */
@media (max-width: 768px) {
    /* Larger touch targets for buttons */
    .btn { 
        min-height: 44px; 
        min-width: 44px;
        padding: 0.75rem 1rem;
    }
    .btn-sm {
        min-height: 40px;
        padding: 0.6rem 0.9rem;
    }
    
    /* Better header for mobile */
    header {
        padding: 0.75rem 1rem;
    }
    .header-content {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .logo-text {
        font-size: 1.25rem;
    }
    .logo span:first-child {
        font-size: 1.5rem;
    }
    
    /* Header right buttons - stack on very small screens */
    .header-right {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
    }
    
    /* Larger form inputs for touch */
    .add-field input {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Better PDF preview on mobile */
    .pdf-preview {
        min-height: 350px;
        max-height: 450px;
        padding: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    .pdf-placeholder {
        height: 300px;
    }
    
    /* Touch-friendly PDF list items */
    .pdf-item {
        padding: 0.75rem;
        min-height: 48px;
    }
    .pdf-item-name {
        font-size: 0.9rem;
    }
    
    /* Touch-friendly field items */
    .field-item {
        padding: 0.75rem;
        min-height: 48px;
    }
    .field-item label {
        font-size: 1rem;
    }
    
    /* Larger radio buttons for touch */
    .field-item input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    
    /* Better cards on mobile */
    .card {
        padding: 1rem;
    }
    .card-title {
        font-size: 1.1rem;
    }
    
    /* Intro section mobile improvements */
    .intro-title {
        font-size: 1.4rem;
    }
    .intro-subtitle {
        font-size: 1rem;
    }
    .step-card {
        padding: 1.25rem 0.75rem 1rem;
    }
    .step-icon {
        font-size: 2rem;
    }
    .step-title {
        font-size: 1rem;
    }
    .step-desc {
        font-size: 0.85rem;
    }
    
    /* Upload area */
    .upload-area {
        padding: 1.5rem 0.75rem;
    }
    .upload-icon {
        font-size: 2.5rem;
    }
    
    /* Container adjustments */
    .container {
        padding: 0.75rem;
    }
    
    /* Modals on mobile */
    .modal {
        padding: 1.25rem;
        margin: 0.5rem;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    /* Dashboard mobile */
    .dashboard {
        padding: 1rem;
    }
    .dashboard-welcome h2 {
        font-size: 1.25rem;
    }
    .stat-card {
        padding: 0.75rem;
        min-width: 100%;
    }
    
    /* Offline indicator mobile */
    .offline-indicator {
        bottom: 0.5rem;
        left: 0.5rem;
        right: 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Footer mobile */
    footer {
        padding: 1rem;
    }
    footer p {
        font-size: 0.7rem !important;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    .logo-text {
        font-size: 1.1rem;
    }
    .intro-title {
        font-size: 1.2rem;
    }
    .steps-grid {
        grid-template-columns: 1fr;
    }
    .header-right {
        gap: 0.35rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .upload-area:hover {
        background: transparent;
    }
    .pdf-item:hover {
        background: #f9fafb;
    }
    .field-item:hover {
        background: #f9fafb;
    }
    .btn:hover {
        transform: none;
    }
    .btn-success:enabled {
        animation: none;
    }
    
    /* Add active states for touch feedback */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    .pdf-item:active {
        background: #f5f3ff;
    }
    .field-item:active {
        background: #f5f3ff;
    }
    .upload-area:active {
        background: #f5f3ff;
    }
    
    /* Prevent text selection on interactive elements */
    .btn, .pdf-item, .field-item, .upload-area {
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Better touch scrolling */
    .pdf-preview, .pdf-list, .field-list, .extracted-list {
        -webkit-overflow-scrolling: touch;
    }
}

/* PDF highlight drawing on mobile */
@media (max-width: 768px) {
    .highlight-overlay {
        touch-action: none;
    }
    .highlight-box {
        min-width: 30px;
        min-height: 30px;
    }
    
    /* Info banner mobile */
    .info-banner {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }
    
    /* Extracted list mobile */
    .extracted-item {
        padding: 0.6rem;
        font-size: 0.8rem;
    }
    
    /* Batch progress mobile */
    #batchProgress {
        padding: 0.75rem;
    }
    #progressLabel {
        font-size: 0.85rem;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .pdf-preview {
        min-height: 250px;
        max-height: 350px;
    }
    .pdf-placeholder {
        height: 200px;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .highlight-box {
        border-width: 2px;
    }
}

/* ============================================
   MOBILE BOTTOM SHEET - Fields Panel
   ============================================ */

/* Hide desktop-only elements on mobile, show on desktop */
@media (min-width: 769px) {
    .mobile-bottom-sheet {
        display: none !important;
    }
    .desktop-only {
        display: block;
    }
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
}

/* Mobile Bottom Sheet */
.mobile-bottom-sheet {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 90vh;
    transition: transform 0.3s ease-out, max-height 0.3s ease-out;
    overflow: hidden;
}

@media (max-width: 768px) {
    .mobile-bottom-sheet {
        display: block;
    }
}

/* Bottom Sheet Handle */
.bottom-sheet-handle {
    padding: 12px 0 8px;
    display: flex;
    justify-content: center;
    cursor: grab;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.bottom-sheet-handle:active {
    cursor: grabbing;
}

.handle-bar {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
}

/* Collapsed State */
.bottom-sheet-collapsed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 1rem 1rem;
    cursor: pointer;
}

.mobile-bottom-sheet.expanded .bottom-sheet-collapsed {
    display: none;
}

.swipe-indicator {
    font-size: 1.25rem;
    animation: bounce-up 1.5s ease-in-out infinite;
}

@keyframes bounce-up {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.field-count-text {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
}

/* Expanded Content */
.bottom-sheet-content {
    display: none;
    padding: 0 1rem 1rem;
    max-height: calc(90vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-bottom-sheet.expanded .bottom-sheet-content {
    display: block;
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: white;
    z-index: 5;
}

/* Mobile Field Input */
.mobile-field-input {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.mobile-field-input input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 48px;
}

.mobile-field-input input:focus {
    outline: none;
    border-color: #7c3aed;
}

/* Mobile Field List */
.mobile-field-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.mobile-field-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: #f9fafb;
    border-radius: 12px;
    border: 2px solid transparent;
    min-height: 56px;
}

.mobile-field-item.selected {
    border-color: #7c3aed;
    background: #f5f3ff;
}

.mobile-field-name {
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
    flex: 1;
}

.mobile-field-actions {
    display: flex;
    gap: 0.5rem;
}

.mobile-draw-btn {
    padding: 0.5rem 1rem;
    background: #7c3aed;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 40px;
    min-width: 70px;
}

.mobile-draw-btn:active {
    background: #6d28d9;
}

.mobile-delete-btn {
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    min-height: 40px;
    min-width: 40px;
    font-size: 1.1rem;
}

.mobile-delete-btn:active {
    color: #ef4444;
}

/* Mobile Extracted Section */
.mobile-extracted-section {
    margin-bottom: 1rem;
}

.mobile-extracted-section h3 {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.mobile-extracted-list {
    background: #f9fafb;
    border-radius: 12px;
    padding: 0.75rem;
    min-height: 60px;
    max-height: 120px;
    overflow-y: auto;
}

.mobile-extracted-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f5f3ff;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.mobile-extracted-item:last-child {
    margin-bottom: 0;
}

/* Mobile Actions */
.mobile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.mobile-action-btn {
    flex: 1;
    min-width: calc(50% - 0.5rem);
    min-height: 44px;
}

/* Mobile Batch Section */
.mobile-batch-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.mobile-process-btn,
.mobile-download-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    min-height: 52px;
    margin-bottom: 0.5rem;
}

.mobile-download-btn {
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

/* Mobile Progress */
.mobile-progress {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 2px solid #c4b5fd;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.75rem;
}

.mobile-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #6d28d9;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.mobile-progress-bar-container {
    background: white;
    border-radius: 8px;
    height: 14px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-progress-bar {
    background: linear-gradient(90deg, #7c3aed 0%, #a78bfa 50%, #7c3aed 100%);
    background-size: 200% 100%;
    height: 100%;
    width: 0%;
    transition: width 0.3s;
    animation: shimmer 1.5s infinite;
}

/* Mobile Status */
.mobile-status {
    margin-top: 0.5rem;
}

/* ============================================
   FULL-SCREEN DRAWING MODE (Mobile)
   ============================================ */

.drawing-mode-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f7fa;
    z-index: 2000;
    flex-direction: column;
}

.drawing-mode-overlay.active {
    display: flex;
}

/* Drawing Mode Header */
.drawing-mode-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
    gap: 0.5rem;
}

.drawing-close-btn,
.drawing-done-btn {
    min-height: 44px;
    min-width: 80px;
}

.drawing-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.drawing-done-btn {
    background: white;
    color: #7c3aed;
    font-weight: 600;
}

.drawing-mode-title {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Drawing Canvas Container with Zoom */
.drawing-mode-canvas-container {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #e5e7eb;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y pinch-zoom;
}

.drawing-pdf-preview {
    position: relative;
    display: inline-block;
    min-width: 100%;
}

.drawing-pdf-preview canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Drawing Highlight Overlay */
.drawing-highlight-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: crosshair;
    touch-action: none;
}

/* Drawing Mode Footer */
.drawing-mode-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: white;
    border-top: 1px solid #e5e7eb;
    gap: 1rem;
}

.drawing-clear-btn {
    min-height: 48px;
    min-width: 100px;
}

.drawing-instructions {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
}

/* Drawing Highlight Boxes */
.drawing-highlight-box {
    position: absolute;
    border: 3px solid #7c3aed;
    background: rgba(124, 58, 237, 0.25);
    border-radius: 4px;
    pointer-events: none;
}

.drawing-highlight-box.current {
    border-style: dashed;
    animation: draw-pulse 1s infinite;
}

@keyframes draw-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Drawing Zoom Controls */
.drawing-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 0.25rem;
}

.drawing-zoom-btn {
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 0.5rem !important;
    font-size: 1.25rem !important;
    font-weight: bold !important;
    border-radius: 6px !important;
    background: white !important;
}

.drawing-zoom-btn:active {
    background: #e5e7eb !important;
}

.drawing-zoom-level {
    min-width: 50px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

/* Drawing Highlight Counter */
.drawing-highlight-counter {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    color: #6d28d9;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 90px;
    text-align: center;
}

/* Drawing Instructions Bar */
.drawing-instructions-bar {
    background: #f9fafb;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
}

/* Drawing Save Flash Animation */
.drawing-save-flash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 185, 129, 0);
    pointer-events: none;
    z-index: 2100;
    transition: background 0.15s ease;
}

.drawing-save-flash.active {
    background: rgba(16, 185, 129, 0.3);
}

.drawing-mode-canvas-container.zoomed {
    touch-action: pan-x pan-y pinch-zoom;
}

/* PDF Canvas Wrapper for Zoom */
.drawing-canvas-wrapper {
    transform-origin: top left;
    transition: transform 0.2s ease;
    will-change: transform;
}

/* Minimum highlight size for fat fingers */
@media (max-width: 768px) {
    .drawing-highlight-box {
        min-width: 40px;
        min-height: 40px;
    }
}

/* ============================================
   ADDITIONAL MOBILE LAYOUT ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Main layout becomes single column */
    .main-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding-bottom: 80px; /* Space for bottom sheet */
    }
    
    /* Upload card adjustments */
    .upload-card {
        order: 1;
    }
    
    /* Preview card adjustments */
    .preview-card {
        order: 2;
    }
    
    /* Make PDF preview fit screen width */
    .pdf-preview {
        width: 100%;
        min-height: 300px;
        max-height: 50vh;
        overflow-x: auto;
        overflow-y: auto;
        padding: 0.5rem;
    }
    
    .pdf-page-container {
        max-width: 100%;
    }
    
    .pdf-page-container canvas {
        max-width: 100%;
        height: auto;
    }
    
    /* Better touch targets for all buttons */
    .btn {
        min-height: 48px;
        font-size: 1rem;
    }
    
    .btn-sm {
        min-height: 44px;
        font-size: 0.9rem;
    }
    
    /* Adjust info banner */
    .info-banner {
        flex-wrap: wrap;
        font-size: 0.85rem;
    }
    
    /* Container adjustments */
    .container {
        padding-bottom: 100px;
    }
}

/* Landscape mobile - more compact */
@media (max-width: 768px) and (orientation: landscape) {
    .drawing-mode-header {
        padding: 0.5rem 1rem;
    }
    
    .drawing-mode-footer {
        padding: 0.5rem 1rem;
    }
    
    .drawing-mode-overlay {
        flex-direction: column;
    }
}

/* Dark mode support for new elements */
.dark-mode .mobile-bottom-sheet {
    background: var(--bg-secondary);
}

.dark-mode .bottom-sheet-handle .handle-bar {
    background: var(--border-light);
}

.dark-mode .field-count-text {
    color: var(--text-secondary);
}

.dark-mode .bottom-sheet-header {
    border-color: var(--border-color);
    background: var(--bg-secondary);
}

.dark-mode .mobile-field-input input {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.dark-mode .mobile-field-item {
    background: var(--bg-tertiary);
}

.dark-mode .mobile-field-item.selected {
    background: var(--accent-light);
    border-color: #7c3aed;
}

.dark-mode .mobile-field-name {
    color: var(--text-primary);
}

.dark-mode .mobile-extracted-list {
    background: var(--bg-tertiary);
}

.dark-mode .mobile-extracted-item {
    background: var(--accent-light);
}

.dark-mode .mobile-batch-section {
    border-color: var(--border-color);
}

.dark-mode .drawing-mode-overlay {
    background: var(--bg-primary);
}

.dark-mode .drawing-mode-footer {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.dark-mode .drawing-instructions {
    color: var(--text-secondary);
}

.dark-mode .drawing-mode-canvas-container {
    background: var(--bg-tertiary);
}

/* Smooth transitions for mobile */
.mobile-bottom-sheet,
.bottom-sheet-content,
.mobile-field-item,
.mobile-draw-btn {
    transition: all 0.2s ease-out;
}

/* ============================================
   MOBILE HAMBURGER MENU
   ============================================ */

/* Hamburger button - hidden on desktop */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-line {
    display: block;
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Hamburger animation when open */
.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

/* Mobile menu dropdown */
.mobile-menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #ffffff 0%, #faf5ff 100%);
    box-shadow: 0 10px 40px rgba(124, 58, 237, 0.15), 0 4px 12px rgba(0,0,0,0.08);
    z-index: 999;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    border-radius: 0 0 20px 20px;
}

.mobile-menu-dropdown.open {
    max-height: 500px;
    opacity: 1;
    pointer-events: auto;
    overflow-y: auto;
}

.mobile-menu-content {
    padding: 1rem;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 1rem 1.25rem;
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    text-align: left;
    cursor: pointer;
    color: #374151;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s ease;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.mobile-menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #7c3aed, #a78bfa);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mobile-menu-item:hover {
    background: linear-gradient(135deg, #f5f3ff 0%, #ffffff 100%);
    border-color: #c4b5fd;
    color: #6d28d9;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

.mobile-menu-item:hover::before {
    opacity: 1;
}

.mobile-menu-item:active {
    transform: scale(0.98) translateX(4px);
}

/* Icon styling for menu items */
.mobile-menu-item > span:first-child {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.mobile-menu-item:hover > span:first-child {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: scale(1.1);
}

.mobile-menu-item.highlight {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: white;
    margin: 0.75rem 0;
    border-radius: 16px;
    justify-content: center;
    padding: 1.1rem;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
    border: none;
}

.mobile-menu-item.highlight::before {
    display: none;
}

.mobile-menu-item.highlight:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
}

.mobile-menu-item.highlight > span:first-child {
    background: rgba(255, 255, 255, 0.2);
}

.mobile-menu-item.highlight:hover > span:first-child {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.15);
}

.mobile-menu-item.danger {
    color: #dc2626;
    border-color: #fecaca;
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
}

.mobile-menu-item.danger::before {
    background: linear-gradient(180deg, #ef4444, #f87171);
}

.mobile-menu-item.danger:hover {
    background: linear-gradient(135deg, #fee2e2 0%, #fef2f2 100%);
    border-color: #fca5a5;
    color: #b91c1c;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.mobile-menu-item.danger > span:first-child {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.mobile-menu-item.danger:hover > span:first-child {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.mobile-menu-item.user-info-item {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    color: #6d28d9;
    font-weight: 600;
    border: 2px solid #c4b5fd;
}

.mobile-menu-item.user-info-item:hover {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    transform: none;
}

.mobile-menu-item.user-info-item > span:first-child {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    font-size: 1.1rem;
}

.mobile-menu-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #c4b5fd, transparent);
    margin: 1rem 0;
}

.mobile-auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.mobile-lang-switcher {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f5f3ff 0%, #ffffff 100%);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    margin-top: 0.25rem;
    border: 1px solid #c4b5fd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Override the fixed-width icon container for language switcher */
/* Higher specificity to override .mobile-menu-item > span:first-child */
.mobile-menu-item.mobile-lang-switcher > span:first-child {
    width: auto;
    height: auto;
    background: transparent;
    border-radius: 0;
    padding: 0;
}

.mobile-lang-switcher span {
    color: #6d28d9;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-lang-switcher select {
    padding: 0.6rem 1.25rem;
    border: 2px solid #c4b5fd;
    border-radius: 12px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    color: #6d28d9;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.1);
}

.mobile-lang-switcher select:hover {
    border-color: #7c3aed;
    background: #f5f3ff;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

.mobile-lang-switcher select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* Show hamburger on mobile */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .desktop-nav {
        display: none !important;
    }
    
    header {
        padding: 0.75rem 1rem;
        position: relative;
    }
    
    .header-content {
        flex-direction: row !important;
        gap: 0 !important;
        position: relative;
        align-items: center;
    }
    
    .logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .logo img {
        height: 36px;
        width: auto;
        object-fit: contain;
    }
    
    .logo-text {
        font-size: 1.15rem;
        white-space: nowrap;
        font-weight: 700;
    }
    
    /* Style the hamburger button for better touch target */
    .mobile-menu-btn {
        width: 48px;
        height: 48px;
        padding: 12px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.15);
        transition: all 0.2s ease;
        backdrop-filter: blur(4px);
    }
    
    .mobile-menu-btn:hover {
        background: rgba(255, 255, 255, 0.25);
        transform: scale(1.05);
    }
    
    .mobile-menu-btn:active {
        transform: scale(0.95);
    }
    
    .hamburger-line {
        height: 2.5px;
        background: white;
        border-radius: 3px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    }
}

/* Dark mode mobile menu */
.dark-mode .mobile-menu-dropdown {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0,0,0,0.3);
}

.dark-mode .mobile-menu-item {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.dark-mode .mobile-menu-item::before {
    background: linear-gradient(180deg, #a78bfa, #7c3aed);
}

.dark-mode .mobile-menu-item:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    border-color: #7c3aed;
    color: #a78bfa;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.dark-mode .mobile-menu-item > span:first-child {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
}

.dark-mode .mobile-menu-item:hover > span:first-child {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.dark-mode .mobile-menu-item.highlight {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: white;
}

.dark-mode .mobile-menu-item.danger {
    background: linear-gradient(135deg, #450a0a 0%, #1f2937 100%);
    border-color: #991b1b;
    color: #fca5a5;
}

.dark-mode .mobile-menu-item.danger:hover {
    background: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%);
    border-color: #ef4444;
}

.dark-mode .mobile-menu-item.danger > span:first-child {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
}

.dark-mode .mobile-menu-item.user-info-item {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    color: #a78bfa;
    border-color: #7c3aed;
}

.dark-mode .mobile-menu-item.user-info-item > span:first-child {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.dark-mode .mobile-menu-divider {
    background: linear-gradient(90deg, transparent, #4b5563, transparent);
}

.dark-mode .mobile-lang-switcher {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border-color: #7c3aed;
}

.dark-mode .mobile-lang-switcher span {
    color: #a78bfa;
}

.dark-mode .mobile-lang-switcher select {
    background: #1f2937;
    border-color: #7c3aed;
    color: #a78bfa;
}
