/* ============================================================
   AviaPilot — TriVector Labs
   Global Stylesheet
   ------------------------------------------------------------
   Forked from AviaHub's app.css with module-tab, admin, AviAMS,
   and analysis-specific styles stripped. AviaPilot is a single-
   product portal (chat only), so we keep base brand variables,
   auth pages, the full chat UI, plus a small set of AviaPilot-
   specific additions (paper-airplane hero, pricing cards, group
   lounge banner placeholder for Phase 5).
   ============================================================ */

:root {
    --tv-navy: #1a1a1a;
    --tv-navy-light: #2a2a2a;
    --tv-blue: #2d68ea;
    --tv-accent: #2d68ea;
    --tv-cyan: #ffb30b;
    --tv-surface: #f0f4f8;
    --tv-card: #ffffff;
    --tv-text: #1e293b;
    --tv-text-muted: #64748b;
    --tv-border: #e2e8f0;
}

html, body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--tv-surface);
    color: var(--tv-text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Layout shell (AviaPilot MainLayout)
   ============================================================ */

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--tv-navy);
    color: #ffffff;
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-header .brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: inherit;
}

.app-header .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    padding: 4px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.app-header .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.app-header .brand-title {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.app-header .brand-subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.app-header-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.app-header a.nav-link-custom,
.app-header a.nav-link-custom:visited {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #ffffff;
    text-decoration: none;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s;
}

.app-header a.nav-link-custom:hover,
.app-header a.nav-link-custom:focus,
.app-header a.nav-link-custom.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

.app-header .nav-user-name {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.app-footer {
    background: var(--tv-navy);
    color: rgba(255, 255, 255, 0.55);
    padding: 1rem 1.5rem;
    font-size: 0.78rem;
    text-align: center;
}

.app-footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.app-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Chat layout nests inside MainLayout — constrain to viewport, hide footer */
.app-layout:has(.chat-layout),
.app-layout:has(.chat-container) {
    height: 100vh;
    overflow: hidden;
}

.app-layout:has(.chat-layout) > .app-main,
.app-layout:has(.chat-container) > .app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.app-layout:has(.chat-layout) > .app-footer,
.app-layout:has(.chat-container) > .app-footer {
    display: none;
}

/* Suppress focus outline on brand area (Blazor sets focus on first render) */
.app-header h1,
.app-header .brand,
.app-header .brand-title,
.app-header .brand-subtitle {
    outline: none;
}

/* ============================================================
   Hero section (landing page, /pilot/join, etc.)
   ============================================================ */

.hero-section {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 40%, #2d68ea 100%);
    padding: 3rem 1.5rem 3.5rem;
    color: white;
    text-align: center;
}

.hero-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    padding: 14px;
    box-sizing: border-box;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.hero-title {
    font-family: 'Inter', sans-serif;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
}

.hero-subtitle {
    max-width: 640px;
    margin: 0 auto 1.5rem;
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.55;
}

.hero-cta-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: transform 0.1s, filter 0.15s;
}

.hero-cta-primary {
    background: linear-gradient(135deg, var(--tv-accent), var(--tv-cyan));
    color: #ffffff;
    border: none;
}

.hero-cta-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    color: #ffffff;
}

.hero-cta-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.hero-cta-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

/* ============================================================
   Pricing cards (Individual + Group)
   ============================================================ */

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    max-width: 880px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

.pricing-card {
    background: var(--tv-card);
    border: 1px solid var(--tv-border);
    border-radius: 16px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.pricing-card:hover {
    border-color: var(--tv-accent);
    box-shadow: 0 8px 24px rgba(45, 104, 234, 0.12);
    transform: translateY(-2px);
}

.pricing-card.recommended {
    border-color: var(--tv-accent);
    box-shadow: 0 4px 16px rgba(45, 104, 234, 0.18);
    position: relative;
}

.pricing-card.recommended::before {
    content: "Recommended";
    position: absolute;
    top: -10px;
    right: 1rem;
    background: linear-gradient(135deg, var(--tv-accent), var(--tv-cyan));
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pricing-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--tv-text);
    margin-bottom: 0.35rem;
}

.pricing-card-tagline {
    font-size: 0.85rem;
    color: var(--tv-text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.pricing-card-price {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
}

.pricing-card-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--tv-text);
}

.pricing-card-period {
    font-size: 0.85rem;
    color: var(--tv-text-muted);
}

.pricing-card-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    flex: 1;
}

.pricing-card-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0;
    font-size: 0.88rem;
    color: var(--tv-text);
    line-height: 1.4;
}

.pricing-card-features .material-symbols-outlined {
    color: var(--tv-accent);
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.pricing-card-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.25rem;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--tv-accent), #2563eb);
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    border: none;
    transition: filter 0.15s, transform 0.1s;
}

.pricing-card-cta:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    color: #ffffff;
}

.pricing-card-cta.secondary {
    background: transparent;
    color: var(--tv-accent);
    border: 1px solid var(--tv-accent);
}

.pricing-card-cta.secondary:hover {
    background: rgba(45, 104, 234, 0.06);
    transform: translateY(-1px);
}

/* ============================================================
   Group Lounge banner (Phase 5 — placeholder styling now)
   ============================================================ */

.lounge-banner {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: linear-gradient(135deg, rgba(45, 104, 234, 0.12), rgba(255, 179, 11, 0.08));
    border: 1px solid rgba(45, 104, 234, 0.25);
    border-radius: 10px;
    padding: 0.65rem 1rem;
    margin: 0.75rem 1.5rem;
    font-size: 0.85rem;
    color: var(--tv-text);
}

.lounge-banner .material-symbols-outlined {
    color: var(--tv-accent);
    font-size: 20px;
    flex-shrink: 0;
}

.lounge-banner strong {
    font-weight: 600;
}

.lounge-banner a {
    color: var(--tv-accent);
    font-weight: 600;
    margin-left: auto;
    text-decoration: none;
}

.lounge-banner a:hover {
    text-decoration: underline;
}

/* End-lounge-mode admin button — visually distinct from the conversion CTA so it
   reads as an action button rather than a marketing link. Visible only to admins
   of the host org (gated in MainLayout's @code block). */
.lounge-banner a.lounge-end-link {
    color: var(--tv-text);
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    margin-left: 0; /* the upsell link takes margin-left:auto; this sits beside it */
    font-weight: 500;
    font-size: 0.82rem;
    white-space: nowrap;
}

.lounge-banner a.lounge-end-link:hover {
    background: rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: var(--tv-text);
}

/* ============================================================
   Chat upgrade prompt (Phase 7 — visitor / no-sub conversion CTA)
   ------------------------------------------------------------
   Lives between the chat topbar and the message scroller. Two flavors:
   lounge-visitor (loungeOrgId set) and off-site free-tier (no AviaPilot
   sub on a personal device). Both nudge toward /plans without being
   intrusive. Dismissible per circuit.
   ============================================================ */

.chat-upgrade-prompt {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(45, 104, 234, 0.07), rgba(255, 179, 11, 0.05));
    border-bottom: 1px solid rgba(45, 104, 234, 0.18);
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
    color: var(--tv-text);
    flex-shrink: 0;
}

.chat-upgrade-prompt-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(45, 104, 234, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-upgrade-prompt-icon .material-symbols-outlined {
    color: var(--tv-accent);
    font-size: 1.1rem;
}

.chat-upgrade-prompt-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    line-height: 1.35;
}

.chat-upgrade-prompt-body strong {
    color: var(--tv-text);
    font-weight: 600;
}

.chat-upgrade-prompt-body .text-muted {
    color: var(--tv-text-muted);
    font-size: 0.82rem;
}

.chat-upgrade-prompt-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.chat-upgrade-prompt-actions .btn-primary {
    background: linear-gradient(135deg, var(--tv-accent), #2563eb);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
    text-decoration: none;
    transition: filter 0.15s, transform 0.1s;
}

.chat-upgrade-prompt-actions .btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    color: white;
}

.chat-upgrade-prompt-actions .btn-link {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--tv-text-muted);
    display: inline-flex;
    align-items: center;
}

.chat-upgrade-prompt-actions .btn-link:hover {
    color: var(--tv-text);
}

@media (max-width: 768px) {
    .chat-upgrade-prompt {
        flex-wrap: wrap;
        padding: 0.6rem 0.85rem;
    }
    .chat-upgrade-prompt-body {
        flex-basis: 100%;
        order: 2;
    }
    .chat-upgrade-prompt-actions {
        order: 3;
        margin-left: auto;
    }
}

/* ============================================================
   Auth pages (Login, Register, Subscriptions, Logout)
   ============================================================ */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--tv-card);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--tv-border);
}

.auth-card-wide {
    max-width: 640px;
}

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

.auth-header h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tv-text);
    margin-bottom: 0.25rem;
}

.auth-header p {
    font-size: 0.9rem;
    color: var(--tv-text-muted);
}

.auth-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}

.auth-card .form-label {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--tv-text);
}

.auth-card .form-control,
.auth-card .form-select {
    border-radius: 8px;
    border: 1px solid var(--tv-border);
    padding: 0.6rem 0.85rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-card .form-control:focus,
.auth-card .form-select:focus {
    border-color: var(--tv-accent);
    box-shadow: 0 0 0 3px rgba(45, 104, 234, 0.15);
}

.auth-card .btn-primary {
    background: linear-gradient(135deg, var(--tv-accent), #2563eb);
    border: none;
    border-radius: 10px;
    padding: 0.7rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: filter 0.15s, transform 0.1s;
}

.auth-card .btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--tv-border);
}

.auth-footer p {
    font-size: 0.88rem;
    color: var(--tv-text-muted);
    margin: 0;
}

.auth-footer a {
    color: var(--tv-accent);
    font-weight: 500;
    text-decoration: none;
}

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

/* Scope toggle (Individual / Group) on Register page */
.scope-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-bottom: 1.5rem;
}

.scope-option {
    position: relative;
    cursor: pointer;
}

.scope-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.scope-option-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.85rem 0.75rem;
    border: 1.5px solid var(--tv-border);
    border-radius: 10px;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}

.scope-option-label .material-symbols-outlined {
    color: var(--tv-text-muted);
    font-size: 22px;
    transition: color 0.15s;
}

.scope-option-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--tv-text);
}

.scope-option-hint {
    font-size: 0.72rem;
    color: var(--tv-text-muted);
    line-height: 1.3;
}

.scope-option:has(input:checked) .scope-option-label {
    border-color: var(--tv-accent);
    background: rgba(45, 104, 234, 0.05);
}

.scope-option:has(input:checked) .scope-option-label .material-symbols-outlined {
    color: var(--tv-accent);
}

/* ============================================================
   Validation, alerts, spinner, Blazor error UI
   ============================================================ */

.validation-message {
    color: #ef4444;
    font-size: 0.82rem;
    margin-top: 0.25rem;
}

.alert-info {
    background: rgba(45, 104, 234, 0.08);
    border: 1px solid rgba(45, 104, 234, 0.2);
    color: #1e3a8a;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
}

.alert-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #7f1d1d;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--tv-accent);
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ============================================================================
   Chat UI Styles (ported as-is from AviaHub — single source of truth)
   ============================================================================ */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Chat top bar */
.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--tv-border);
    min-height: 56px;
}

.chat-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.chat-topbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    flex-shrink: 0;
}

.chat-topbar-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-topbar-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--tv-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-topbar-subtitle {
    font-size: 0.72rem;
    color: #94a3b8;
    white-space: nowrap;
}

.chat-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-usage-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--tv-surface);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--tv-text-muted);
    font-weight: 500;
}

/* Messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 3px;
}

/* Welcome screen */
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    padding: 2rem;
    color: var(--tv-text-muted);
}

.chat-welcome-icon {
    font-size: 3rem;
    color: var(--tv-accent);
    margin-bottom: 1rem;
    opacity: 0.6;
}

.chat-welcome-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fff;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(45, 104, 234, 0.25);
}

.chat-welcome h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--tv-text);
    margin-bottom: 0.5rem;
}

.chat-welcome p {
    max-width: 500px;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.chat-welcome-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    max-width: 600px;
}

.chat-followup-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.chat-suggestion {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--tv-border);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--tv-text);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.chat-suggestion:hover {
    border-color: var(--tv-accent);
    background: rgba(45, 104, 234, 0.04);
}

/* Message bubbles */
.chat-message {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    max-width: 85%;
}

.chat-message-user {
    align-self: flex-end;
    flex-direction: row;
}

.chat-message-assistant {
    align-self: flex-start;
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tv-accent), var(--tv-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-message-avatar .material-symbols-outlined {
    font-size: 1rem;
    color: white;
}

.avia-avatar-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
}

.avatar-user {
    background: linear-gradient(135deg, #64748b, #475569);
}

.chat-message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 0.9rem;
}

.bubble-user {
    background: linear-gradient(135deg, var(--tv-accent), #2563eb);
    color: white;
    border-bottom-right-radius: 4px;
}

.bubble-user p {
    margin: 0;
}

.bubble-assistant {
    background: linear-gradient(135deg, #f0f7ff 0%, #f8fafc 100%);
    color: var(--tv-text);
    border: 1px solid rgba(45, 104, 234, 0.08);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(45, 104, 234, 0.06);
    position: relative;
}

/* Markdown content in assistant bubbles */
.bubble-assistant h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-top: 0.75rem;
    margin-bottom: 0.35rem;
    color: var(--tv-text);
}

.bubble-assistant h3:first-child {
    margin-top: 0;
}

.bubble-assistant p {
    margin: 0 0 0.5rem;
}

.bubble-assistant p:last-child {
    margin-bottom: 0;
}

.bubble-assistant ul, .bubble-assistant ol {
    margin: 0.25rem 0 0.5rem;
    padding-left: 1.25rem;
}

.bubble-assistant li {
    margin-bottom: 0.2rem;
}

.bubble-assistant strong {
    font-weight: 600;
    color: var(--tv-text);
}

.bubble-assistant code {
    background: var(--tv-surface);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.82rem;
}

/* Per-message PDF download button */
.chat-msg-download-bar {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: flex-end;
}

.chat-msg-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: 1px solid #cbd5e1;
    color: #64748b;
    cursor: pointer;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.chat-msg-download-btn .material-symbols-outlined {
    font-size: 1rem;
}

.chat-msg-download-btn:hover {
    color: var(--tv-accent);
    background: rgba(45, 104, 234, 0.06);
    border-color: var(--tv-accent);
}

/* Tool activity chips */
.chat-tool-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    background: rgba(45, 104, 234, 0.08);
    color: var(--tv-accent);
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.chat-tool-active {
    animation: toolPulse 1.5s ease-in-out infinite;
}

@keyframes toolPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Flight route map in chat bubbles */
.flight-route-map-container {
    height: 500px;
    width: 100%;
    margin-top: 0.75rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--tv-border);
    position: relative;
    z-index: 0;
}

.flight-route-map-container .leaflet-container {
    height: 100%;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.flight-route-map-container .leaflet-control-layers {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.flight-route-map-container .leaflet-control-layers-list label {
    margin-bottom: 2px;
}

.flight-route-map-container .leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.flight-route-map-container .leaflet-popup-content {
    margin: 8px 12px;
    font-size: 0.82rem;
    line-height: 1.4;
}

.flight-route-map-container .leaflet-popup-content strong {
    color: var(--tv-accent);
}

.flight-route-marker {
    background: none !important;
    border: none !important;
}

/* Driving route map in chat bubbles */
.driving-route-map-container {
    height: 500px;
    width: 100%;
    margin-top: 0.75rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--tv-border);
    position: relative;
    z-index: 0;
}

.driving-route-map-container .leaflet-container {
    height: 100%;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.driving-route-map-container .leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.driving-route-map-container .leaflet-popup-content {
    margin: 8px 12px;
    font-size: 0.82rem;
    line-height: 1.4;
}

.driving-route-marker {
    background: none !important;
    border: none !important;
}

.driving-route-info {
    background: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #1e293b;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    font-family: 'Inter', sans-serif;
}

.flight-route-map-pending {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .flight-route-map-container,
    .driving-route-map-container {
        height: 440px;
    }
}

/* Streaming cursor */
.chat-cursor {
    animation: blink 0.8s step-end infinite;
    color: var(--tv-accent);
    font-weight: 300;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Avia thinking indicator */
.avia-thinking {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0;
}
.avia-thinking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    animation: aviaBounce 1.4s ease-in-out infinite;
}
.avia-thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.avia-thinking-dot:nth-child(3) { animation-delay: 0.4s; }
.avia-thinking-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-left: 0.25rem;
    font-style: italic;
}
@keyframes aviaBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.chat-input-area {
    border-top: 1px solid var(--tv-border);
    background: white;
    padding: 0.75rem 1.5rem 0.5rem;
}

.chat-limit-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #92400e;
    margin-bottom: 0.5rem;
}

.chat-limit-alert a {
    color: var(--tv-accent);
    font-weight: 600;
}

.chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: var(--tv-surface);
    border-radius: 14px;
    padding: 0.5rem;
    border: 1px solid var(--tv-border);
    transition: border-color 0.2s;
}

.chat-input-bar:focus-within {
    border-color: var(--tv-accent);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    font-family: 'Inter', sans-serif;
    max-height: 120px;
    color: var(--tv-text);
}

.chat-input::placeholder {
    color: var(--tv-text-muted);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--tv-accent), var(--tv-cyan));
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.1s;
}

.chat-send-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-btn .material-symbols-outlined {
    font-size: 1.2rem;
}

/* Attach button */
.chat-attach-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--tv-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}

.chat-attach-btn:hover:not(:disabled) {
    color: var(--tv-accent);
    background: rgba(45, 104, 234, 0.08);
}

.chat-attach-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-attach-btn .material-symbols-outlined {
    font-size: 1.3rem;
}

/* Attachment preview strip */
.chat-attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0;
}

.attachment-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--tv-surface);
    border: 1px solid var(--tv-border);
    border-radius: 10px;
    padding: 0.3rem 0.5rem;
    max-width: 200px;
}

.attachment-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.attachment-file-icon {
    font-size: 1.4rem;
    color: var(--tv-text-muted);
    flex-shrink: 0;
}

.attachment-name {
    font-size: 0.78rem;
    color: var(--tv-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.attachment-size {
    font-size: 0.7rem;
    color: var(--tv-text-muted);
    flex-shrink: 0;
}

.attachment-remove {
    background: none;
    border: none;
    color: var(--tv-text-muted);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
}

.attachment-remove:hover {
    color: #ef4444;
}

.attachment-remove .material-symbols-outlined {
    font-size: 1rem;
}

/* Attachment indicators in message history */
.chat-msg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}

.chat-msg-attachment-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
}

.chat-input-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    color: var(--tv-text-muted);
}

.chat-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem 0.15rem;
    font-size: 0.65rem;
    color: #94a3b8;
    line-height: 1.35;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    margin-top: 0.15rem;
}

/* Chat responsive */
@media (max-width: 768px) {
    .chat-messages {
        padding: 1rem;
    }

    .chat-message {
        max-width: 95%;
    }

    .chat-input-area {
        padding: 0.5rem 1rem;
    }

    .chat-welcome-suggestions {
        flex-direction: column;
    }

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

    .hero-section {
        padding: 2rem 1rem 2.5rem;
    }
}
