/* style.css */
/* Design language: Mistral AI (DESIGN.md) with Dark Mode support */

:root {
    /* Brand & Accent */
    --color-primary: #fa520f;
    --color-primary-deep: #cc3a05;
    
    /* Light Mode Palette */
    --color-canvas: #ffffff;
    --color-ink: #1f1f1f;
    --color-body: #3d3d3d;
    --color-muted: #8a8a8a;
    --color-muted-soft: #a8a8a8;
    --color-hairline: #e5e5e5;
    --color-hairline-soft: #ededed;
    --color-hairline-strong: #c7c7c7;
    --color-surface-card: #fff8e0; /* Cream */
    --color-surface-soft: #fffaeb; /* Cream-light */
    --color-surface-dark: #1c1c1e; /* Dark panel */
    --color-surface-dark-elevated: #2c2c2e;
    --color-surface-dark-soft: #252528;
    --color-on-dark: #ffffff;
    --color-on-dark-soft: #a8a8a8;
    
    /* Typography Fonts */
    --font-display: 'Cormorant Garamond', 'Garamond', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-code: 'JetBrains Mono', ui-monospace, monospace;

    /* Border Radii (Mistral style: 8px buttons, 12px cards) */
    --rounded-xs: 4px;
    --rounded-sm: 6px;
    --rounded-md: 8px;
    --rounded-lg: 12px;
    --rounded-full: 9999px;

    /* Spacing system (Mistral base 4px) */
    --spacing-xxs: 4px;
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 20px;
    --spacing-xl: 24px;
    --spacing-xxl: 32px;
    --spacing-xxxl: 40px;
    --spacing-section: 64px;
    --spacing-section-lg: 96px;
}

/* Dark Mode Overrides */
body.dark-mode {
    --color-canvas: #121212;
    --color-ink: #f5f5f5;
    --color-body: #d1d1d1;
    --color-muted: #8a8a8a;
    --color-muted-soft: #5a5a5a;
    --color-hairline: #2d2d2d;
    --color-hairline-soft: #222222;
    --color-hairline-strong: #3d3d3d;
    --color-surface-card: #1a1a1a; /* Dark Card */
    --color-surface-soft: #161616; /* Dark Soft */
    --color-surface-dark: #0d0d0d;
    --color-surface-dark-elevated: #1a1a1a;
    --color-surface-dark-soft: #151515;
    --color-on-dark: #f5f5f5;
    --color-on-dark-soft: #8a8a8a;
}

/* Base resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-canvas);
    color: var(--color-body);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.55;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Headings: Elegant serif PP Editorial Old voice */
h1, h2, h3, h4 {
    color: var(--color-ink);
    font-family: var(--font-display);
    font-weight: 400; /* PP Editorial is regular weight */
    letter-spacing: -0.5px;
    line-height: 1.1;
}

h1 {
    font-size: 3.5rem;
    letter-spacing: -1px;
}

h2 {
    font-size: 2.25rem;
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-hairline);
    padding-bottom: var(--spacing-sm);
    text-transform: uppercase;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
}

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary-deep);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-xxl);
}

/* Top Nav */
.top-nav {
    background-color: var(--color-canvas);
    height: 64px;
    border-bottom: 1px solid var(--color-hairline);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--spacing-xxl);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.logo-icon {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #ff8105 100%);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.logo-text {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-ink);
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.nav-links a {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-muted);
}

.nav-links a:hover {
    color: var(--color-ink);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: none;
    border: none;
    color: var(--color-ink);
    cursor: pointer;
    padding: var(--spacing-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--rounded-full);
    transition: background-color 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: var(--color-surface-soft);
}

/* Hero Section (Contains Layout + Chat) */
.hero {
    padding: var(--spacing-xl) 0 var(--spacing-section);
    background-color: var(--color-canvas);
    transition: background-color 0.3s ease;
}

.hero-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: var(--spacing-xxl);
    align-items: stretch;
}

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

.hero-left-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hero-title-block {
    margin-bottom: var(--spacing-md);
}

.hero-title {
    font-size: 3.25rem;
    line-height: 1.05;
    margin-bottom: var(--spacing-sm);
    color: var(--color-ink);
}

.hero-slogan {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: var(--spacing-sm);
}

.hero-slogan strong {
    font-weight: 800;
    color: var(--color-primary-deep);
}

.hero-intro {
    font-size: 15px;
    color: var(--color-body);
    line-height: 1.5;
    margin-bottom: var(--spacing-sm);
}

/* Selector Panel (Compact Inside Hero Col) */
.selector-panel {
    background-color: var(--color-surface-card);
    border: 1px solid var(--color-hairline);
    padding: var(--spacing-lg);
    border-radius: var(--rounded-lg);
    margin-bottom: var(--spacing-md);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.selector-panel h3 {
    font-size: 1.15rem;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--color-ink);
}

.detector-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-hairline);
    padding-bottom: var(--spacing-sm);
}

.detector-item {
    display: flex;
    flex-direction: column;
}

.detector-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    font-weight: 600;
}

.detector-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-ink);
}

.detector-value.success {
    color: var(--color-primary);
}

.detector-value.warning {
    color: var(--color-muted);
}

.model-stack {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

.model-option-card {
    background-color: var(--color-canvas);
    border: 1px solid var(--color-hairline);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--rounded-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-option-card:hover {
    border-color: var(--color-primary);
}

.model-option-card.selected {
    border-color: var(--color-primary);
    background-color: var(--color-surface-soft);
    box-shadow: inset 0 0 0 1px var(--color-primary);
}

.model-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.model-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-ink);
}

.model-badge {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: var(--color-surface-card);
    padding: 2px 6px;
    border-radius: var(--rounded-sm);
    color: var(--color-ink);
}

.model-badge.recommended {
    background-color: var(--color-primary);
    color: #ffffff;
}

.model-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--color-muted);
    margin-top: 2px;
}

.loader-action-container {
    display: flex;
    flex-direction: column;
}

/* Progress bar */
.progress-container {
    display: none;
    flex-direction: column;
    gap: var(--spacing-xxs);
    background-color: var(--color-canvas);
    border: 1px solid var(--color-hairline);
    padding: var(--spacing-sm);
    border-radius: var(--rounded-md);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 500;
}

.progress-track {
    height: 4px;
    background-color: var(--color-hairline);
    position: relative;
    overflow: hidden;
    border-radius: var(--rounded-full);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary) 0%, #ffa110 100%);
    transition: width 0.1s ease;
}

.progress-status {
    font-size: 10px;
    color: var(--color-muted);
    font-family: var(--font-code);
}

/* Mobile Warning */
#mobile-warning {
    background-color: var(--color-primary-deep);
    color: #ffffff;
    padding: var(--spacing-sm);
    font-size: 11px;
    font-weight: 500;
    border-radius: var(--rounded-md);
    margin-top: var(--spacing-xs);
    line-height: 1.4;
}

/* Buttons (Mistral style: 8px radius, uppercase tracked) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 24px;
    height: 44px;
    border-radius: var(--rounded-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

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

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

.btn-outline {
    background-color: transparent;
    border-color: var(--color-hairline-strong);
    color: var(--color-ink);
}

.btn-outline:hover {
    background-color: var(--color-surface-soft);
}

.btn-sm {
    padding: 6px 12px;
    height: 32px;
    font-size: 11px;
}

/* Interactive Chat Workspace (ChatGPT / Gemini style) */
.chat-workspace {
    border: 1px solid var(--color-hairline);
    border-radius: var(--rounded-lg);
    background-color: var(--color-surface-soft);
    display: grid;
    grid-template-columns: 240px 1fr;
    height: 100%;
    min-height: 580px;
    overflow: hidden;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

@media (max-width: 768px) {
    .chat-workspace {
        grid-template-columns: 1fr;
        height: 500px;
    }
}

/* Sidebar */
.chat-sidebar {
    background-color: var(--color-surface-card);
    border-right: 1px solid var(--color-hairline);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

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

.sidebar-header {
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--color-hairline);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-ink);
}

.new-chat-btn {
    background-color: var(--color-canvas);
    color: var(--color-ink);
    border: 1px solid var(--color-hairline-strong);
    border-radius: var(--rounded-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    background-color: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.history-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: var(--spacing-xs) 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-item {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-body);
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.history-item:hover, .history-item.active {
    background-color: var(--color-canvas);
    color: var(--color-ink);
}

.history-item.active {
    border-left-color: var(--color-primary);
}

.history-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.history-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    padding: 0 var(--spacing-xxs);
    font-size: 14px;
}

.history-item:hover .history-delete {
    opacity: 1;
}

.history-delete:hover {
    color: var(--color-primary);
}

.sidebar-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--color-hairline);
    background-color: var(--color-surface-soft);
    font-size: 11px;
    color: var(--color-muted);
}

/* Chat Main Area */
.chat-main {
    display: flex;
    flex-direction: column;
    background-color: var(--color-canvas);
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.model-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--color-muted-soft);
}

.model-status-dot.active {
    background-color: var(--color-primary);
}

.model-status-dot.loading {
    background-color: var(--color-primary-deep);
    animation: pulse 1.5s infinite;
}

.chat-stream {
    flex-grow: 1;
    overflow-y: auto;
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--color-muted);
}

.welcome-icon {
    font-size: 32px;
    color: var(--color-primary);
    margin-bottom: var(--spacing-sm);
}

.welcome-title {
    color: var(--color-ink);
    font-size: 22px;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
    font-family: var(--font-body);
}

.welcome-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-sm);
    width: 100%;
    max-width: 480px;
    margin-top: var(--spacing-lg);
}

.suggestion-card {
    background-color: var(--color-surface-soft);
    border: 1px solid var(--color-hairline);
    padding: var(--spacing-md);
    border-radius: var(--rounded-md);
    cursor: pointer;
    font-size: 12px;
    color: var(--color-body);
    text-align: left;
    transition: all 0.2s ease;
}

.suggestion-card:hover {
    border-color: var(--color-primary);
    color: var(--color-ink);
    background-color: var(--color-surface-card);
}

/* Chat Messages */
.chat-message {
    display: flex;
    gap: var(--spacing-md);
    max-width: 100%;
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-hairline-soft);
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--rounded-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.chat-message.user .message-avatar {
    background-color: var(--color-surface-soft);
    color: var(--color-ink);
    border: 1px solid var(--color-hairline);
}

.chat-message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--color-primary) 0%, #ffb83e 100%);
    color: #ffffff;
}

.message-body {
    flex-grow: 1;
    overflow-x: auto;
}

.message-meta {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    font-weight: 700;
    margin-bottom: var(--spacing-xxs);
}

.message-content {
    font-size: 14px;
    color: var(--color-ink);
    line-height: 1.55;
}

.message-content pre {
    background-color: var(--color-surface-dark);
    padding: var(--spacing-md);
    overflow-x: auto;
    font-family: var(--font-code);
    font-size: 13px;
    border-radius: var(--rounded-md);
    margin: var(--spacing-sm) 0;
    color: #e5e5e5;
}

.message-content code {
    font-family: var(--font-code);
    background-color: var(--color-surface-soft);
    padding: 2px 6px;
    font-size: 13px;
    border-radius: var(--rounded-xs);
}

.message-content pre code {
    padding: 0;
    background-color: transparent;
    border-radius: 0;
}

/* Chat Input Area */
.chat-input-area {
    padding: var(--spacing-md);
    border-top: 1px solid var(--color-hairline);
    background-color: var(--color-canvas);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.chat-input-form {
    display: flex;
    gap: var(--spacing-sm);
    align-items: flex-end;
}

.chat-textarea {
    flex-grow: 1;
    background-color: var(--color-canvas);
    border: 1px solid var(--color-hairline-strong);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: 14px;
    padding: 12px var(--spacing-md);
    height: 44px;
    max-height: 120px;
    resize: none;
    border-radius: var(--rounded-md);
    transition: border-color 0.2s ease, background-color 0.3s ease;
}

.chat-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.chat-textarea::placeholder {
    color: var(--color-muted);
}

.chat-textarea:disabled {
    opacity: 0.6;
    background-color: var(--color-surface-soft);
    cursor: not-allowed;
}

.chat-submit-btn, .chat-stop-btn {
    background-color: var(--color-primary);
    color: #ffffff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--rounded-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.chat-submit-btn:hover {
    background-color: var(--color-primary-deep);
}

.chat-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--color-muted-soft);
}

.chat-stop-btn {
    background-color: var(--color-primary-deep);
    display: none;
}

.chat-input-hints {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--color-muted);
    margin-top: var(--spacing-xs);
}

/* Product Overview Section */
.seo-description-section {
    padding: var(--spacing-section-lg) 0;
    border-top: 1px solid var(--color-hairline);
    background-color: var(--color-canvas);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.editorial-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-xxl);
}

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

.editorial-col h3 {
    margin-top: var(--spacing-lg);
    color: var(--color-ink);
}

.editorial-col p {
    color: var(--color-body);
    font-size: 15px;
    line-height: 1.6;
}

/* FAQs Section */
.seo-faq-section {
    padding: var(--spacing-section-lg) 0;
    border-top: 1px solid var(--color-hairline);
    background-color: var(--color-surface-soft);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.faq-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column clean list for FAQs */
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.faq-item {
    background-color: var(--color-canvas);
    border: 1px solid var(--color-hairline);
    padding: var(--spacing-lg);
    border-radius: var(--rounded-lg);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.faq-question {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--color-ink);
    margin-bottom: var(--spacing-xs);
}

.faq-answer {
    color: var(--color-body);
    font-size: 14px;
    line-height: 1.6;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(31, 31, 31, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-lg);
}

body.dark-mode .modal-overlay {
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: var(--color-canvas);
    border: 1px solid var(--color-hairline);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    color: var(--color-body);
    border-radius: var(--rounded-lg);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.modal-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--color-hairline);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--color-ink);
}

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
}

.modal-body h3 {
    margin-top: var(--spacing-md);
    color: var(--color-ink);
}

.modal-body p {
    margin-bottom: var(--spacing-sm);
}

/* Contact Us form */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-ink);
}

.form-control {
    background-color: var(--color-canvas);
    border: 1px solid var(--color-hairline-strong);
    padding: 8px 12px;
    font-family: var(--font-body);
    font-size: 14px;
    border-radius: var(--rounded-md);
    color: var(--color-ink);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Sunset stripe divider signature band at page bottom */
.sunset-stripe-band {
    height: 6px;
    width: 100%;
    background: linear-gradient(90deg, #fa520f 0%, #ffa110 30%, #ffb83e 60%, #ffd900 85%, #fff8e0 100%);
}

/* Footer */
.footer {
    background-color: var(--color-surface-card);
    color: var(--color-body);
    padding: var(--spacing-xxl) 0;
    border-top: 1px solid var(--color-hairline);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr repeat(3, 1fr);
    gap: var(--spacing-xl);
}

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

.footer-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.footer-logo {
    color: var(--color-ink);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.2rem;
}

.footer-text {
    font-size: 13px;
    line-height: 1.6;
}

.footer-title {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-ink);
    margin-bottom: var(--spacing-xs);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.footer-links a {
    font-size: 13px;
    color: var(--color-muted);
}

.footer-links a:hover {
    color: var(--color-primary);
}

.footer-bottom {
    margin-top: var(--spacing-xxl);
    border-top: 1px solid var(--color-hairline);
    padding-top: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--color-muted);
}

@media (max-width: 768px) {
    .footer-bottom {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
}

/* Immersive Mode Rules */
body.immersive-active {
    overflow: hidden !important;
}

body.immersive-active #top-nav,
body.immersive-active .stripe-divider,
body.immersive-active .hero-left-col,
body.immersive-active .seo-description-section,
body.immersive-active .seo-faq-section,
body.immersive-active footer {
    display: none !important;
}

body.immersive-active .hero {
    padding: 0 !important;
    height: 100vh !important;
    min-height: 100vh !important;
    display: flex;
    flex-direction: column;
}

body.immersive-active .hero > .container {
    max-width: 100% !important;
    width: 100% !important;
    height: 100vh !important;
    padding: 0 !important;
}

body.immersive-active .hero-grid {
    grid-template-columns: 1fr !important;
    height: 100% !important;
    gap: 0 !important;
}

body.immersive-active .chat-workspace {
    border: none !important;
    border-radius: 0 !important;
    height: 100vh !important;
    min-height: 100vh !important;
}

/* History Rename / Actions */
.history-actions {
    opacity: 0;
    display: flex;
    gap: 4px;
    transition: opacity 0.2s ease;
}

.history-item:hover .history-actions {
    opacity: 1;
}

.history-actions .history-delete {
    opacity: 1 !important;
}

.history-edit {
    background: none;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    padding: 0 var(--spacing-xxs);
    font-size: 14px;
    transition: color 0.2s ease;
}

.history-edit:hover {
    color: var(--color-primary) !important;
}

/* Header Model Selector options styling */
.header-model-select option {
    background-color: var(--color-surface-card);
    color: var(--color-ink);
}

/* History navigation chevron buttons */
.history-nav-btn {
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.history-nav-btn:hover:not(:disabled) {
    background-color: var(--color-surface-soft-hover) !important;
}

.history-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed !important;
}

/* =============================================
   CHAT HEADER — Structured Layout
   ============================================= */
.chat-header {
    height: auto;
    min-height: 48px;
    border-bottom: 1px solid var(--color-hairline);
    padding: 0 var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: nowrap;
    transition: border-color 0.3s ease;
}

.chat-header-model {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}

.header-model-select {
    background: transparent;
    border: none;
    color: var(--color-ink);
    font-weight: 600;
    cursor: pointer;
    outline: none;
    font-size: 13px;
    font-family: var(--font-body);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-header-load-btn {
    height: 26px;
    font-size: 10px;
    padding: 0 8px;
    flex-shrink: 0;
}

.chat-header-actions {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    flex-shrink: 0;
}

.chat-header-actions .btn-sm {
    height: 28px;
    font-size: 9px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* =============================================
   HAMBURGER BUTTON (mobile only)
   ============================================= */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--color-ink);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--rounded-md);
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.hamburger-btn:hover {
    background-color: var(--color-surface-soft);
}

/* =============================================
   MOBILE NAV DRAWER
   ============================================= */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mobile-nav-overlay.open {
    opacity: 1;
}

.mobile-nav-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: min(320px, 85vw);
    height: 100%;
    background-color: var(--color-canvas);
    border-left: 1px solid var(--color-hairline);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.mobile-nav-overlay.open .mobile-nav-drawer {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--color-hairline);
}

.mobile-nav-header .logo-container span {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-ink);
    letter-spacing: 0.5px;
}

.mobile-nav-close {
    background: none;
    border: none;
    color: var(--color-ink);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--rounded-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.mobile-nav-close:hover {
    background-color: var(--color-surface-soft);
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md) 0;
}

.mobile-nav-link {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 500;
    color: var(--color-body);
    padding: var(--spacing-md) var(--spacing-lg);
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    display: block;
}

.mobile-nav-link:hover {
    color: var(--color-ink);
    background-color: var(--color-surface-soft);
    border-left-color: var(--color-primary);
}

/* =============================================
   MOBILE RESPONSIVE OVERRIDES (≤ 768px)
   ============================================= */
@media (max-width: 768px) {

    /* Prevent horizontal scroll globally */
    html, body {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Container padding tighter on mobile */
    .container {
        padding: 0 var(--spacing-md);
    }

    /* --- Topbar --- */
    /* Hide the logo text; keep icon */
    .logo-text {
        display: none;
    }

    /* Hide desktop nav links */
    .nav-links {
        display: none;
    }

    /* Show hamburger button */
    .hamburger-btn {
        display: flex;
    }

    /* --- Hero layout: single column stack --- */
    .hero {
        padding: var(--spacing-md) 0 var(--spacing-xxl);
    }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .hero-title {
        font-size: 2.25rem;
    }

    /* --- Chat workspace: full width, taller --- */
    .chat-workspace {
        grid-template-columns: 1fr;
        min-height: 520px;
        height: auto;
        border-radius: var(--rounded-md);
    }

    /* Sidebar hidden on mobile (already handled above) */
    .chat-sidebar {
        display: none;
    }

    /* --- Chat header: allow wrapping on very small screens --- */
    .chat-header {
        flex-wrap: wrap;
        height: auto;
        padding: var(--spacing-xs) var(--spacing-sm);
        gap: var(--spacing-xs);
        min-height: 48px;
    }

    .chat-header-model {
        flex: 1 1 0;
        min-width: 0;
    }

    .header-model-select {
        font-size: 12px;
        max-width: 150px;
    }

    .chat-header-actions {
        gap: 6px;
    }

    /* Show only icon for immersive mode on tiny screens */
    .immersive-label {
        display: none;
    }

    .chat-header-actions .btn-sm {
        padding: 0 8px;
        height: 26px;
        font-size: 8px;
    }

    /* --- Chat stream padding --- */
    .chat-stream {
        padding: var(--spacing-md);
    }

    /* --- Chat input area --- */
    .chat-input-area {
        padding: var(--spacing-sm);
    }

    .chat-input-hints {
        flex-direction: column;
        gap: 2px;
        font-size: 9px;
    }

    /* --- Selector panel --- */
    .selector-panel {
        padding: var(--spacing-md);
    }

    .detector-row {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-xs);
    }

    /* --- FAQ section --- */
    .faq-item {
        padding: var(--spacing-md);
    }

    /* --- Topbar height --- */
    .top-nav {
        padding: 0 var(--spacing-md);
    }
}

/* Very small screens (≤ 380px) */
@media (max-width: 380px) {
    .header-model-select {
        max-width: 110px;
        font-size: 11px;
    }

    .chat-header-actions .btn-sm {
        padding: 0 6px;
        height: 24px;
        font-size: 8px;
    }

    .hero-title {
        font-size: 1.85rem;
    }
}

