/* ========================================
   MENU RENDERER - Styles
   Beautiful, professional restaurant menu
   ======================================== */

/* ---- CSS Variables (defaults, overridden by JS) ---- */
:root {
    --menu-bg: #0d0d0d;
    --menu-bg-secondary: #141414;
    --menu-text: #ffffff;
    --menu-text-muted: #999999;
    --menu-accent: #D4A853;
    --menu-divider: rgba(255, 255, 255, 0.08);
    --menu-card-bg: rgba(255, 255, 255, 0.03);

    --font-title: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-section: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-item-title: 'Inter', -apple-system, sans-serif;
    --font-item-desc: 'Inter', -apple-system, sans-serif;
    --font-item-price: 'Inter', -apple-system, sans-serif;

    --color-title: #ffffff;
    --color-section: #D4A853;
    --color-item-title: #ffffff;
    --color-item-desc: #bbbbbb;
    --color-item-price: #D4A853;
}

/* Light theme overrides */
body.theme-light {
    --menu-bg: #faf8f5;
    --menu-bg-secondary: #f0ece4;
    --menu-text: #1a1a1a;
    --menu-text-muted: #666666;
    --menu-divider: rgba(0, 0, 0, 0.08);
    --menu-card-bg: rgba(0, 0, 0, 0.02);
    --color-title: #1a1a1a;
    --color-item-title: #1a1a1a;
    --color-item-desc: #555555;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--menu-bg);
    color: var(--menu-text);
    font-family: var(--font-item-desc);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--menu-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========================================
   Section Navigation Sidebar
   ======================================== */
.menu-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    height: 100dvh;
    background: rgba(15, 15, 15, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--menu-divider);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 0;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

body.theme-light .menu-nav {
    background: rgba(250, 248, 245, 0.97);
}

.menu-nav.open {
    transform: translateX(0);
}

.menu-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--menu-divider);
    flex-shrink: 0;
}

.menu-nav-title {
    font-family: var(--font-section);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--menu-accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.menu-nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--menu-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.menu-nav-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--menu-text);
}

body.theme-light .menu-nav-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.menu-nav-list {
    list-style: none;
    margin: 0;
    padding: 12px 0;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.menu-nav-list::-webkit-scrollbar {
    width: 4px;
}

.menu-nav-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

.menu-nav-item {
    margin: 0;
}

.menu-nav-link {
    display: block;
    padding: 10px 20px;
    font-family: var(--font-item-title);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--menu-text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    line-height: 1.3;
}

.menu-nav-link:hover {
    color: var(--menu-text);
    background: rgba(255, 255, 255, 0.03);
    text-decoration: none;
}

body.theme-light .menu-nav-link:hover {
    background: rgba(0, 0, 0, 0.03);
}

.menu-nav-link.active {
    color: var(--menu-accent);
    border-left-color: var(--menu-accent);
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
}

body.theme-light .menu-nav-link.active {
    background: rgba(0, 0, 0, 0.03);
}

/* Nav Backdrop (mobile overlay) */
.menu-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.menu-nav-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Nav Toggle Button */
.menu-nav-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 90;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--menu-divider);
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--menu-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

body.theme-light .menu-nav-toggle {
    background: rgba(250, 248, 245, 0.85);
}

.menu-nav-toggle.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.menu-nav-toggle:hover {
    background: rgba(30, 30, 30, 0.95);
    border-color: var(--menu-accent);
}

body.theme-light .menu-nav-toggle:hover {
    background: rgba(240, 236, 228, 0.95);
}

/* Desktop: sidebar always visible */
@media (min-width: 900px) {
    .menu-nav {
        transform: translateX(0);
    }

    .menu-nav-close {
        display: none;
    }

    .menu-nav-backdrop {
        display: none;
    }

    .menu-nav-toggle {
        display: none;
    }

    /* Offset content for sidebar */
    .menu-cover {
        margin-left: 220px;
    }

    .menu-body {
        padding-left: calc(220px + 24px);
        max-width: calc(820px + 220px + 24px);
    }

    .menu-footer {
        padding-left: calc(220px + 24px);
    }
}

/* ========================================
   Cover Style Variants
   ======================================== */

/* Minimal: no ornaments, simple thin line, clean */
body.cover-minimal .cover-ornament {
    display: none;
}

body.cover-minimal .cover-divider-icon {
    display: none;
}

body.cover-minimal .cover-divider span {
    width: 40px;
    opacity: 0.3;
}

body.cover-minimal .cover-divider {
    gap: 0;
}

body.cover-minimal .section-header::after {
    width: 30px;
    opacity: 0.3;
}

/* Bold: no ornaments, no divider at all, just the title */
body.cover-bold .cover-ornament {
    display: none;
}

body.cover-bold .cover-divider {
    display: none;
}

body.cover-bold .cover-title {
    margin-bottom: 12px;
}

body.cover-bold .cover-subtitle {
    font-size: 0.9rem;
    letter-spacing: 0.25em;
    padding-left: 0.25em;
    opacity: 0.6;
}

body.cover-bold .section-header::after {
    width: 100%;
    max-width: 80px;
    height: 3px;
    opacity: 0.6;
}

/* ========================================
   Client Selector
   ======================================== */
.client-selector {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0d0d0d;
    padding: 20px;
}

.selector-card {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 40px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.selector-header svg {
    color: #D4A853;
    margin-bottom: 16px;
}

.selector-header h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 6px;
}

.selector-header p {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 28px;
}

.selector-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selector-btn {
    display: block;
    width: 100%;
    padding: 16px 20px;
    background: rgba(212, 168, 83, 0.08);
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    font-family: 'Inter', sans-serif;
}

.selector-btn:hover {
    background: rgba(212, 168, 83, 0.15);
    border-color: #D4A853;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(212, 168, 83, 0.15);
}

.selector-btn .btn-name {
    display: block;
    font-weight: 600;
}

.selector-footer {
    margin-top: 28px;
    font-size: 0.78rem;
    color: #555;
}

.selector-footer a {
    color: #888;
}

/* ========================================
   Loading & Error States
   ======================================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #0d0d0d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    color: #888;
}

.loading-spinner-menu {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(212, 168, 83, 0.15);
    border-top-color: #D4A853;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content p {
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.error-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #0d0d0d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-content {
    text-align: center;
    color: #888;
    max-width: 380px;
    padding: 20px;
}

.error-content svg {
    color: #666;
    margin-bottom: 16px;
}

.error-content h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 10px;
}

.error-content p {
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.retry-btn {
    display: inline-block;
    padding: 10px 28px;
    background: #D4A853;
    color: #0d0d0d;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s;
    font-family: 'Inter', sans-serif;
}

.retry-btn:hover {
    opacity: 0.85;
}

/* ========================================
   Cover Page
   ======================================== */
.menu-cover {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cover-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0.5s ease;
}

.cover-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.75) 100%);
}

.cover-bg.no-overlay::after {
    display: none;
}

.cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.1) 40%,
        rgba(0, 0, 0, 0.3) 100%
    );
}

body.theme-light .cover-bg::after {
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.55) 100%);
}

.cover-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px 24px;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cover-ornament {
    font-size: 1.5rem;
    color: var(--menu-accent);
    opacity: 0.6;
    letter-spacing: 16px;
    padding-left: 16px; /* compensate letter-spacing on last char */
    animation: coverFadeIn 0.8s ease 0.2s both;
}

.cover-ornament.bottom {
    animation-delay: 0.8s;
}

.cover-title {
    font-family: var(--font-title);
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 700;
    color: var(--color-title);
    line-height: 1.1;
    margin: 20px 0;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 40px rgba(0, 0, 0, 0.5);
    animation: coverFadeIn 0.8s ease 0.3s both;
}

.cover-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 16px 0;
    animation: coverFadeIn 0.8s ease 0.5s both;
}

.cover-divider span {
    display: block;
    width: 60px;
    height: 1px;
    background: var(--menu-accent);
    opacity: 0.5;
}

.cover-divider svg {
    color: var(--menu-accent);
    flex-shrink: 0;
}

.cover-subtitle {
    font-family: var(--font-item-desc);
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding-left: 0.15em; /* compensate letter-spacing */
    animation: coverFadeIn 0.8s ease 0.6s both;
}

body.theme-light .cover-subtitle {
    color: rgba(255, 255, 255, 0.8);
}

.cover-scroll-hint {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding-left: 0.1em; /* compensate letter-spacing */
    animation: scrollHintIn 0.8s ease 1s both;
    cursor: pointer;
}

.cover-scroll-hint.visible {
    animation: scrollHintIn 0.8s ease 1s both, scrollBounce 2s ease-in-out 2s infinite;
}

/* Cover elements fade in (no vertical movement, stays centered) */
@keyframes coverFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Scroll hint fades in at its centered position */
@keyframes scrollHintIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Bounce keeps translateX so it stays centered */
@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(8px); }
}

/* General fadeInUp for menu sections below */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Menu Body
   ======================================== */
.menu-body {
    max-width: 820px;
    margin: 0 auto;
    padding: 60px 24px 40px;
    position: relative;
}

/* Subtle background pattern */
.menu-body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--menu-bg);
}

/* ========================================
   Section Styles
   ======================================== */
.menu-section {
    margin-bottom: 56px;
    animation: fadeInSection 0.6s ease both;
}

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

.section-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    position: relative;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background: var(--menu-accent);
    opacity: 0.5;
    border-radius: 1px;
}

.section-title {
    font-family: var(--font-section);
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--color-section);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.2;
}

/* ========================================
   Menu Items
   ======================================== */
.menu-items {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.menu-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--menu-divider);
    transition: background 0.2s ease;
}

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

.menu-item:hover {
    background: var(--menu-card-bg);
    margin: 0 -12px;
    padding: 16px 12px;
    border-radius: 8px;
}

.menu-item-image {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.menu-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.menu-item-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.menu-item-name {
    font-family: var(--font-item-title);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-item-title);
    line-height: 1.3;
    flex: 1;
}

.menu-item-dots {
    flex: 1;
    min-width: 20px;
    border-bottom: 1px dotted var(--menu-divider);
    margin: 0 4px;
    position: relative;
    top: -4px;
}

.menu-item-price {
    font-family: var(--font-item-price);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-item-price);
    white-space: nowrap;
    flex-shrink: 0;
}

.menu-item-description {
    font-family: var(--font-item-desc);
    font-size: 0.85rem;
    color: var(--color-item-desc);
    line-height: 1.5;
    margin-top: 2px;
}

/* Tags (dietary, allergens) */
.menu-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.menu-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

.menu-tag.dietary {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.menu-tag.allergen {
    background: rgba(251, 146, 60, 0.1);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.15);
}

body.theme-light .menu-tag.dietary {
    background: rgba(34, 197, 94, 0.08);
    color: #16a34a;
    border-color: rgba(34, 197, 94, 0.15);
}

body.theme-light .menu-tag.allergen {
    background: rgba(251, 146, 60, 0.08);
    color: #ea580c;
    border-color: rgba(251, 146, 60, 0.12);
}

/* Sold Out */
.menu-item.sold-out {
    opacity: 0.45;
    pointer-events: none;
}

.menu-item.sold-out .menu-item-name::after {
    content: ' — Sold Out';
    font-size: 0.75rem;
    font-weight: 400;
    color: #ef4444;
    font-style: italic;
    font-family: var(--font-item-desc);
}

.menu-item.sold-out .menu-item-price {
    text-decoration: line-through;
    opacity: 0.6;
}

/* ========================================
   Footer
   ======================================== */
.menu-footer {
    border-top: 1px solid var(--menu-divider);
    padding: 32px 24px 40px;
    text-align: center;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-allergen-note {
    font-size: 0.8rem;
    color: var(--menu-text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
    font-style: italic;
}

.footer-brand {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.25);
}

body.theme-light .footer-brand {
    color: rgba(0, 0, 0, 0.25);
}

.footer-brand a {
    color: rgba(255, 255, 255, 0.35);
    text-decoration: none;
}

body.theme-light .footer-brand a {
    color: rgba(0, 0, 0, 0.35);
}

.footer-brand a:hover {
    color: var(--menu-accent);
}

/* ========================================
   Two-Column Layout for Desktop
   ======================================== */
@media (min-width: 700px) {
    .menu-items.two-col {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 32px;
    }

    .menu-items.two-col .menu-item {
        border-bottom: 1px solid var(--menu-divider);
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 600px) {
    .menu-body {
        padding: 40px 16px 24px;
    }

    .section-header {
        margin-bottom: 24px;
    }

    .menu-item {
        padding: 12px 0;
    }

    .menu-item-image {
        width: 56px;
        height: 56px;
    }

    .menu-item-header {
        flex-wrap: wrap;
    }

    .menu-item-dots {
        display: none;
    }

    .menu-item-price {
        margin-left: auto;
    }

    .cover-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .cover-content {
        padding: 30px 16px;
    }

    .menu-section {
        margin-bottom: 40px;
    }
}

@media (max-width: 380px) {
    .menu-body {
        padding: 32px 12px 20px;
    }

    .menu-item-name {
        font-size: 0.92rem;
    }

    .menu-item-price {
        font-size: 0.92rem;
    }

    .section-title {
        font-size: 1.2rem;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
    }

    .menu-nav,
    .menu-nav-toggle,
    .menu-nav-backdrop {
        display: none !important;
    }

    .menu-cover {
        min-height: auto;
        page-break-after: always;
        padding: 60px 20px;
        margin-left: 0 !important;
    }

    .cover-bg, .cover-overlay {
        display: none;
    }

    .cover-title {
        color: #000 !important;
        text-shadow: none;
    }

    .cover-scroll-hint {
        display: none;
    }

    .menu-section {
        page-break-inside: avoid;
    }

    .menu-item {
        page-break-inside: avoid;
    }

    .section-title {
        color: #000 !important;
    }

    .menu-item-name {
        color: #000 !important;
    }

    .menu-item-description {
        color: #333 !important;
    }

    .menu-item-price {
        color: #000 !important;
    }

    .menu-footer {
        page-break-before: always;
    }

    .footer-brand {
        display: none;
    }

    .menu-tag.dietary {
        background: #e8f5e9 !important;
        color: #2e7d32 !important;
    }

    .menu-tag.allergen {
        background: #fff3e0 !important;
        color: #e65100 !important;
    }
}

/* ========================================
   Scroll-triggered animations
   ======================================== */
.menu-section[data-visible="false"] {
    opacity: 0;
    transform: translateY(20px);
}

.menu-section[data-visible="true"] {
    animation: fadeInSection 0.5s ease forwards;
}
