/* book.css - Das Herzstück für den Wow-Effekt
    Stabile 3D-Engine für die Speisekarte
*/

:root {
    --gold: #D4A373;
    --gold-glow: rgba(212, 163, 115, 0.4);
    --paper-white: #FDFBF0;
    --leather-brown: #2B2118;
    --shadow-deep: rgba(0, 0, 0, 0.6);
}

/* 1. Bühne und Hintergrund */
.menu-body {
    background: radial-gradient(circle at center, #3d2b1f 0%, #0a0a0a 100%);
    margin: 0;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    font-family: 'Montserrat', sans-serif;
}

/* Zurück-Button mit Glassmorphism-Effekt */
.back-to-home {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 1000;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid var(--gold);
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    transition: all 0.4s ease;
}

.back-to-home:hover {
    background: var(--gold);
    color: #1a1a1b;
    box-shadow: 0 0 20px var(--gold-glow);
}

/* 2. Buch-Architektur */
.book-container {
    position: relative;
    width: 450px;
    height: 600px;
    perspective: 2500px; /* Erhöhte Perspektive für dramatischere Blätter-Effekte */
}

.book {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.15, 0, 0.15, 1);
}

/* 3. Seiten-Logik */
.page {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: var(--paper-white);
    transform-origin: left;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
    cursor: pointer;
    user-select: none;
    /* Verhindert das "Zittern" der Hardware-Beschleunigung */
    backface-visibility: hidden;
}

/* Der Schatten-Effekt am Falz */
.page::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 30px; height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.1) 0%, transparent 100%);
    pointer-events: none;
}

/* Der Umblätter-Zustand */
.page.flipped {
    transform: rotateY(-180deg);
}

.page-content {
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 50px 40px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    backface-visibility: hidden;
    overflow-y: auto;
    /* Dünne Scrollleiste in Goldton */
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 163, 115, 0.45) transparent;
}

.page-content::-webkit-scrollbar {
    width: 4px;
}
.page-content::-webkit-scrollbar-track {
    background: transparent;
}
.page-content::-webkit-scrollbar-thumb {
    background: rgba(212, 163, 115, 0.45);
    border-radius: 2px;
}

/* 4. Spezielle Seiten-Designs */

/* Cover */
.page.cover {
    background: linear-gradient(135deg, #3d2b1f 0%, #1a130e 100%);
    border: 3px solid var(--gold);
    color: var(--gold);
    box-shadow: 10px 10px 30px rgba(0,0,0,0.5);
}

.cover-design {
    height: 100%;
    border: 1px solid var(--gold);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.glow-text {
    text-shadow: 0 0 15px var(--gold-glow);
    font-size: 2.5rem;
    margin: 20px 0;
}

/* Back-Cover */
.page.back-cover {
    background: var(--leather-brown);
    color: var(--gold);
    transform: rotateY(0deg); /* Basisposition */
}

/* 5. Typografie und Inhalte */
.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: #2B2118;
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 10px;
}

.menu-item {
    margin-bottom: 20px;
    border-bottom: 1px dotted rgba(212, 163, 115, 0.4);
    padding-bottom: 8px;
    transition: all 0.3s ease;
}

.menu-item:hover {
    transform: translateX(5px);
}

.item-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 1.05rem;
}

.item-desc {
    font-size: 0.85rem;
    font-style: italic;
    color: #666;
    margin-top: 4px;
}

.item-price {
    color: #8b5e34;
}

/* Highlight-Item wie das Schlesische Himmelreich */
.highlight-item.gold-border {
    border: 2px solid var(--gold);
    background: rgba(212, 163, 115, 0.05);
    padding: 15px;
    margin: 10px -5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

/* Interaktive Hinweise */
.tap-hint {
    margin-top: 30px;
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; text-shadow: 0 0 10px var(--gold); }
}

/* 6. Z-Index Stapelung (WICHTIG für fehlerfreies Blättern) */
/* JS setzt diese dynamisch – CSS-Fallback für alle bis zu 12 Seiten */
.page:nth-child(1)  { z-index: 12; }
.page:nth-child(2)  { z-index: 11; }
.page:nth-child(3)  { z-index: 10; }
.page:nth-child(4)  { z-index: 9; }
.page:nth-child(5)  { z-index: 8; }
.page:nth-child(6)  { z-index: 7; }
.page:nth-child(7)  { z-index: 6; }
.page:nth-child(8)  { z-index: 5; }
.page:nth-child(9)  { z-index: 4; }
.page:nth-child(10) { z-index: 3; }
.page:nth-child(11) { z-index: 2; }
.page:nth-child(12) { z-index: 1; }

/* 7. Hover-Animation für ungeblätterte Seiten */
.page:not(.flipped):hover {
    transform: rotateY(-10deg);
}

/* 8. Kompakte Seiten für dichte Menü-Abschnitte */
.compact-page {
    padding: 30px 28px;
}
.compact-page .section-title {
    font-size: 1.4rem;
    margin-bottom: 14px;
    padding-bottom: 8px;
}
.compact-page .menu-item {
    margin-bottom: 10px;
    padding-bottom: 6px;
}
.compact-page .item-header {
    font-size: 0.88rem;
}
.compact-page .item-desc {
    font-size: 0.75rem;
    margin-top: 2px;
}
.compact-page .sub-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: #2B2118;
    border-bottom: 1px solid var(--gold);
    padding-bottom: 6px;
    margin: 14px 0 10px;
}

/* Preistabelle (für Schnitzel-Varianten, Beilagen etc.) */
.price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.price-table tr {
    border-bottom: 1px dotted rgba(212,163,115,0.35);
}
.price-table td {
    padding: 5px 4px;
    vertical-align: middle;
}
.price-table td:last-child {
    text-align: right;
    color: #8b5e34;
    font-weight: 600;
    white-space: nowrap;
}
.price-table .note {
    font-size: 0.72rem;
    font-style: italic;
    color: #999;
}

/* Preis-Spalten für Suppen (Klein / Groß) */
.two-prices {
    font-size: 0.78rem;
    color: #8b5e34;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

/* 9. Navigations-Buttons */
.book-nav {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 500;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(212,163,115,0.35);
    border-radius: 50px;
    padding: 10px 22px;
}
.book-btn {
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    font-family: inherit;
}
.book-btn:hover:not(:disabled) {
    background: var(--gold);
    color: #1a1a1b;
}
.book-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}
.book-page-counter {
    color: var(--gold);
    font-size: 0.72rem;
    letter-spacing: 2px;
    font-family: 'Montserrat', sans-serif;
    min-width: 52px;
    text-align: center;
}

/* ── 10. Karten-Auswahl Tabs ─────────────────────────────────── */
.menu-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(212,163,115,0.3);
    border-radius: 50px;
    padding: 5px;
    z-index: 10;
}

.menu-tab {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    background: transparent;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.menu-tab svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.menu-tab:hover { color: rgba(255,255,255,0.85); }

.menu-tab.active {
    background: var(--gold);
    color: #1a1209;
}

/* ── 11. Statische Karten-Panels (Kinder / Getränke) ─────────── */
.static-menu-card {
    width: 450px;
    height: 600px;
    background: var(--paper-white);
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 10px 10px 30px rgba(0,0,0,0.4);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(212,163,115,0.45) transparent;
    box-sizing: border-box;
}

.static-menu-card::-webkit-scrollbar { width: 4px; }
.static-menu-card::-webkit-scrollbar-track { background: transparent; }
.static-menu-card::-webkit-scrollbar-thumb { background: rgba(212,163,115,0.45); border-radius: 2px; }

.static-card-inner {
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    box-sizing: border-box;
}

.static-card-inner .section-title { color: #2B2118; }

.static-card-inner .sub-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: #2B2118;
    border-bottom: 1px solid var(--gold);
    padding-bottom: 6px;
    margin: 14px 0 10px;
}

.static-card-parents {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(212,163,115,0.35);
    font-size: 0.72rem;
    color: #777;
    line-height: 1.6;
}

.static-card-parents strong {
    display: block;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 0.82rem;
    color: #8b5e34;
    margin-bottom: 3px;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE – Scrollbares Menü statt 3D-Flip-Book
   (max-width: 640px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

    /* ── Seite: Scrollbarer Viewport ── */
    .menu-body {
        height: auto;
        min-height: 100dvh;
        overflow-y: auto;
        overflow-x: hidden;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 72px 12px 80px;
        gap: 12px;
        box-sizing: border-box;
    }

    /* ── Zurück-Button ── */
    .back-to-home {
        top: 12px;
        left: 12px;
        padding: 8px 14px;
        font-size: 0.68rem;
        letter-spacing: 0.08em;
    }

    /* ── Mini-Nav oben rechts ── */
    .menu-mini-nav {
        padding: 12px 12px !important;
        gap: 8px !important;
        top: 0 !important;
    }

    .menu-mini-nav a:first-child {
        display: none; /* Kartoffelvielfalt-Link auf kleinen Screens weglassen */
    }

    /* ── Tabs ── */
    .menu-tabs {
        width: 100%;
        max-width: 100%;
        border-radius: 12px;
        justify-content: stretch;
        box-sizing: border-box;
        padding: 4px;
        gap: 3px;
    }

    .menu-tab {
        flex: 1;
        justify-content: center;
        padding: 8px 6px;
        font-size: 0.6rem;
        letter-spacing: 0.04em;
        gap: 4px;
        white-space: normal;
        text-align: center;
    }

    .menu-tab svg {
        width: 12px;
        height: 12px;
        flex-shrink: 0;
    }

    /* ── Menu-Wrapper ── */
    .menu-wrapper {
        width: 100% !important;
        height: auto !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    /* ── Panels volle Breite ── */
    .menu-panel {
        width: 100%;
        box-sizing: border-box;
    }

    /* ── Book-Container: kein 3D mehr ── */
    .book-container {
        width: 100%;
        max-width: 100%;
        height: auto;
        perspective: none;
        box-sizing: border-box;
    }

    .book {
        transform: none !important;
        transform-style: flat;
        height: auto;
    }

    /* ── Seiten: vertikal gestapelt, alle sichtbar ── */
    .page {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        transform: none !important;
        transition: none !important;
        cursor: default;
        margin-bottom: 10px;
        border-radius: 4px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.45);
        display: block;
        backface-visibility: visible;
    }

    /* Geblätterte Seiten ebenfalls sichtbar (kein rotateY) */
    .page.flipped {
        transform: none !important;
    }

    /* Hover-Animation deaktivieren */
    .page:not(.flipped):hover {
        transform: none !important;
    }

    /* Falz-Schatten entfernen */
    .page::after {
        display: none;
    }

    /* ── Page-Content: normale Höhe ── */
    .page-content {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        overflow-y: visible !important;
        padding: 28px 18px;
        box-sizing: border-box;
    }

    .compact-page {
        padding: 22px 16px;
    }

    /* ── Cover ── */
    .cover-design {
        padding: 36px 20px;
    }

    .glow-text {
        font-size: 1.7rem;
        margin: 12px 0;
    }

    .tap-hint {
        display: none;
    }

    /* ── Typografie ── */
    .section-title {
        font-size: 1.3rem;
        margin-bottom: 14px;
    }

    .compact-page .section-title {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    .item-header {
        font-size: 0.85rem;
        flex-wrap: wrap;
        gap: 2px;
    }

    .compact-page .item-header {
        font-size: 0.82rem;
    }

    .item-name {
        flex: 1 1 auto;
        min-width: 0;
        padding-right: 8px;
    }

    .item-price {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .item-desc {
        font-size: 0.75rem;
    }

    .compact-page .item-desc {
        font-size: 0.7rem;
    }

    .price-table {
        font-size: 0.78rem;
    }

    .price-table td {
        padding: 5px 2px;
    }

    /* ── Statische Karten (Kinder / Getränke) ── */
    .static-menu-card {
        width: 100%;
        max-width: 100%;
        height: auto;
        box-sizing: border-box;
    }

    .static-card-inner {
        padding: 22px 16px;
    }

    /* ── Blätter-Navigation ausblenden (scroll ersetzt es) ── */
    .book-nav {
        display: none !important;
    }

    /* ── Z-Indizes zurücksetzen ── */
    .page:nth-child(n) {
        z-index: auto;
    }
}

/* Sehr kleine Screens (unter 360px) */
@media (max-width: 360px) {
    .menu-tab {
        font-size: 0.55rem;
        padding: 7px 4px;
    }

    .menu-tab svg {
        display: none;
    }

    .page-content {
        padding: 22px 14px;
    }

    .compact-page {
        padding: 18px 12px;
    }
}