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

:root {
    --bg:        #F5F4F0;
    --surface:   #FFFFFF;
    --border:    #E8E6E0;
    --text:      #1A1A18;
    --text-2:    #6B6960;
    --text-3:    #A5A39C;
    --coop:      #E2001A;
    --migros:    #F47920;
    --accent:    #2D6A4F;
    --radius:    12px;
    --shadow:    0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
    --font-head: 'Syne', sans-serif;
    --font-body: 'Inter', sans-serif;
}

html { font-size: 16px; color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Header ───────────────────────────────────────────────────────────── */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo { display: flex; align-items: center; gap: 0.5rem; }

.logo-icon { font-size: 1.4rem; }

.logo-text {
    font-family: var(--font-head);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.logo-sub {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-left: 0.25rem;
}

.header-meta { display: flex; align-items: center; gap: 0.75rem; }

.date-badge {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-2);
    padding: 0.3rem 0.75rem;
    background: var(--bg);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.refresh-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    color: var(--text-2);
    display: flex;
    align-items: center;
    transition: all 0.15s;
}
.refresh-btn:hover { background: var(--bg); color: var(--text); border-color: var(--text-3); }
.refresh-btn svg { width: 16px; height: 16px; }
.refresh-btn.spinning svg { animation: spin 0.8s linear infinite; }

/* ─── Main Layout ──────────────────────────────────────────────────────── */
main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ─── Status Bar ───────────────────────────────────────────────────────── */
.status-bar {
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.84rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.status-bar.info { background: #EBF4FF; color: #1A56DB; border: 1px solid #C3DDFD; }
.status-bar.success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.status-bar.error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.status-bar.warning { background: #FFFBEB; color: #92400E; border: 1px solid #FCD34D; }
.hidden { display: none !important; }

/* ─── Restaurants Grid ─────────────────────────────────────────────────── */
.restaurants-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

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

/* ─── Restaurant Card ──────────────────────────────────────────────────── */
.restaurant-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s;
}
.restaurant-card:hover { box-shadow: var(--shadow-lg); }

.card-header {
    padding: 1.1rem 1.35rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.card-header-left { display: flex; flex-direction: column; gap: 0.2rem; }

.restaurant-name {
    font-family: var(--font-head);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.restaurant-location {
    font-size: 0.78rem;
    color: var(--text-3);
    font-weight: 500;
    padding-left: 18px;
}

.card-link {
    font-size: 0.75rem;
    color: var(--text-3);
    text-decoration: none;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}
.card-link:hover { color: var(--text); border-color: var(--text-3); }

/* ─── Menu Items ───────────────────────────────────────────────────────── */
.menu-list { padding: 0.5rem 0; }

.menu-item {
    padding: 0.85rem 1.35rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    transition: background 0.12s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--bg); }

.menu-item-content { flex: 1; min-width: 0; }

.menu-item-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 0.2rem;
}

.menu-item-desc {
    font-size: 0.8rem;
    color: var(--text-2);
    line-height: 1.45;
}

.menu-item-price {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    padding: 0.15rem 0.5rem;
    background: var(--bg);
    border-radius: 6px;
    border: 1px solid var(--border);
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 1px;
}

/* ─── Error / fallback state in card ──────────────────────────────────── */
.card-error {
    padding: 1.5rem 1.35rem;
    text-align: center;
}
.card-error .error-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.card-error p { font-size: 0.84rem; color: var(--text-2); margin-bottom: 0.75rem; }
.card-error a {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: underline;
}

.card-raw {
    padding: 1rem 1.35rem;
    font-size: 0.8rem;
    color: var(--text-2);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
}

/* ─── Freshness tag ────────────────────────────────────────────────────── */
.freshness-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.18rem 0.55rem;
    border-radius: 20px;
}
.freshness-tag.fresh { background: #ECFDF5; color: #065F46; }
.freshness-tag.stale { background: #FFFBEB; color: #92400E; }

/* ─── Loading state ────────────────────────────────────────────────────── */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4rem 2rem;
    gap: 1rem;
    color: var(--text-2);
    font-size: 0.9rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ─── Empty state ──────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-2);
}
.empty-icon { font-size: 2.5rem; display: block; margin-bottom: 1rem; }
.empty-state p { font-size: 0.9rem; margin-bottom: 1rem; }
.empty-state button {
    padding: 0.5rem 1.25rem;
    background: var(--text);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 500;
}

/* ─── Footer ───────────────────────────────────────────────────────────── */
footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.74rem;
    color: var(--text-3);
    max-width: 100%;
}

/* ─── Animations ───────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

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

.restaurant-card { animation: fadeInUp 0.3s ease both; }
.restaurant-card:nth-child(2) { animation-delay: 0.08s; }
