/* ============================================================
   Gastrogenius Core - Custom Styles
   ============================================================ */

:root {
    --gg-primary: #1e3a5f;
    --gg-primary-light: #2a4f7f;
    --gg-primary-dark: #152a45;
    --gg-secondary: #f0f2f5;
    --gg-sidebar-width: 260px;
    --gg-topbar-height: 60px;
    --gg-border-color: #e5e7eb;
}

/* ============================================================
   Branding - Auth (Login/Register)
   ============================================================ */
.auth-brand {
    text-align: center;
    padding: 0;
    margin-bottom: 0.5rem;
}

.auth-brand .brand-gastro {
    display: block;
    font-size: 2.4rem;
    font-weight: 300;
    color: var(--gg-primary);
    letter-spacing: 0.15em;
    line-height: 1;
}

.auth-brand .brand-genius {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gg-primary);
    letter-spacing: 0.05em;
    line-height: 1;
    margin-top: 0.1rem;
}

/* ============================================================
   Branding - Sidebar (Backend)
   ============================================================ */
.sidebar-brand {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand a {
    display: flex;
    align-items: baseline;
    gap: 0;
}

.sidebar-brand .brand-gastro {
    font-size: 1.15rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.02em;
    line-height: 1;
}

.sidebar-brand .brand-genius {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
    line-height: 1;
}

/* ============================================================
   Auth Layout
   ============================================================ */
.auth-wrapper {
    background: linear-gradient(135deg, var(--gg-secondary) 0%, #dfe6ed 100%);
}

.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 0 1rem;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--gg-sidebar-width);
    height: 100vh;
    background: var(--gg-primary);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border-left-color: #fff;
}

.sidebar-link i {
    width: 24px;
    margin-right: 0.75rem;
    font-size: 1.1rem;
    text-align: center;
}

.sidebar-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0.5rem 0;
}

.sidebar-heading {
    padding: 0.75rem 1.25rem 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

/* Aufklappbarer Bereich */
.sidebar-collapse-toggle {
    cursor: pointer;
}

.sidebar-collapse-toggle .collapse-arrow {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
}

.sidebar-collapse-toggle:not(.collapsed) .collapse-arrow {
    transform: rotate(180deg);
}

.sidebar-sublink {
    padding-left: 2.75rem;
    font-size: 0.85rem;
}

/* ============================================================
   Main Content Area
   ============================================================ */
.main-wrapper {
    margin-left: var(--gg-sidebar-width);
    min-height: 100vh;
    background: var(--gg-secondary);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--gg-topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--gg-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.topbar-right {
    display: flex;
    align-items: center;
}

.user-menu-btn {
    color: #333;
    border: none;
    padding: 0.25rem 0.5rem;
}

.user-menu-btn:hover,
.user-menu-btn:focus {
    color: var(--gg-primary);
}

.main-content {
    padding: 1.5rem;
    max-width: 1200px;
}

/* ============================================================
   Backend Body
   ============================================================ */
.backend-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gg-secondary);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    border-radius: 0.75rem;
}

.card-header {
    border-bottom: none;
}

/* Progress */
.progress {
    border-radius: 1rem;
    background-color: #e9ecef;
}

.progress-bar.bg-primary {
    background-color: var(--gg-primary) !important;
    border-radius: 1rem;
    transition: width 0.6s ease;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

/* ============================================================
   Module Cards
   ============================================================ */
.module-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.08) !important;
}

.module-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 58, 95, 0.08);
    border-radius: 0.75rem;
    flex-shrink: 0;
}

/* ============================================================
   Opening Hours
   ============================================================ */
.oh-table td,
.oh-table th {
    vertical-align: middle;
    white-space: nowrap;
    padding: 0.6rem 0.75rem;
}

.oh-table .time-select {
    display: inline-block;
    width: 62px;
    padding: 0.2rem 0.3rem;
    font-size: 0.85rem;
}

.oh-table .slot-2-wrapper {
    display: inline;
}

.btn-copy-down {
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1;
}

/* ============================================================
   PLZ Autocomplete
   ============================================================ */
.plz-suggestions {
    position: absolute;
    z-index: 1050;
    background: #fff;
    border: 1px solid var(--gg-border-color);
    border-radius: 0.375rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    width: 300px;
}

.plz-suggestion-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid #f0f0f0;
}

.plz-suggestion-item:last-child {
    border-bottom: none;
}

.plz-suggestion-item:hover,
.plz-suggestion-item.active {
    background: var(--gg-secondary);
}

.plz-suggestion-item .plz-main {
    font-weight: 500;
}

.plz-suggestion-item .plz-detail {
    font-size: 0.75rem;
    color: #6c757d;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
    background-color: var(--gg-primary);
    border-color: var(--gg-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--gg-primary-light);
    border-color: var(--gg-primary-light);
}

.btn-outline-primary {
    color: var(--gg-primary);
    border-color: var(--gg-primary);
}

.btn-outline-primary:hover {
    background-color: var(--gg-primary);
    border-color: var(--gg-primary);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1035;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (min-width: 992px) {
    .sidebar-toggle {
        display: none !important;
    }
}

/* ============================================================
   Module Sub-Navigation
   ============================================================ */
.module-subnav {
    border-bottom: 1px solid var(--gg-border-color);
    padding-bottom: 0.75rem;
}

.module-subnav .btn {
    font-size: 0.85rem;
    font-weight: 500;
}

/* ============================================================
   Media Grid
   ============================================================ */
.media-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 0.5rem 0.5rem 0 0;
}
.media-zoom-btn { transition: opacity .2s; }
.media-zoom-btn:hover { opacity: 1 !important; }

/* ============================================================
   Utilities
   ============================================================ */
.user-avatar-sm {
    font-size: 1.25rem;
}

.form-check-input:checked {
    background-color: var(--gg-primary);
    border-color: var(--gg-primary);
}

a {
    color: var(--gg-primary);
}

a:hover {
    color: var(--gg-primary-light);
}

/* Fixierter Speicher-Footer */
.sticky-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: #fff;
    border-top: 1px solid #dee2e6;
    padding: 0.65rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}
@media (min-width: 768px) {
    .sticky-action-bar { left: 260px; }
}
.has-sticky-action-bar { height: 70px; }

/* Speisekartenmodul: Klappbox fuer Zusatzinformationen */
.fg-menu-collapse > summary {
    user-select: none;
}
.fg-menu-collapse > summary::-webkit-details-marker { display: none; }
.fg-menu-collapse > summary::marker { content: ''; }
.fg-menu-collapse .fg-menu-collapse-arrow {
    transition: transform 0.15s ease;
    display: inline-block;
}
.fg-menu-collapse[open] > summary .fg-menu-collapse-arrow {
    transform: rotate(180deg);
}
.fg-menu-tags .fw-semibold { color: #495057; font-size: 0.9rem; }

/* Speisekartenmodul: weicher KNR-Konflikt-Rahmen */
input.fg-knr-conflict {
    border-color: #ffc107 !important;
    background-color: #fffcee;
}
input.fg-knr-conflict:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
}

/* ============================================================
   Speisekartenmodul: Allergen-/Zusatzstoff-Vorschlags-Pills
   im Import-Review. Ziel: deutliche visuelle Unterscheidung
   "Aus Karte" (grün, vorausgewählt) vs. "Vorgeschlagen"
   (gelb/orange, manuelles Anhaken nötig). Vollständig sichtbare
   Labels, größerer Click-Bereich, mobile flex-wrap.
   ============================================================ */
.fg-sug-row {
    line-height: 1.4;
}
.fg-sug-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 0.25rem;
    white-space: nowrap;
}
.fg-sug-label-card     { color: #198754; }            /* Bootstrap success */
.fg-sug-label-matrix   { color: #b8860b; }            /* warm amber */
.fg-sug-label-features { color: #6f42c1; }            /* purple — Merkmale klar abgesetzt */

.fg-sug-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.85rem;
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.12s ease, border-color 0.12s ease;
    margin: 0;
    white-space: nowrap;             /* Label nie umbrechen */
}
.fg-sug-pill .fg-sug-input {
    margin: 0;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    cursor: pointer;
}
.fg-sug-pill .fg-sug-text {
    white-space: nowrap;
    overflow: visible;
}

/* Aus-Karte-Pill: grüner Tint, deutlich heller Rand. */
.fg-sug-pill-card {
    background-color: #d1e7dd;       /* success-subtle */
    border-color: #badbcc;
    color: #0a3622;
}
.fg-sug-pill-card:hover { background-color: #c0dfd1; }
.fg-sug-pill-card .fg-sug-input { accent-color: #198754; }

/* Vorgeschlagen-Pill: warmer Amber-Tint, klar als "manuell prüfen" lesbar. */
.fg-sug-pill-matrix {
    background-color: #fff3cd;       /* warning-subtle */
    border-color: #ffe69c;
    color: #664d03;
}
.fg-sug-pill-matrix:hover { background-color: #ffeeba; }
.fg-sug-pill-matrix .fg-sug-input { accent-color: #b8860b; }

/* Merkmale-Pill: heller Lila-Tint — eigene Farbfamilie damit Merkmale auf
   einen Blick von Allergenen/Zusatzstoffen unterschieden werden. */
.fg-sug-pill-features {
    background-color: #ede5fa;
    border-color: #d9c8f3;
    color: #4a2c91;
}
.fg-sug-pill-features:hover { background-color: #e2d4f7; }
.fg-sug-pill-features .fg-sug-input { accent-color: #6f42c1; }

/* Trigger-Wort-Zeile unter den Matrix-Pills. */
.fg-sug-triggers code {
    background-color: rgba(0,0,0,0.04);
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    color: #495057;
}

/* ============================================================
   Speisekartenmodul: Preisanzeige im Import-Review
   Verhindert, dass „14,90" und „€" auf zwei Zeilen brechen.
   Inhalt enthält bereits ein geschütztes Leerzeichen (NBSP);
   white-space:nowrap ist Defense-in-Depth gegen schmale Spalten.
   ============================================================ */
.fg-price-cell  { white-space: nowrap; }
.fg-price-value { white-space: nowrap; }

@media (max-width: 575.98px) {
    .fg-sug-pill {
        padding: 0.3rem 0.55rem;
        font-size: 0.82rem;
    }
}

/* ============================================================
   Speisekartenmodul: Beschreibungs-Anzeige im Import-Review
   ============================================================ */
.fg-item-desc { line-height: 1.4; }
.fg-item-desc-short {
    color: #495057;
    max-width: 100%;
}
.fg-item-desc-long > summary { list-style: none; }
.fg-item-desc-long > summary::-webkit-details-marker { display: none; }
.fg-item-desc-long > summary::before {
    content: '\F285'; /* bi-chevron-right via Bootstrap-Icons */
    font-family: 'bootstrap-icons';
    margin-right: 0.25rem;
    transition: transform 0.15s ease;
    display: inline-block;
}
.fg-item-desc-long[open] > summary::before { transform: rotate(90deg); }
.fg-item-desc-body {
    background: #f8f9fa;
    border-left: 3px solid #dee2e6;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
}

/* ============================================================
   Editor-Klappbox „Kennzeichnung bearbeiten"
   Listet alle übrigen Allergene/Zusatzstoffe (nicht aus Karte/Matrix)
   als Checkbox-Gitter, damit der Anwender direkt im Review ergänzen kann.
   ============================================================ */
.fg-sug-editor > summary {
    list-style: none;
    padding: 0.4rem 0.6rem;
    border-radius: 0.375rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    display: inline-block;
    user-select: none;
}
.fg-sug-editor > summary::-webkit-details-marker { display: none; }
.fg-sug-editor[open] > summary {
    background: #e9ecef;
}
.fg-sug-editor-body {
    background: #fafbfc;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 0.75rem;
}
.fg-sug-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.4rem 0.6rem;
}
.fg-sug-edit-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.4rem;
    border-radius: 0.25rem;
    cursor: pointer;
    line-height: 1.3;
    font-size: 0.875rem;
    color: #495057;
    transition: background-color 0.1s ease;
    margin: 0;
}
.fg-sug-edit-item:hover { background-color: rgba(13, 110, 253, 0.06); }
.fg-sug-edit-item input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #0d6efd;
}
.fg-sug-edit-item input[type="checkbox"]:checked + span {
    font-weight: 500;
    color: #0d6efd;
}
@media (max-width: 575.98px) {
    .fg-sug-edit-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .fg-sug-edit-item { font-size: 0.85rem; }
}
