/* ============================================================
   Kinder-Speisen-Bestellportal – Haupt-Stylesheet
   Öchsle – fränkisch genießen
   ============================================================ */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f6f2;
    min-height: 100vh;
}

a {
    color: #8B4513;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Header --- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 3px solid #8B4513;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: #8B4513;
}

.logo-img {
    height: 48px;
    width: auto;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-einrichtung {
    font-weight: bold;
    color: #555;
    margin-right: 0.5rem;
}

/* --- Main Content --- */
.content {
    flex: 1;
    padding-bottom: 2rem;
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid #ddd;
    padding: 1rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: #888;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #8B4513;
    color: #fff;
    border: 1px solid #8B4513;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s;
}

.btn:hover {
    background: #A0522D;
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: #8B4513;
}

.btn-outline:hover {
    background: #f0e6d8;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: #6B8E23;
    border-color: #6B8E23;
}

.btn-primary:hover {
    background: #7CA82A;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-active {
    background: #6B8E23;
    border-color: #6B8E23;
}

/* --- Formulare --- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: #8B4513;
    box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.2);
}

.form-hinweis {
    font-size: 0.85rem;
    color: #888;
    margin-top: 0.3rem;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.form-inline .form-control {
    width: auto;
}

.form-admin fieldset {
    border: 1px solid #ddd;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.form-admin legend {
    font-weight: bold;
    padding: 0 0.5rem;
    color: #8B4513;
}

/* --- Alerts --- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.input-error {
    border-color: #d9252e !important;
    box-shadow: 0 0 0 2px rgba(217,37,46,0.2);
}

.field-error {
    display: block;
    color: #d9252e;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* --- Login Box --- */
.login-box {
    max-width: 400px;
    margin: 3rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    color: #8B4513;
}

.login-hinweis {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #888;
}

/* --- KW Navigation --- */
.kw-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.kw-aktuell {
    font-size: 1.1rem;
    font-weight: bold;
    color: #8B4513;
}

/* --- Bestellfrist-Hinweis --- */
.bestellfrist-hinweis {
    text-align: center;
    padding: 0.5rem;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #856404;
}

/* --- Tabellen --- */
.data-table,
.speiseplan-tabelle,
.bestell-tabelle,
.speiseplan-admin-tabelle,
.produktion-tabelle,
.rezept-tabelle {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    margin-top: 1rem;
    overflow: visible;
}

.data-table th,
.data-table td,
.speiseplan-tabelle th,
.speiseplan-tabelle td,
.bestell-tabelle th,
.bestell-tabelle td,
.speiseplan-admin-tabelle th,
.speiseplan-admin-tabelle td,
.produktion-tabelle th,
.produktion-tabelle td,
.rezept-tabelle th,
.rezept-tabelle td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.data-table th,
.speiseplan-tabelle th,
.bestell-tabelle th,
.speiseplan-admin-tabelle th,
.produktion-tabelle th,
.rezept-tabelle th {
    background: #f0e6d8;
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.speiseplan-admin-tabelle {
    overflow: visible;
}

.rezept-tabelle {
    border-collapse: separate;
    border-spacing: 0;
}

.rezept-tabelle th,
.rezept-tabelle td {
    border-bottom: 1px solid #eee;
}

.rezept-tabelle tr:last-child th,
.rezept-tabelle tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: #faf5ef;
}

/* --- Speiseplan Tabelle --- */
.speiseplan-tabelle td {
    vertical-align: top;
    min-width: 120px;
}

.speiseplan-tabelle .typ-veg {
    font-weight: bold;
    background: #e8f5e9;
    width: 110px;
    padding: 0.8rem 0.5rem;
    text-align: center;
    vertical-align: middle;
}

.speiseplan-tabelle .typ-fleisch {
    font-weight: bold;
    background: #fbe9e7;
    width: 110px;
    padding: 0.8rem 0.5rem;
    text-align: center;
    vertical-align: middle;
}

/* --- Bestelltabelle --- */
.bestell-tabelle .td-tag {
    font-weight: 600;
    white-space: nowrap;
    min-width: 100px;
}

.bestell-tabelle .td-gericht {
    font-size: 0.9rem;
}

.bestell-tabelle .gericht-name {
    display: block;
    margin-bottom: 0.2rem;
}

.bestell-tabelle .td-menge {
    text-align: center;
}

.input-menge {
    width: 70px;
    padding: 0.4rem;
    text-align: center;
    border: 2px solid #6B8E23;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
}

.input-menge:disabled {
    background: #f5f5f5;
    border-color: #ccc;
    color: #999;
}

.col-veg {
    background: #e8f5e9;
}

.col-fleisch {
    background: #fbe9e7;
}

.row-ferien {
    background: #f5f5f5;
    color: #aaa;
}

.row-ferien .keine-eingabe {
    color: #ccc;
}

.row-gesperrt {
    background: #fff8e1;
}

.row-gesperrt .input-menge {
    border-color: #ff9800;
    background: #fff3e0;
}

.keine-eingabe {
    color: #ccc;
    font-size: 1.2rem;
}

/* --- Allergene --- */
.allergene-toggle {
    font-size: 0.75rem;
    color: #e67e22;
    cursor: pointer;
    margin-top: 0.2rem;
    position: relative;
}

.allergene-detail {
    display: none;
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    padding: 0.5rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 10;
    font-size: 0.8rem;
    min-width: 200px;
    color: #333;
    line-height: 1.4;
}

.allergene-toggle.open .allergene-detail {
    display: block;
}

/* --- Legende --- */
.legende {
    margin: 1rem 0;
    font-size: 0.85rem;
    color: #888;
}

.drucken {
    margin: 1rem 0;
    text-align: right;
}

/* --- Dashboard --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.dashboard-card {
    display: block;
    padding: 1.5rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: #333;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    text-decoration: none;
}

.dashboard-card h3 {
    color: #8B4513;
    margin-bottom: 0.5rem;
}

.dashboard-card p {
    font-size: 0.9rem;
    color: #888;
}

/* --- Produktion --- */
.produktion-tag {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.produktion-tag h2 {
    color: #8B4513;
    border-bottom: 2px solid #f0e6d8;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.produktion-gericht h3 {
    color: #555;
    margin-bottom: 0.75rem;
}

.produktion-tabelle .td-zahl,
.data-table .td-zahl {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.row-gesamt {
    background: #f0e6d8;
    font-weight: bold;
}

.keine-daten {
    color: #aaa;
    font-style: italic;
}

/* --- Bestätigung --- */
.bestaetigung {
    text-align: center;
    padding: 3rem 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.bestaetigung h1 {
    color: #6B8E23;
    margin-bottom: 1rem;
}

/* --- Portionsgrößen --- */
.portionsgroesse-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.portionsgroesse-row select,
.portionsgroesse-row input {
    width: auto;
}

.btn-remove {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
    padding: 0.2rem 0.5rem;
}

.btn-remove:hover {
    background: #c0392b;
}

/* --- Allergene Grid --- */
.allergene-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* --- Input klein für Rezept --- */
.input-menge-klein {
    width: 80px;
}

/* --- Rezept-Tabelle --- */
.rezept-tabelle th {
    font-size: 0.85rem;
}

.rezept-tabelle td {
    vertical-align: middle;
    overflow: visible;
}

/* --- Export Actions --- */
.export-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* --- Typ Filter --- */
.typ-filter {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

/* --- Speiseplan öffentlich --- */
.speiseplan-oeffentlich h1 {
    text-align: center;
    color: #8B4513;
    margin-bottom: 1rem;
}

/* --- Sonderkennung --- */
.sonderkennung {
    font-weight: bold;
    color: #e67e22;
}

/* --- Gerichte-Katalog: Hintergrundfarben nach Typ --- */
.data-table tr.typ-veg {
    background: #e8f5e9;
}
.data-table tr.typ-fleisch {
    background: #fbe9e7;
}
.data-table tr.typ-suess {
    background: #f3e5f5;
}
.data-table tr.typ-fisch {
    background: #e3f2fd;
}

/* Unsichtbarer Admin-Link im Copyright */
.admin-hidden-link {
    color: inherit !important;
    text-decoration: none !important;
}
.admin-hidden-link:hover {
    color: inherit !important;
    text-decoration: none !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .site-header {
        flex-direction: column;
        text-align: center;
    }

    .main-nav {
        justify-content: center;
    }

    .bestell-tabelle,
    .data-table {
        font-size: 0.85rem;
    }

    .input-menge {
        width: 55px;
    }

    .kw-navigation {
        flex-wrap: wrap;
    }

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

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline .form-control {
        width: 100%;
    }

    .allergene-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .bestell-tabelle {
        display: block;
        overflow-x: auto;
    }
}

/* --- Allergen-Chips (Toggle) --- */
.allergen-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.allergen-gruppe-titel {
    font-size: 0.95rem;
    margin: 1rem 0 0.5rem;
    font-weight: 600;
}

.allergen-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    border: 2px solid #d0d0d0;
    border-radius: 20px;
    padding: 0.3rem 0.7rem 0.3rem 0.3rem;
    background: #f5f5f5;
    transition: all 0.15s ease;
    user-select: none;
}

.allergen-btn:hover {
    background: #ececec;
    border-color: #bbb;
}

.allergen-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    background: var(--ac, #999);
    transition: all 0.15s ease;
}

.allergen-label {
    font-size: 0.78rem;
    color: #555;
    white-space: nowrap;
}

/* --- Aktiver Zustand: ganzer Chip in --ac, Text in --act --- */
.allergen-btn.active {
    background: var(--ac, #666);
    border-color: var(--ac, #666);
    color: var(--act, #fff);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.allergen-btn.active .allergen-icon {
    background: rgba(255,255,255,0.95);
    color: var(--ac, #666);
    text-shadow: none;
    transform: scale(1.15);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

.allergen-btn.active .allergen-label {
    color: var(--act, #fff);
}

/* --- Schwein-Chip --- */
.schwein-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    border: 1.5px solid #ccc;
    border-radius: 6px;
    padding: 0.1rem 0.4rem 0.1rem 0.1rem;
    background: #f5f5f5;
    transition: all 0.12s ease;
    user-select: none;
    font-size: 0.72rem;
    color: #999;
}

.schwein-btn:hover {
    background: #eee;
    border-color: #bbb;
}

.schwein-btn.active {
    background: #fce4e4;
    border-color: #d46a6a;
    color: #a04040;
    box-shadow: 0 1px 3px rgba(200,80,80,0.15);
}

.schwein-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1.5px solid #bbb;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 700;
    color: transparent;
    transition: all 0.12s ease;
    background: #fff;
}

.schwein-btn.active .schwein-check {
    background: #d46a6a;
    border-color: #d46a6a;
    color: #fff;
}

.schwein-icon {
    font-size: 0.85rem;
    line-height: 1;
}
