/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f8fafc;
    color: #1a1a1a;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: #4f6ef7; text-decoration: none; transition: color .2s; }
a:hover { color: #2e3fa8; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* === Navbar === */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.nav-container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.25rem; color: #1a1a1a; flex-shrink: 0; }
.logo-icon { font-size: 1.5rem; }

/* Menu Toggle Button (Hidden on Desktop) */
.menu-toggle {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer;
    padding: 8px; margin: 0;
}
.menu-toggle span {
    width: 24px; height: 2px; background: #666;
    transition: all 0.3s ease;
    border-radius: 2px;
}
.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(8px, 8px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(8px, -8px); }

.nav-links { 
    display: flex; align-items: center; gap: 20px; 
}
.nav-link { color: #666; font-size: .9rem; font-weight: 500; transition: color .2s; }
.nav-link:hover { color: #1a1a1a; }
.nav-btn {
    background: linear-gradient(135deg, #4f6ef7, #6c9fff);
    color: #fff !important; padding: 8px 20px; border-radius: 8px; font-weight: 600;
}
.nav-btn:hover { opacity: .9; }
.nav-btn-outline {
    border: 1px solid #d1d5db; padding: 6px 16px; border-radius: 8px;
    color: #666 !important; background: #fff;
}
.nav-btn-outline:hover { border-color: #9ca3af; color: #1a1a1a !important; }
.nav-user { color: #4f6ef7; font-weight: 500; font-size: .9rem; }
.lang-switch { display: flex; gap: 4px; margin-left: 8px; }
.lang-link {
    font-size: .75rem; font-weight: 600; padding: 4px 8px; border-radius: 4px;
    color: #999; background: #f3f4f6; transition: all .2s;
}
.lang-link.active { background: #4f6ef7; color: #fff; }
.lang-link:hover { background: #e5e7eb; color: #1a1a1a; }

/* === Main === */
.main { flex: 1; padding-top: 64px; }

/* === Hero === */
.hero {
    padding: 80px 0 40px;
    background: linear-gradient(135deg, rgba(79,110,247,0.08) 0%, rgba(244,63,94,0.04) 100%);
}
.hero-content { text-align: center; margin-bottom: 50px; }
.hero-title {
    font-size: 3rem; font-weight: 700; line-height: 1.1;
    color: #1a1a1a;
    margin-bottom: 16px;
}
.hero-subtitle { font-size: 1.15rem; color: #666; max-width: 560px; margin: 0 auto; }

/* === Upload Zone === */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 20px; padding: 60px 40px; text-align: center;
    background: #f3f4f6;
    transition: all .3s; cursor: pointer; max-width: 600px; margin: 0 auto;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: #4f6ef7; background: #eff6ff;
    transform: translateY(-2px);
}
.upload-icon { color: #4f6ef7; margin-bottom: 20px; }
.upload-text { font-size: 1.1rem; color: #4b5563; margin-bottom: 8px; }
.upload-formats { font-size: .85rem; color: #999; margin-bottom: 24px; }
.upload-preview { max-width: 600px; margin: 0 auto; border-radius: 16px; overflow: hidden; }
.upload-preview img { width: 100%; height: auto; display: block; border-radius: 16px; }

/* === Buttons === */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 28px; border-radius: 10px; font-size: 1rem; font-weight: 600;
    border: none; cursor: pointer; transition: all .2s; font-family: inherit;
}
.btn-primary {
    background: linear-gradient(135deg, #4f6ef7, #6c9fff); color: #fff;
    box-shadow: 0 2px 8px rgba(79,110,247,0.2);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79,110,247,0.3); }
.btn-secondary { background: #e5e7eb; color: #4b5563; }
.btn-secondary:hover { background: #d1d5db; }
.btn-full { width: 100%; }

/* === Search Progress === */
.search-progress { text-align: center; padding: 60px 0; max-width: 400px; margin: 0 auto; }
.spinner { position: relative; width: 100px; height: 100px; margin: 0 auto 30px; }
.spinner-ring {
    position: absolute; inset: 0;
    border: 3px solid #e5e7eb;
    border-top-color: #4f6ef7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.spinner-icon {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-title { font-size: 1.3rem; margin-bottom: 24px; color: #1a1a1a; }
.progress-steps { display: flex; flex-direction: column; gap: 16px; }
.step { display: flex; align-items: center; gap: 12px; color: #999; transition: color .3s; }
.step.active { color: #4f6ef7; }
.step.done { color: #4ade80; }
.step-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #d1d5db; transition: background .3s;
}
.step.active .step-dot { background: #4f6ef7; box-shadow: 0 0 10px rgba(79,110,247,0.5); }
.step.done .step-dot { background: #4ade80; }

/* === Result Card === */
.result-card {
    max-width: 600px; margin: 0 auto;
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: 20px; padding: 32px; text-align: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.result-header { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 24px; }
.result-header h3 { font-size: 1.4rem; color: #1a1a1a; }
.result-icon { font-size: 1.8rem; }
.result-map {
    width: 100%; height: 200px; border-radius: 12px; margin-bottom: 24px;
    background: #f3f4f6; display: flex; align-items: center; justify-content: center;
    font-size: 3rem; overflow: hidden;
}
.result-details { text-align: left; margin-bottom: 24px; }
.result-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}
.result-row:last-child { border-bottom: none; }
.result-label { color: #999; font-size: .85rem; min-width: 100px; }
.result-value { color: #1a1a1a; font-weight: 500; }
.confidence-bar {
    flex: 1; height: 8px; background: #e5e7eb;
    border-radius: 4px; overflow: hidden;
}
.confidence-fill {
    height: 100%; border-radius: 4px; transition: width .8s ease;
    background: linear-gradient(90deg, #f59e0b, #4ade80);
}

/* Alternatives list */
.result-alternatives { margin-top: 12px; color: #4b5563; }
.result-alternatives ol { margin-left: 16px; color: #4b5563; }
.result-alternatives li { padding: 6px 0; border-bottom: 1px dashed #f0f0f0; }
.result-alternatives hr { border: none; border-top: 1px solid #f0f0f0; margin: 12px 0; }

/* === Features === */
.features { padding: 80px 0; }
.features-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 24px;
    width: 100%;
}
.feature-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px; padding: 32px; text-align: center;
    transition: transform .2s, border-color .2s, box-shadow .2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    min-width: 0;
    overflow: hidden;
}
.feature-card:hover { transform: translateY(-4px); border-color: #4f6ef7; box-shadow: 0 8px 20px rgba(79,110,247,0.12); }
.feature-icon { font-size: 2.5rem; margin-bottom: 16px; }
.feature-card h3 { 
    font-size: 1.15rem; color: #1a1a1a; margin-bottom: 8px;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}
.feature-card p { font-size: .9rem; color: #666; word-break: break-word; }

/* === Auth === */
.auth-section { padding: 80px 0; display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 64px - 60px); }
.auth-card {
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: 20px; padding: 40px; max-width: 420px; width: 100%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.auth-title { font-size: 1.8rem; font-weight: 700; color: #1a1a1a; margin-bottom: 24px; text-align: center; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .85rem; font-weight: 500; color: #4b5563; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    background: #f3f4f6; border: 1px solid #d1d5db;
    border-radius: 10px; padding: 12px 16px; color: #1a1a1a;
    font-size: 1rem; font-family: inherit; transition: border-color .2s;
}
.form-group input:focus { outline: none; border-color: #4f6ef7; background: #fff; }
.form-checkbox { flex-direction: row; align-items: center; gap: 10px; }
.form-checkbox input[type="checkbox"] { width: 18px; height: 18px; accent-color: #4f6ef7; }
.form-checkbox label { font-size: .85rem; color: #4b5563; }
.auth-error {
    background: #fee2e2; border: 1px solid #fca5a5;
    border-radius: 10px; padding: 12px 16px; color: #dc2626; font-size: .9rem;
    margin-bottom: 8px;
}
.auth-footer { text-align: center; margin-top: 20px; font-size: .9rem; color: #999; }

/* === Terms === */
.terms-section { padding: 80px 0; }
.terms-card {
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: 20px; padding: 48px; max-width: 800px; margin: 0 auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.terms-card h1 { font-size: 2rem; color: #1a1a1a; margin-bottom: 8px; }
.terms-updated { color: #999; font-size: .85rem; margin-bottom: 32px; }
.terms-card h2 { font-size: 1.2rem; color: #4b5563; margin: 24px 0 8px; }
.terms-card p, .terms-card li { color: #666; font-size: .95rem; line-height: 1.7; }
.terms-card ul { margin-left: 24px; margin-top: 8px; }
.terms-card li { margin-bottom: 4px; }

/* === 404 === */
.error-section { text-align: center; padding: 120px 0; }
.error-section h1 { font-size: 6rem; font-weight: 800; color: #4f6ef7; }
.error-section p { font-size: 1.2rem; color: #999; margin-bottom: 24px; }

/* === Footer === */
.footer {
    border-top: 1px solid #e5e7eb;
    padding: 20px; margin-top: auto;
    background: #f9fafb;
}
.footer-container { display: flex; align-items: center; justify-content: space-between; }
.footer p { font-size: .85rem; color: #999; }
.footer-link { font-size: .85rem; color: #999; }
.footer-link:hover { color: #4f6ef7; }

/* === Responsive === */
/* === Tablet (768px) === */
@media (max-width: 768px) {
    /* Navbar */
    .menu-toggle { display: flex; }
    .nav-container { height: 56px; }
    .nav-links {
        position: absolute; top: 56px; left: 0; right: 0;
        flex-direction: column; gap: 0;
        background: #fff; border-bottom: 1px solid #e5e7eb;
        max-height: 0; overflow: hidden;
        transition: max-height 0.3s ease;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        padding: 0;
    }
    .nav-links.active {
        max-height: 500px; padding: 12px 0;
    }
    .nav-link {
        display: block; padding: 12px 20px; color: #666;
        border-bottom: 1px solid #f3f4f6;
    }
    .nav-link:hover { background: #f8fafc; }
    .nav-user { display: block; padding: 12px 20px; border-bottom: 1px solid #f3f4f6; }
    .nav-btn, .nav-btn-outline { display: block; width: calc(100% - 40px); margin: 8px 20px; text-align: center; }
    .lang-switch { margin-left: 0; padding: 12px 20px; border-top: 1px solid #f3f4f6; }
    
    /* Hero */
    .hero { padding: 60px 0 30px; }
    .hero-title { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-content { margin-bottom: 30px; }
    
    /* Upload */
    .upload-zone { padding: 40px 20px; border-radius: 16px; }
    .upload-icon { margin-bottom: 16px; }
    .upload-text { font-size: 1rem; }
    
    /* Layout */
    .container { padding: 0 16px; }
    .features-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .main { padding-top: 56px; }
    
    /* Cards & Forms */
    .auth-card { padding: 28px 20px; border-radius: 12px; }
    .terms-card { padding: 28px 20px; border-radius: 12px; }
    .footer-container { flex-direction: column; gap: 8px; }
}

/* === Mobile (480px) === */
@media (max-width: 480px) {
    /* Navbar */
    .logo-text { font-size: 1rem; }
    .logo-icon { font-size: 1.25rem; }
    .nav-container { height: 56px; padding: 0 16px; }
    .nav-links { top: 56px; }
    
    /* Hero */
    .hero { padding: 50px 0 25px; }
    .hero-title { font-size: 1.6rem; margin-bottom: 12px; }
    .hero-subtitle { font-size: 0.95rem; }
    
    /* Upload */
    .upload-zone { 
        padding: 28px 16px; border-radius: 12px;
        max-width: 100%;
    }
    .upload-icon { margin-bottom: 12px; }
    .upload-icon svg { width: 48px; height: 48px; }
    .upload-text { font-size: 0.95rem; margin-bottom: 6px; }
    .upload-formats { font-size: 0.8rem; }
    
    /* Buttons */
    .btn { 
        padding: 10px 18px; font-size: 0.9rem;
        width: 100%;
    }
    .btn-primary, .btn-secondary { width: 100%; }
    
    /* Results */
    .result-card { padding: 18px; border-radius: 12px; }
    .result-map { height: 160px; font-size: 2.2rem; }
    .result-details { margin-bottom: 12px; }
    .result-row { padding: 8px 0; font-size: 0.9rem; }
    .confidence-bar { height: 10px; }
    .result-alternatives ol { padding-left: 14px; }
    
    /* Grid */
    .candidates-grid { grid-template-columns: 1fr; }
    .features-grid { grid-template-columns: 1fr; gap: 12px; }
    .subscription-info { grid-template-columns: 1fr; gap: 12px; }
    .subscription-plans { grid-template-columns: 1fr; gap: 12px; }
    
    /* Forms */
    .auth-card { padding: 20px 16px; border-radius: 12px; }
    .auth-card h2 { font-size: 1.5rem; margin-bottom: 20px; }
    .form-group { margin-bottom: 16px; }
    .form-group input, .form-group textarea { font-size: 16px; }
    
    /* Text sizing */
    .container { padding: 0 16px; }
    body { font-size: 14px; }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
    
    /* Spacing */
    .main { padding-top: 56px; }
    .footer { padding: 24px 0; }
}

/* === Account Page === */
.account-section {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.account-section h3 {
    margin-bottom: 16px;
    color: #1a1a1a;
    font-size: 1.25rem;
    font-weight: 600;
}
.subscription-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.subscription-info p {
    margin: 0;
    font-size: .9rem;
    color: #666;
}
.subscription-info strong {
    color: #1a1a1a;
}
.subscription-plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}
.plan-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: border-color .2s;
}
.plan-card:hover {
    border-color: #4f6ef7;
}
.plan-card h4 {
    margin-bottom: 8px;
    color: #1a1a1a;
    font-size: 1.1rem;
}
.plan-card .price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4f6ef7;
    margin-bottom: 12px;
}
.plan-card .savings {
    color: #059669;
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: 12px;
}
.plan-card ul {
    list-style: none;
    margin-bottom: 16px;
    text-align: left;
}
.plan-card li {
    margin-bottom: 4px;
    font-size: .9rem;
    color: #666;
}
.plan-card li:before {
    content: "✓ ";
    color: #059669;
    font-weight: 600;
}
