/* ==========================================================================
   Restaurante Suki — Menu styles
   Estrutura: 1) Variáveis base + 3 temas  2) Layout base (mobile-first)
   Temas: A = japan (simples japonês) · B = dark (moderno) · C = bright (alegre)
   ========================================================================== */

/* ---------- 1. Variáveis de tema -------------------------------------- */
:root {
    --font-head: "Hiragino Mincho ProN", "Songti SC", Georgia, "Times New Roman", serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Helvetica Neue", Arial, sans-serif;

    /* Tema A — Japonês simples (padrão) */
    --bg-page: #f4efe4;
    --bg-section: #faf6ec;
    --bg-card: #ffffff;
    --card-border: #e7ddc9;
    --card-radius: 10px;
    --card-shadow: 0 1px 3px rgba(60, 45, 20, 0.08);
    --card-shadow-hover: 0 8px 20px rgba(60, 45, 20, 0.16);

    --text-main: #2b2622;
    --text-muted: #6f675c;
    --title-color: #b8473f;

    --accent: #b8473f;
    --accent-soft: #f6e7e3;
    --on-accent: #ffffff;
    --price-color: #2e7d5b;

    --header-bg: #2b2622;
    --header-text: #f4efe4;
    --header-accent: #b8473f;

    --nav-bg: rgba(244, 239, 228, 0.95);
    --nav-border: #e2d8c4;
    --chip-bg: #ffffff;
    --chip-text: #4a433b;
    --chip-border: #e2d8c4;
    --chip-active-bg: #b8473f;
    --chip-active-text: #ffffff;

    --divider: #e7ddc9;
}

[data-theme="dark"] {
    --font-head: "Hiragino Mincho ProN", Georgia, "Times New Roman", serif;
    --bg-page: #14151a;
    --bg-section: #181a20;
    --bg-card: #20232c;
    --card-border: #2e323d;
    --card-radius: 14px;
    --card-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    --card-shadow-hover: 0 10px 26px rgba(0, 0, 0, 0.55);

    --text-main: #f1efe9;
    --text-muted: #a7a99f;
    --title-color: #d8b673;

    --accent: #d8b673;
    --accent-soft: rgba(216, 182, 115, 0.14);
    --on-accent: #14151a;
    --price-color: #d8b673;

    --header-bg: #0e0f13;
    --header-text: #f1efe9;
    --header-accent: #d8b673;

    --nav-bg: rgba(14, 15, 19, 0.92);
    --nav-border: #2e323d;
    --chip-bg: #20232c;
    --chip-text: #e3e1d9;
    --chip-border: #343845;
    --chip-active-bg: #d8b673;
    --chip-active-text: #14151a;

    --divider: #2a2e38;
}

/* ---------- 2. Base --------------------------------------------------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ---------- Modal ----------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(43, 38, 34, 0.82);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    background-color: var(--bg-card);
    color: var(--text-main);
    padding: 0;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 640px;
    max-height: 92vh;
    text-align: left;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 22px 24px;
    text-align: center;
    border-bottom: 4px solid var(--header-accent);
}

.modal-header h1 {
    margin: 0 0 14px 0;
    font-family: var(--font-head);
    font-size: 1.9em;
    font-weight: 700;
    color: var(--header-text);
}

.modal-language-selector-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Language selects (modal + nav share the look) */
#modal-language-select,
#language-select {
    background-color: #ffffff;
    color: #2b2622;
    border: 1px solid var(--chip-border);
    padding: 8px 32px 8px 12px;
    border-radius: 8px;
    font-size: 0.95em;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23333'%3e%3cpath d='M7 10l5 5 5-5H7z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1em;
}

#modal-language-select:focus,
#language-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.modal-body {
    overflow-y: auto;
    flex-grow: 1;
    min-height: 0;
    padding: 24px;
    -webkit-overflow-scrolling: touch;
}

.modal-body .modal-intro-text {
    font-size: 1.05em;
    margin: 0 0 22px;
    text-align: center;
    color: var(--text-muted);
}

.modal-pricing-info {
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--divider);
}
.modal-pricing-info:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.modal-pricing-info h4,
.modal-conditions h4 {
    font-family: var(--font-head);
    font-size: 1.2em;
    color: var(--text-main);
    margin: 0 0 10px;
}

.modal-pricing-info p {
    font-size: 1em;
    color: var(--text-muted);
    margin: 6px 0;
}

.modal-pricing-info .price,
.modal-pricing-info .price-small {
    font-weight: 700;
    color: var(--accent);
}
.modal-pricing-info .price { font-size: 1.4em; }
.modal-pricing-info .price-small { font-size: 1.15em; }

.modal-pricing-info .note {
    font-size: 0.88em;
    color: var(--text-muted);
    margin-top: 10px;
}

.modal-conditions { margin-top: 18px; }

.modal-conditions ul {
    list-style: disc;
    padding-left: 22px;
    margin: 0;
}

.modal-conditions li {
    font-size: 0.98em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.modal-conditions li.highlight-condition {
    font-weight: 700;
    color: #c0392b;
    background-color: #f9eaea;
    padding: 6px 10px;
    border-radius: 6px;
    border-left: 3px solid #c0392b;
    list-style: none;
    margin-left: -22px;
}

.modal-footer {
    text-align: center;
    padding: 18px 24px 24px;
    border-top: 1px solid var(--divider);
}

.modal-footer .waste-warning {
    font-size: 1em;
    color: #d9534f;
    margin: 0 0 16px;
    font-weight: 700;
}

#agree-button {
    background-color: var(--accent);
    color: var(--on-accent);
    border: none;
    padding: 14px 36px;
    display: inline-block;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.2s ease;
}
#agree-button:hover { filter: brightness(0.95); }
#agree-button:active { transform: scale(0.97); }

/* ---------- Header ---------------------------------------------------- */
header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 26px 16px;
    text-align: center;
    border-bottom: 4px solid var(--header-accent);
}

header h1 {
    margin: 0;
    font-family: var(--font-head);
    font-size: 2em;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-tagline {
    margin: 6px 0 0;
    font-size: 0.95em;
    color: var(--header-text);
    opacity: 0.8;
    letter-spacing: 1px;
}

/* ---------- Sticky category nav -------------------------------------- */
.category-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--nav-border);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
}

.nav-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Toggle Dia / Noite */
.mode-toggle {
    display: inline-flex;
    background-color: var(--chip-bg);
    border: 1px solid var(--chip-border);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}
.mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 32px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.mode-btn.active {
    background-color: var(--accent);
    color: var(--on-accent);
}

/* ---------- Dropdown de categorias ----------------------------------- */
.cat-menu {
    position: relative;
    display: flex;
    justify-content: center;
}

.cat-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--chip-border);
    background-color: var(--chip-bg);
    color: var(--chip-text);
    font-family: var(--font-body);
    font-size: 0.92em;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.cat-toggle:hover { border-color: var(--accent); }
.cat-menu.open .cat-toggle {
    border-color: var(--accent);
    background-color: var(--accent-soft);
}
.cat-toggle-icon,
.cat-toggle-caret { display: inline-flex; align-items: center; }
.cat-toggle-caret { transition: transform 0.2s ease; }
.cat-menu.open .cat-toggle-caret { transform: rotate(180deg); }

.cat-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    width: min(300px, 92vw);
    max-height: min(64vh, 460px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: var(--card-shadow-hover);
    padding: 8px;
    z-index: 120;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.cat-menu.open .cat-panel {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.cat-group + .cat-group {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--divider);
}

.cat-item {
    display: block;
    padding: 10px 14px;
    border-radius: 9px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.95em;
    line-height: 1.25;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.cat-item:hover { background-color: var(--accent-soft); }
.cat-item.active { color: var(--accent); font-weight: 700; }

.cat-item-main { font-weight: 700; }

.cat-item-sub {
    position: relative;
    padding-left: 30px;
    font-size: 0.9em;
    color: var(--text-muted);
}
.cat-item-sub::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: var(--chip-border);
    transform: translateY(-50%);
    transition: background-color 0.15s ease;
}
.cat-item-sub:hover::before,
.cat-item-sub.active::before { background-color: var(--accent); }

/* ---------- Main / categories ---------------------------------------- */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0;
}

.menu-legend {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9em;
    margin: 14px 12px 0;
}

.menu-category {
    background-color: var(--bg-section);
    padding: 22px 12px 28px;
    scroll-margin-top: 104px;
}
.menu-category:nth-child(even) { background-color: var(--bg-page); }

.menu-category h2 {
    font-family: var(--font-head);
    font-size: 1.7em;
    color: var(--text-main);
    margin: 6px 0 24px;
    text-align: center;
    position: relative;
    padding-bottom: 12px;
}
.menu-category h2::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 64px;
    height: 3px;
    border-radius: 3px;
    background-color: var(--accent);
}

/* Sushi / drink subcategories */
.sushi-subcategory { margin: 28px 0; }
.sushi-subcategory:first-child { margin-top: 0; }

.subcategory-title {
    font-family: var(--font-head);
    font-size: 1.25em;
    color: var(--title-color);
    text-align: left;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--divider);
    scroll-margin-top: 104px;
}

/* ---------- Item grid + cards ---------------------------------------- */
.menu-items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.menu-item {
    background-color: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Só renderiza/descodifica os cartões visíveis -> rolagem fluida com muitas imagens */
    content-visibility: auto;
    contain-intrinsic-size: auto 210px;
}
@media (hover: hover) {
    .menu-item:hover {
        transform: translateY(-4px);
        box-shadow: var(--card-shadow-hover);
    }
}

.item-image,
.item-image-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background-color: var(--accent-soft);
}
.item-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-style: italic;
}

.item-content {
    padding: 10px 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.menu-item h3 {
    font-size: 0.82em;
    line-height: 1.35;
    color: var(--title-color);
    margin: 0;
    font-weight: 600;
}

.item-price {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--price-color);
    margin-top: 8px;
}

/* ---------- Drinks ---------------------------------------------------- */
.drinks-list {
    padding: 0 2px;
    margin: 0 auto;
    max-width: 820px;
}

.drink-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px dotted var(--divider);
}
.drink-item:last-child { border-bottom: none; }

.drink-name {
    font-size: 1em;
    color: var(--text-main);
}

.drink-price {
    font-size: 1em;
    font-weight: 700;
    color: var(--price-color);
    white-space: nowrap;
}

/* ---------- Footer ---------------------------------------------------- */
footer {
    background-color: var(--header-bg);
    color: var(--header-text);
    opacity: 0.95;
    text-align: center;
    padding: 26px 16px;
    font-size: 0.88em;
}
footer p { margin: 6px 0; }

/* ---------- 3. Responsive (mobile-first scale up) -------------------- */
@media (min-width: 600px) {
    header h1 { font-size: 2.4em; }
    .menu-category { padding: 28px 18px 34px; }
    .menu-category h2 { font-size: 2em; }
    .menu-items-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
    .menu-item h3 { font-size: 0.92em; }
    .item-content { padding: 12px 12px 16px; }
    .drinks-list { column-count: 2; column-gap: 40px; }
    .drink-item { break-inside: avoid; }
}

@media (min-width: 900px) {
    .menu-items-grid { grid-template-columns: repeat(4, 1fr); gap: 22px; }
    .menu-category { scroll-margin-top: 110px; }
    .subcategory-title { scroll-margin-top: 110px; }
}
