:root {
    /* Government Professional Palette */
    --primary: #2563eb;
    /* Royal Blue */
    --primary-dark: #1e40af;
    --accent: #f97316;
    /* Saffron/Orange hint */
    --bg-body: #f8fafc;
    /* Light Gray */
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;

    /* Dark Mode Defaults (Can be toggled via JS class .dark-mode) */
    --sidebar-bg: #1e293b;
    /* Slate 800 */
    --chat-bg-grad-1: #f1f5f9;
    --chat-bg-grad-2: #e2e8f0;
}

/* Dark Theme Overrides */
body.dark-mode {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --chat-bg-grad-1: #0f172a;
    --chat-bg-grad-2: #020617;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Default: Allow scroll */
}

/* Specific fix for Chat Page to be static/fixed height */
body.chat-page {
    height: 100vh;
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- Navigation --- */
.main-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
}

.logo-text {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s;
    padding: 8px 12px;
    border-radius: 6px;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    background: #eff6ff;
}

.chat-highlight {
    background: var(--primary) !important;
    color: white !important;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-main);
}

/* --- Hero Section (Landing) --- */
.hero-section {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    padding: 80px 20px;
    text-align: center;
}

.hero-content h1 {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 20px;
    color: #1e3a8a;
}

.hero-content p {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 40px;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 60px;
}

.stat-card h3 {
    font-size: 32px;
    color: var(--primary);
    font-weight: 800;
}

.stat-card p {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Features Grid --- */
.features-section {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
}

.features-section h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 28px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 30px;
    border-radius: 12px;
    transition: all 0.3s ease;
    text-align: center;
}

.feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.feature-card .icon-box {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 20px;
    background: #eff6ff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

.feature-card h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-muted);
}

/* --- About --- */
.about-section {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 60px 20px;
    text-align: center;
}

.source-logos {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    font-weight: 600;
    color: var(--text-muted);
}

/* --- Footer --- */
.main-footer {
    background: #0f172a;
    color: #cbd5e1;
    padding: 40px 20px;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    font-size: 14px;
}

.footer-section h4 {
    color: white;
    margin-bottom: 20px;
}

.footer-section a {
    display: block;
    margin-bottom: 10px;
    opacity: 0.8;
}

.footer-section a:hover {
    opacity: 1;
    color: var(--primary);
}

.scheme-card {
    text-align: left;
    margin-bottom: 20px;
}

/* --- Dynamic Content --- */
.video-card {
    overflow: hidden;
}

.video-thumbnail {
    height: 180px;
    background: #000;
    position: relative;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 48px;
    transition: transform 0.2s;
}

.video-card:hover .play-btn {
    transform: translate(-50%, -50%) scale(1.1);
}

.video-info {
    padding: 20px;
}

.tag {
    background: #eff6ff;
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.scheme-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.scheme-header h3 {
    color: var(--primary);
    font-size: 20px;
    margin: 0;
}

.status-badge {
    background: #ecfdf5;
    color: #059669;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.scheme-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.meta-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 4px;
}


/* --- Eligibility Form --- */
.question-group {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px dashed var(--border);
}

.question-group:last-of-type {
    border-bottom: none;
}

.question-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
}

.options {
    display: flex;
    gap: 16px;
}

.radio-card {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-card:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.radio-card input {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

/* --- Results --- */
.hidden {
    display: none !important;
}

.result-card {
    text-align: center;
    padding: 20px;
}

.result-card .icon-box {
    font-size: 64px;
    margin-bottom: 20px;
}

.result-card.success .icon-box {
    color: #10b981;
}

.result-card.warning .icon-box {
    color: #f59e0b;
}

.result-card h3 {
    font-size: 24px;
    margin-bottom: 16px;
}

.reason-list {
    text-align: left;
    background: #fffbeb;
    padding: 20px 40px;
    border-radius: 8px;
    margin: 20px 0;
    color: #92400e;
}

.next-steps {
    text-align: left;
    background: #ecfdf5;
    padding: 20px 40px;
    border-radius: 8px;
    margin: 20px 0;
}

.next-steps li {
    margin-bottom: 8px;
}

.result-card .actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 30px;
}

/* --- Chat Interface Specifics (Restoring Chat Layout) --- */
.app-container {
    display: flex;
    flex: 1;
    /* Take remaining height */
    overflow: hidden;
    /* Prevent body scroll, let chat scroll */
}

.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    /* Dark slate by default for sidebar */
    color: white;
    /* Sidebar always dark usually or themed */
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0;
}

/* Force dark sidebar even in light mode for contrast? Or follow theme. */
/* Let's follow theme variables. */
.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    color: var(--text-main);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.logo-area .icon {
    font-size: 28px;
}

.logo-area h1 {
    font-size: 18px;
    font-weight: 700;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-section.bottom {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.nav-section.bottom p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.upload-trigger:hover {
    background: #eff6ff !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--chat-bg-grad-1), var(--chat-bg-grad-2));
    position: relative;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message .bubble {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    padding: 12px 16px;
    border-radius: 12px;
}

.message.user .bubble {
    background: var(--primary);
    color: white;
    border: none;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.chat-header h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.chat-header p {
    font-size: 14px;
    color: var(--text-muted);
}

.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.message.user {
    flex-direction: row-reverse;
}

.input-area {
    background: var(--bg-card);
    padding: 20px;
    border-top: 1px solid var(--border);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
}

.input-wrapper button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.input-wrapper button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.input-wrapper button ion-icon {
    font-size: 20px;
}

.loading-indicator {
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 14px;
    font-style: italic;
}

.loading-indicator.hidden {
    display: none;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 20px;
    border-radius: 24px;
    border: 1px solid var(--border);
    outline: none;
    background: var(--bg-body);
    color: var(--text-main);
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Mobile Utilities */
.mobile-only {
    display: none;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-toggle,
.close-sidebar {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
}

.menu-toggle:hover,
.close-sidebar:hover {
    background: var(--border);
}

.close-sidebar {
    margin-left: auto;
}

/* Tablet Styles */
@media (max-width: 1024px) {
    .hero-content h1 {
        font-size: 40px;
    }

    .hero-content p {
        font-size: 16px;
    }

    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 20px;
    }

    .sidebar {
        width: 240px;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }

    /* Navigation */
    .nav-links {
        position: fixed;
        top: 60px;
        right: 0;
        height: calc(100vh - 60px);
        width: 250px;
        background: var(--bg-card);
        border-left: 1px solid var(--border);
        flex-direction: column;
        padding: 20px;
        transform: translateX(100%);
        transition: transform 0.3s;
        z-index: 999;
    }

    .nav-links.show {
        transform: translateX(0);
    }

    .mobile-toggle {
        display: block;
    }

    .nav-logo {
        font-size: 16px;
    }

    /* Hero Section */
    .hero-section {
        padding: 60px 20px;
    }

    .hero-content h1 {
        font-size: 32px;
        line-height: 1.2;
    }

    .hero-content p {
        font-size: 16px;
        margin-bottom: 30px;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }

    .options {
        flex-direction: column;
    }

    .result-card .actions {
        flex-direction: column;
    }

    .hero-stats {
        flex-direction: column;
        gap: 20px;
        margin-top: 40px;
    }

    .stat-card h3 {
        font-size: 28px;
    }

    .scheme-meta {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Features Section */
    .features-section {
        margin: 40px auto;
        padding: 0 16px;
    }

    .features-section h2 {
        font-size: 24px;
        margin-bottom: 30px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .feature-card {
        padding: 24px;
    }

    /* About Section */
    .about-section {
        padding: 40px 20px;
    }

    .about-section h2 {
        font-size: 24px;
    }

    .source-logos {
        flex-direction: column;
        gap: 16px;
        font-size: 14px;
    }

    /* Chat Interface */
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        display: none;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 1001;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .sidebar.show {
        display: flex;
    }

    .chat-area {
        width: 100%;
    }

    .messages-container {
        padding: 16px;
        gap: 16px;
    }

    .input-area {
        padding: 16px;
    }

    .input-wrapper {
        flex-direction: column;
    }

    .input-wrapper input {
        padding: 12px 16px;
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 28px;
    }

    .hero-content p {
        font-size: 14px;
    }

    .stat-card h3 {
        font-size: 24px;
    }

    .stat-card p {
        font-size: 12px;
    }

    .features-section h2 {
        font-size: 20px;
    }

    .feature-card h3 {
        font-size: 16px;
    }

    .feature-card p {
        font-size: 13px;
    }

    .nav-logo {
        font-size: 14px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Quick Question Buttons (Clean UTF-8) */
.q-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.q-btn:hover {
    background: #eff6ff;
    color: var(--primary);
    border-color: var(--primary);
    transform: translateX(4px);
}