/* ============================================================
   EuroScout — Design System
   Dark-first | Orange #FF6B00 | Teal #0D9488 | Inter
   ============================================================ */

:root {
    --orange: #FF6B00;
    --orange-hover: #E55F00;
    --orange-soft: rgba(255, 107, 0, 0.12);
    --teal: #0D9488;
    --teal-dark: #0F766E;
    --teal-soft: rgba(13, 148, 136, 0.12);
    --grey-950: #0A0A0A;
    --grey-800: #1E1E1E;
    --grey-700: #2D2D2D;
    --grey-500: #6B6B6B;
    --grey-400: #A0A0A0;
    --grey-300: #D1D1D1;
    --grey-100: #F5F5F5;
    --white: #FFFFFF;
    --colour-success: #22C55E;
    --colour-warning: #EAB308;
    --colour-error: #EF4444;
    --radius-container: 8px;
    --radius-button: 6px;
    --radius-small: 4px;
    --radius-pill: 9999px;
    --shadow-subtle: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-elevated: 0 4px 16px rgba(0,0,0,0.3);
    --font-sans: Inter, 'SF Pro', system-ui, -apple-system, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--grey-950);
    color: var(--white);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────────── */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

main.container {
    flex: 1;
    padding-top: 48px;
    padding-bottom: 64px;
}

/* ── Header ─────────────────────────────────────────────────── */

.header {
    border-bottom: 1px solid var(--grey-700);
    padding: 20px 0;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 0;
}

.wordmark {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.wordmark-euro {
    color: var(--white);
}

.wordmark-scout {
    color: var(--orange);
}

.header-sub {
    font-size: 13px;
    color: var(--grey-400);
    margin-top: 4px;
}

/* ── Footer ─────────────────────────────────────────────────── */

.footer {
    text-align: center;
    padding: 20px 24px;
    font-size: 12px;
    color: var(--grey-500);
    border-top: 1px solid var(--grey-700);
}

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-button);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 120ms ease, opacity 120ms ease;
    min-height: 44px;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

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

.btn-primary:not(:disabled):hover {
    background: var(--orange-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--grey-300);
    border: 1px solid var(--grey-700);
}

.btn-ghost:not(:disabled):hover {
    background: var(--grey-700);
    color: var(--white);
}

/* ── Chat Section ────────────────────────────────────────────── */

.chat-section {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 180px;
    margin-bottom: 20px;
}

/* ── Message Bubbles ─────────────────────────────────────────── */

.message {
    display: flex;
    max-width: 85%;
}

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

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

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-container);
    font-size: 15px;
    line-height: 1.6;
    word-break: break-word;
}

.message.user .message-bubble {
    background: var(--orange);
    color: var(--white);
    border-bottom-right-radius: var(--radius-small);
}

.message.assistant .message-bubble {
    background: var(--grey-700);
    color: var(--white);
    border-bottom-left-radius: var(--radius-small);
}

/* ── Typing Indicator ────────────────────────────────────────── */

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 2px;
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--grey-400);
    animation: typing-pulse 1.3s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-pulse {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); }
    30% { opacity: 1; transform: scale(1); }
}

/* ── Chat Input ──────────────────────────────────────────────── */

.chat-input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: var(--grey-700);
    border: 1px solid var(--grey-500);
    border-radius: var(--radius-container);
    color: var(--white);
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: 15px;
    resize: none;
    min-height: 48px;
    max-height: 140px;
    transition: border-color 120ms ease;
    line-height: 1.5;
}

.chat-input::placeholder {
    color: var(--grey-500);
}

.chat-input:focus {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
    border-color: transparent;
}

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

/* ── Chat Error ──────────────────────────────────────────────── */

.chat-error {
    font-size: 13px;
    color: var(--colour-error);
    margin-top: 10px;
}

/* ── Loading Section ─────────────────────────────────────────── */

.loading-section {
    max-width: 720px;
    margin: 56px auto;
    text-align: center;
}

.loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--grey-700);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 15px;
    color: var(--grey-400);
}

/* ── Results Section ─────────────────────────────────────────── */

.results-section {
    margin-top: 56px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
}

.results-section.results-visible {
    opacity: 1;
    transform: translateY(0);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    gap: 16px;
}

.results-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.results-subtitle {
    font-size: 14px;
    color: var(--grey-400);
    margin-top: 6px;
    max-width: 60ch;
    line-height: 1.6;
}

/* ── City Grid ───────────────────────────────────────────────── */

.city-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

/* ── City Card ───────────────────────────────────────────────── */

.city-card {
    background: var(--grey-800);
    border-radius: var(--radius-container);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    border: 2px solid transparent;
    transition: box-shadow 150ms ease-out;
}

.city-card:hover {
    box-shadow: var(--shadow-elevated);
}

.city-card.top-pick {
    border-color: var(--orange);
}

/* ── Top Pick Badge ──────────────────────────────────────────── */

.top-pick-badge {
    position: absolute;
    top: -1px;
    right: 20px;
    background: var(--orange);
    color: var(--white);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: 0 0 var(--radius-pill) var(--radius-pill);
    display: flex;
    align-items: center;
    gap: 5px;
}

.top-pick-badge svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* ── Card Header ─────────────────────────────────────────────── */

.city-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-top: 8px; /* breathing room below badge on top-pick */
}

.city-name {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.city-country {
    font-size: 13px;
    color: var(--grey-400);
    margin-top: 3px;
}

.city-tagline {
    font-size: 13px;
    color: var(--grey-400);
    font-style: italic;
    margin-top: 6px;
    line-height: 1.5;
}

/* ── Overall Score Display ───────────────────────────────────── */

.overall-score-display {
    text-align: right;
    flex-shrink: 0;
}

.overall-score-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--orange);
    line-height: 1;
}

.overall-score-denom {
    display: block;
    font-size: 12px;
    color: var(--grey-400);
    margin-top: 2px;
}

/* ── Score Rows ──────────────────────────────────────────────── */

.city-scores {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.score-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.score-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.score-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--grey-300);
}

.score-label svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.score-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
}

.score-bar-container {
    background: rgba(255,255,255,0.07);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.score-bar {
    height: 100%;
    border-radius: 3px;
    width: 0;
    transition: width 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

.score-reason {
    font-size: 13px;
    color: var(--grey-400);
    line-height: 1.55;
}

/* ── City Summary ────────────────────────────────────────────── */

.city-summary {
    font-size: 14px;
    color: var(--grey-300);
    line-height: 1.65;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── Advisory Link ───────────────────────────────────────────── */

.advisory-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--teal);
    text-decoration: none;
    margin-top: auto;
    transition: color 120ms ease;
}

.advisory-link:hover {
    color: var(--teal-dark);
}

.advisory-link svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

/* ── Mobile ──────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }

    main.container {
        padding-top: 32px;
        padding-bottom: 48px;
    }

    .city-grid {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .chat-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }
}

/* ── Reduced Motion ──────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }

    .score-bar {
        width: calc(var(--score-pct, 0) * 1%) !important;
    }

    .results-section {
        opacity: 1 !important;
        transform: none !important;
    }
}
