/* ─── Reset & Grundlagen ─── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #0f0a0d;
    --bg-light: #1a1118;
    --bg-card: #2a1f28;
    --wine: #8B2252;
    --wine-light: #a83268;
    --gold: #C5A572;
    --gold-dim: rgba(197, 165, 114, 0.3);
    --text: #f5f0eb;
    --text-muted: #b0a8a0;
    --text-dim: #8a7f75;
    --green: #81c784;
    --red: #e57373;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Lato', -apple-system, sans-serif;
    overflow: hidden;
}


/* ─── App-Layout ─── */
.app {
    display: flex;
    flex-direction: column;
    height: 100dvh; /* dynamic viewport height (mobile-safe) */
    max-width: 500px;
    margin: 0 auto;
}


/* ─── Header ─── */
.header {
    padding: 16px 20px 12px;
    background: linear-gradient(180deg, #1a1118 0%, transparent 100%);
    flex-shrink: 0;
    z-index: 10;
}

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

.header-brand {
    flex: 1;
    text-align: center;
    padding-left: 36px; /* offset for reset button on right */
}

.header-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6em;
    color: var(--gold);
    letter-spacing: 1px;
}

.header-sub {
    font-size: 0.8em;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 2px;
}

.header-reset {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(197, 165, 114, 0.2);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s, color 0.2s;
}

.header-reset:active {
    border-color: var(--gold);
    color: var(--gold);
}


/* ─── Chat-Bereich ─── */
.chat {
    flex: 1;
    overflow-y: auto;
    padding: 10px 16px 20px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar */
.chat::-webkit-scrollbar {
    width: 4px;
}
.chat::-webkit-scrollbar-thumb {
    background: var(--gold-dim);
    border-radius: 2px;
}


/* ─── Nachrichten ─── */
.message {
    display: flex;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
    align-items: flex-start;
    gap: 12px;
}

.bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95em;
    line-height: 1.5;
    word-wrap: break-word;
}

.user-bubble {
    background: var(--wine);
    color: var(--text);
    border-bottom-right-radius: 4px;
}

.bot-bubble {
    background: linear-gradient(135deg, #2d2028 0%, #211822 50%, #1e1520 100%);
    color: var(--text);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(197, 165, 114, 0.18);
    box-shadow: 0 0 12px rgba(197, 165, 114, 0.06), 0 2px 8px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    position: relative;
    overflow: visible;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ─── Lade-Animation (3 Punkte) ─── */
.loading {
    display: flex;
    gap: 5px;
    padding: 14px 20px;
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--gold-dim);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(2) { animation-delay: 0.16s; }
.dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}


/* ─── Weinkarten (Empfehlung) ─── */
.empfehlung-header {
    font-size: 1em;
    margin-bottom: 10px;
    line-height: 1.4;
}

.vorlieben-hint {
    color: var(--text-dim);
    font-size: 0.8em;
}

/* ── Hero-Karte (#1) ───────────────────────── */
.wein-card {
    position: relative;
}

/* Weinglas-Icon als Flex-Sibling neben der Bubble */
.bot-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(197, 165, 114, 0.15);
    color: var(--gold);
    flex-shrink: 0;
}

.bot-icon svg {
    width: 16px;
    height: 16px;
}


.wein-hero-label {
    font-size: 0.68em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold);
    margin-bottom: 6px;
}

.wein-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.1em;
    color: var(--gold);
    margin-bottom: 2px;
}

.wein-meta {
    font-size: 0.78em;
    color: var(--text-muted);
    margin: 3px 0 8px;
}

.wein-preis {
    display: inline-block;
    background: rgba(197, 165, 114, 0.12);
    border: 1px solid rgba(197, 165, 114, 0.1);
    border-radius: 8px;
    padding: 5px 12px;
    color: var(--gold);
    font-weight: 700;
    font-size: 0.85em;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.wein-beschreibung {
    color: var(--text);
    font-size: 0.88em;
    line-height: 1.45;
    margin: 8px 0 4px;
}

/* ── Kompakte Alternativen (#2, #3) ────────── */
.wein-card-alt {
    background: none;
    border: none;
    border-top: 1px solid rgba(197, 165, 114, 0.1);
    border-radius: 0;
    padding: 10px 4px;
    margin: 0;
}

.wein-alt-top {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}


.wein-alt-name {
    font-family: 'Playfair Display', serif;
    font-size: 0.88em;
    color: var(--gold);
}

.wein-alt-preis {
    margin-left: auto;
    font-size: 0.75em;
    color: var(--text-muted);
}

.wein-alt-hint {
    font-size: 0.78em;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.3;
}

/* Warum-Details */
.wein-warum {
    margin-top: 6px;
    border-top: 1px solid rgba(197, 165, 114, 0.12);
    padding-top: 6px;
}

.wein-warum summary {
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.82em;
    list-style: none;
    user-select: none;
}

.wein-warum summary::before { content: "\25B8  "; }
.wein-warum[open] summary::before { content: "\25BE  "; }

.grund-text {
    color: var(--text-muted);
    font-size: 0.82em;
    line-height: 1.5;
    margin-top: 6px;
}


/* ─── Weinkarte-Uebersicht ─── */
.weinkarte-header {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    font-size: 1.05em;
    margin-bottom: 10px;
}

.weinkarte-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.weinkarte-hint {
    color: var(--text-dim);
    font-size: 0.78em;
    margin-bottom: 10px;
}

.wein-mini {
    background: linear-gradient(135deg, #2a1f28 0%, #1e1520 100%);
    border: 1px solid rgba(197, 165, 114, 0.15);
    border-radius: 10px;
    padding: 10px 14px;
}

.wein-clickable {
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s;
}

.wein-clickable:active {
    border-color: var(--gold);
    transform: scale(0.98);
}

.wein-mini-name {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    font-size: 0.9em;
}

.wein-mini-info {
    color: var(--text-muted);
    font-size: 0.75em;
    margin: 2px 0;
}

.wein-mini-desc {
    color: var(--text-dim);
    font-size: 0.75em;
    margin: 2px 0;
}

.wein-mini-preis {
    color: var(--gold);
    font-size: 0.8em;
    font-weight: 700;
    margin-top: 4px;
}


/* ─── Speisekarte ─── */
.speise-kategorie {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    font-size: 0.85em;
    margin: 12px 0 6px;
    letter-spacing: 0.5px;
}

.speise-kategorie:first-child {
    margin-top: 0;
}

.speise-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.speise-item {
    background: rgba(197, 165, 114, 0.08);
    border: 1px solid rgba(197, 165, 114, 0.15);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.82em;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.speise-item:active {
    border-color: var(--gold);
    background: rgba(197, 165, 114, 0.2);
}


/* ─── Eingabe-Leiste ─── */
.input-bar {
    flex-shrink: 0;
    padding: 10px 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: linear-gradient(0deg, var(--bg) 60%, transparent 100%);
}

.input-bar form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-bar input {
    flex: 1;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--gold-dim);
    border-radius: 24px;
    padding: 14px 20px;
    font-size: 16px; /* 16px verhindert iOS auto-zoom */
    font-family: 'Lato', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.input-bar input:focus {
    border-color: var(--gold);
}

.input-bar input::placeholder {
    color: var(--text-dim);
}

.input-bar button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--wine);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.input-bar button:active {
    background: var(--wine-light);
}


/* ─── Quick-Action Chips ─── */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 12px;
    animation: fadeIn 0.3s ease;
}

/* Chips nach Empfehlung bündig mit der Bubble */
.chips-empfehlung {
    margin-left: 44px;
}

.chip {
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold-dim);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.85em;
    font-family: 'Lato', sans-serif;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.chip:active {
    background: rgba(197, 165, 114, 0.15);
    border-color: var(--gold);
}

.chips-large {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.chip-large {
    flex: 1;
    padding: 14px 20px;
    font-size: 0.95em;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.5px;
}


/* ─── Input Loading-State ─── */
.input-bar input.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

.input-bar button:disabled {
    opacity: 0.4;
    pointer-events: none;
}


/* ─── Hilfsstile ─── */
strong { color: var(--gold); font-weight: 700; }
em { color: var(--text-muted); }
