/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #080808;
    --bg2:       #101010;
    --bg3:       #161616;
    --card:      #0f0f0f;
    --border:    rgba(255,255,255,0.06);
    --border2:   rgba(255,255,255,0.10);
    --accent:    #a78bfa;
    --accent-dim:#7c5cbf;
    --accent-bg: rgba(167,139,250,0.07);
    --accent-border: rgba(167,139,250,0.2);
    --muted:     #4a4a4a;
    --muted2:    #6a6a6a;
    --text:      #e8e8e8;
    --text2:     #999;
    --danger:    #c0616e;
    --success:   #5a9e6a;
    --radius:    14px;
    --radius-sm: 9px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
.section-title {
    font-family: 'Fraunces', serif;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: .25rem;
    letter-spacing: -.01em;
}
.section-sub {
    color: var(--muted2);
    font-size: .88rem;
    margin-bottom: 1.5rem;
}

/* ── LOGIN ─────────────────────────────────────────────────────────────────── */
.login-body {
    background: var(--bg);
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 340px;
}

.login-logo {
    font-family: 'Fraunces', serif;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: .2rem;
    letter-spacing: -.02em;
}

.login-sub {
    color: var(--muted2);
    font-size: .82rem;
    margin-bottom: 2rem;
}

/* ── FORM ELEMENTS ─────────────────────────────────────────────────────────── */
.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 1rem;
}

.field label,
.form-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--muted2);
    font-weight: 500;
}

.field input,
textarea {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .65rem .9rem;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: .92rem;
    outline: none;
    transition: border-color .2s;
    width: 100%;
}

.field input:focus,
textarea:focus { border-color: var(--accent-border); }

textarea {
    resize: vertical;
    min-height: 72px;
}

/* ── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn-primary {
    width: 100%;
    padding: .72rem;
    background: var(--accent);
    color: #0a0a0a;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: opacity .2s;
    letter-spacing: .01em;
}
.btn-primary:hover { opacity: .82; }

.btn-generate {
    display: block;
    width: 100%;
    padding: .82rem;
    background: var(--accent);
    color: #0a0a0a;
    border: none;
    border-radius: var(--radius);
    font-family: 'Fraunces', serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s;
    margin-bottom: 1.5rem;
    letter-spacing: .01em;
}
.btn-generate:hover { opacity: .82; }
.btn-generate:disabled { opacity: .3; cursor: not-allowed; }

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted2);
    border-radius: var(--radius-sm);
    padding: .32rem .75rem;
    font-size: .78rem;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s;
}
.btn-logout:hover { border-color: rgba(192,97,110,.4); color: var(--danger); }

/* Inspirier-mich Button */
.btn-inspire {
    display: block;
    width: 100%;
    padding: .82rem;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius);
    font-family: 'Fraunces', serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    margin-bottom: 1rem;
    letter-spacing: .01em;
}
.btn-inspire:hover { background: var(--accent-bg); border-color: rgba(167,139,250,.35); }
.btn-inspire:disabled { opacity: .3; cursor: not-allowed; }

/* ── ALERTS ────────────────────────────────────────────────────────────────── */
.alert {
    border-radius: var(--radius-sm);
    padding: .65rem .9rem;
    font-size: .83rem;
    margin-bottom: 1rem;
}
.alert-error { background: rgba(192,97,110,.08); color: var(--danger); border: 1px solid rgba(192,97,110,.2); }

/* ── HEADER ────────────────────────────────────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1.75rem;
    background: rgba(8,8,8,.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-logo {
    font-family: 'Fraunces', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    letter-spacing: -.01em;
}

/* ── TABS ──────────────────────────────────────────────────────────────────── */
.app-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg2);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid var(--border);
}

.tab {
    padding: .38rem .9rem;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--muted2);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: .85rem;
    transition: all .2s;
    white-space: nowrap;
}
.tab.active { background: var(--bg3); color: var(--text); }
.tab:hover:not(.active) { color: var(--text2); }

.sub-tab-bar {
    display: flex;
    gap: 2px;
    background: var(--bg2);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 1.5rem;
    width: fit-content;
    border: 1px solid var(--border);
}

.sub-tab {
    padding: .38rem .9rem;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--muted2);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: .83rem;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.sub-tab.active { background: var(--bg3); color: var(--text); }

/* ── MAIN ──────────────────────────────────────────────────────────────────── */
.app-main {
    max-width: 780px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    width: 100%;
}

.tab-content      { display: none; }
.tab-content.active { display: block; }
.sub-tab-content  { display: none; }
.sub-tab-content.active { display: block; }

/* ── DIVIDER ───────────────────────────────────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1rem 0;
    color: var(--muted);
    font-size: .75rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── FORM CARDS ────────────────────────────────────────────────────────────── */
.form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    margin-bottom: .8rem;
}
.form-card .form-label { display: block; margin-bottom: .55rem; }

/* ── PILLS ─────────────────────────────────────────────────────────────────── */
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }

.pill {
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted2);
    cursor: pointer;
    font-size: .83rem;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s;
}
.pill.active  { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-border); }
.pill:hover:not(.active) { border-color: var(--border2); color: var(--text2); }

/* ── MOOD GRID ─────────────────────────────────────────────────────────────── */
.mood-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
    margin-top: .4rem;
}

.mood-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .7rem .5rem;
    background: transparent;
    cursor: pointer;
    text-align: center;
    font-size: 1.3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: all .2s;
}
.mood-card span {
    font-size: .72rem;
    color: var(--muted2);
    font-family: 'DM Sans', sans-serif;
}
.mood-card.active { border-color: var(--accent-border); background: var(--accent-bg); }
.mood-card.active span { color: var(--accent); }
.mood-card:hover:not(.active) { border-color: var(--border2); }

/* ── LOADER ────────────────────────────────────────────────────────────────── */
.loader { text-align: center; padding: 2.5rem 1rem; color: var(--muted2); font-size: .88rem; }

.spinner {
    width: 28px; height: 28px;
    border: 1.5px solid var(--border2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto .9rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESULTS GRID ──────────────────────────────────────────────────────────── */
.results-grid { display: grid; gap: .9rem; }

/* ── DISH CARD ─────────────────────────────────────────────────────────────── */
.dish-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.3rem 1.4rem;
    transition: border-color .25s;
}
.dish-card:hover { border-color: var(--accent-border); }

.dish-name {
    font-family: 'Fraunces', serif;
    font-size: 1.15rem;
    margin-bottom: .35rem;
    letter-spacing: -.01em;
}

.dish-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: .85rem; }

.badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 500;
    letter-spacing: .02em;
}
.badge-time    { background: var(--accent-bg); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-diff    { background: rgba(255,255,255,.04); color: var(--muted2); border: 1px solid var(--border); }
.badge-inspire { background: var(--accent-bg); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-year    { background: rgba(255,255,255,.04); color: var(--muted2); border: 1px solid var(--border); }

.dish-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--muted);
    margin: .75rem 0 .3rem;
}
.dish-text { font-size: .88rem; color: var(--text2); line-height: 1.7; }

.missing-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: .35rem; }
.missing-item {
    background: rgba(192,97,110,.07);
    color: var(--danger);
    border: 1px solid rgba(192,97,110,.15);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: .78rem;
}

/* Einkaufsliste (abhakbar) */
.shopping-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: .4rem;
}

.shopping-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 10px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
    font-size: .86rem;
    color: var(--text2);
}
.shopping-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}
.shopping-item.checked { opacity: .4; text-decoration: line-through; }
.shopping-item span { flex: 1; }

.dish-actions { display: flex; gap: 7px; margin-top: 1rem; }

.btn-like, .btn-dislike {
    flex: 1;
    padding: .46rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: .82rem;
    transition: all .2s;
}
.btn-like    { border: 1px solid rgba(90,158,106,.3); background: rgba(90,158,106,.06); color: var(--success); }
.btn-like:hover { background: rgba(90,158,106,.13); }
.btn-dislike { border: 1px solid var(--border); background: transparent; color: var(--muted2); }
.btn-dislike:hover { border-color: rgba(192,97,110,.3); color: var(--danger); }

/* ── MOVIE CARD ────────────────────────────────────────────────────────────── */
.movie-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    overflow: hidden;
    transition: border-color .25s;
}
.movie-card:hover { border-color: var(--accent-border); }

.movie-poster {
    width: 82px;
    min-height: 124px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg2);
}
.movie-poster-placeholder {
    width: 82px;
    min-height: 124px;
    background: var(--bg2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    color: var(--muted);
}

.movie-info {
    padding: 1rem 1.1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.movie-title {
    font-family: 'Fraunces', serif;
    font-size: 1rem;
    margin-bottom: .3rem;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.movie-meta   { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: .5rem; }
.movie-overview {
    font-size: .82rem;
    color: var(--text2);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.movie-actions { display: flex; gap: 6px; margin-top: .75rem; flex-wrap: wrap; }

.btn-wl-add, .btn-wl-remove {
    padding: .38rem .8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: .78rem;
    transition: all .2s;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted2);
}
.btn-wl-add:hover    { border-color: var(--accent-border); color: var(--accent); }
.btn-wl-remove       { border-color: rgba(192,97,110,.25); color: var(--danger); }
.btn-wl-remove:hover { background: rgba(192,97,110,.07); }
.btn-wl-saved        { border-color: rgba(90,158,106,.35) !important; color: var(--success) !important; }

/* ── MISC ──────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.empty-msg { color: var(--muted2); text-align: center; padding: 3rem 1rem; font-size: .88rem; }

/* ── TOAST ─────────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 10px;
    padding: .7rem 1.1rem;
    font-size: .85rem;
    color: var(--text2);
    z-index: 200;
    animation: slideUp .2s ease;
    pointer-events: none;
}
@keyframes slideUp {
    from { transform: translateY(10px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── BADGE COUNTER ─────────────────────────────────────────────────────────── */
.badge-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-bg);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    border-radius: 20px;
    font-size: .68rem;
    font-weight: 600;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
}

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 500px) {
    .app-header { padding: .75rem 1rem; }
    .app-main   { padding: 1.25rem 1rem 3rem; }
    .header-logo { font-size: 1rem; }
    .tab  { padding: .35rem .65rem; font-size: .8rem; }
}