*, *::before, *::after { box-sizing: border-box; }

:root {
    color-scheme: light dark;
    --bg: #f4f4f4;
    --text: #333;
    --navbar-bg: white;
    --navbar-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --accent: #d32f2f;
    --accent-dark: #ef5350;
    --nav-active-text: #000;
    --card-bg: white;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.1);
    --card-hover: #fffafa;
    --numero-text: white;
    --text-title: #222;
    --text-muted: #666;
    --price: #555;
    --border: #ddd;
    --border-light: #ccc;
    --text-light: #888;
    --input-border: #ddd;
    --alergias-bg: white;
    --contact-border-color: #ddd;
}

:root.dark-mode {
    --bg: #121212;
    --text: #e0e0e0;
    --navbar-bg: #1a1a1a;
    --navbar-shadow: 0 2px 10px rgba(0,0,0,0.4);
    --accent: #ef5350;
    --nav-active-text: #eee;
    --card-bg: #1e1e1e;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
    --card-hover: #2a2a2a;
    --text-title: #eee;
    --text-muted: #aaa;
    --price: #bbb;
    --border: #333;
    --border-light: #444;
    --text-light: #888;
    --input-border: #444;
    --alergias-bg: #1e1e1e;
    --contact-border-color: #333;
}

html { scroll-behavior: smooth; }
body { font-family: 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif; margin: 0; background-color: var(--bg); color: var(--text); line-height: 1.4; overflow-x: hidden; }

#top { position: absolute; top: 0; }

.navbar { position: fixed; top: 0; width: 100%; background: var(--navbar-bg); box-shadow: var(--navbar-shadow); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 8px 0; row-gap: 6px; z-index: 1000; }

.logo-container a { display: block; border: none; outline: none; text-decoration: none; }
.logo-container img { 
    height: 60px;
    margin-top: 5px;
    margin-left: 20px; 
    cursor: pointer; 
    display: block; 
}
.nav-menu { list-style: none; display: flex; margin: 0; padding-right: 20px; flex-wrap: wrap; align-items: center; }
.nav-menu li { margin: 5px 10px; }
.nav-menu a { 
    text-decoration: none; 
    color: var(--accent); 
    font-weight: bold; 
    font-size: 14px;
    text-transform: uppercase; 
}
.nav-menu a:hover { color: var(--nav-active-text); }
.nav-menu a.active { color: var(--nav-active-text); border-bottom: 2px solid var(--accent); }
.content { 
    margin-top: 110px;
    padding: 0 20px; 
    max-width: 1200px; 
    margin-left: auto; 
    margin-right: auto; 
}

.menu-section { margin-bottom: 40px; scroll-margin-top: 110px; }
.menu-section h2 { color: var(--accent); border-bottom: 2px solid var(--accent); padding-bottom: 10px; text-transform: uppercase; letter-spacing: 2px; font-size: 1.8rem; margin-top: 0; }

.grid-platos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 20px; }

.plato { 
    background: var(--card-bg); 
    border-radius: 6px; 
    box-shadow: var(--card-shadow); 
    display: flex; 
    align-items: center;
    padding: 12px;
    transition: 0.2s; 
}
.plato:hover { background-color: var(--card-hover); border-color: var(--accent); }

.numero-plato {
    background-color: var(--accent);
    color: var(--numero-text);
    min-width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    margin-right: 12px;
    flex-shrink: 0;
}

.plato-info { flex-grow: 1; display: flex; flex-direction: column; }
.plato-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.plato-info h3 { margin: 0; font-size: 13px; color: var(--text-title); text-transform: uppercase; line-height: 1.2; flex-grow: 1; }

.descripcion-bandeja { margin: 4px 0 0 0; font-size: 10.5px; color: var(--text-muted); line-height: 1.2; }
.precio {
    color: var(--price);
    font-weight: bold;
    font-size: 15px;
    white-space: nowrap;
}
.alergias-section { text-align: center; background: var(--alergias-bg); padding: 30px; border: 2px dashed var(--border-light); border-radius: 10px; margin: 50px 0; }
.alergias-img { max-width: 45%; height: auto; margin-top: 20px; }

.contact-info { background: var(--card-bg); padding: 30px; border-top: 4px solid var(--accent); border-bottom: 4px solid var(--accent); margin: 50px 0; text-align: center; }
.contact-title { color: var(--accent); font-size: 24px; font-weight: 900; text-transform: uppercase; margin-bottom: 25px; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.contact-column { border-left: 1px solid var(--contact-border-color); padding: 0 15px; }
.contact-column:first-child { border-left: none; }
.contact-column h4 { color: var(--accent); margin: 0 0 10px 0; font-size: 16px; text-transform: uppercase; }
.contact-column p { margin: 3px 0; font-size: 15px; font-weight: bold; }
.tel-destacado { font-size: 18px !important; }
.label-cerrado { background-color: var(--accent); color: white; padding: 4px 12px; font-size: 12px; font-weight: bold; display: inline-block; margin-top: 10px; border-radius: 2px; }

footer { text-align: center; padding: 30px; font-size: 11px; color: var(--text-light); text-transform: uppercase; }

.tel-link { color: inherit; text-decoration: none; }
.tel-link:hover { text-decoration: underline; }

.buscador-nav {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 6px 20px 6px;
}
.search-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 400px;
}
.search-wrapper input {
    flex: 1;
    padding: 6px 32px 6px 16px;
    border: 1.5px solid var(--input-border);
    border-radius: 20px;
    font-size: 16px;
    outline: none;
    transition: 0.2s;
    background: var(--card-bg);
    color: var(--text);
}
.search-wrapper input:focus {
    border-color: var(--accent);
}
.search-wrapper input::placeholder {
    color: var(--text-light);
}
.buscador-clear {
    display: none;
    flex-shrink: 0;
    margin-left: -26px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    line-height: 1;
    z-index: 1;
}
.buscador-clear.visible { display: block; }
.buscador-clear:hover { color: var(--text); }

#darkModeToggle {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: var(--text);
    transition: 0.2s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
#darkModeToggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.cart-toggle {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: var(--text);
    transition: 0.2s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    position: relative;
}
.cart-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

.btn-add {
    background: #e0e0e0;
    color: #888;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 10px;
    padding: 0;
    line-height: 1;
    transition: 0.15s;
}
.btn-add:hover {
    background: #ccc;
    color: #666;
}

.cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 3000;
}
.cart-overlay.open { display: block; }

.cart-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: var(--card-bg);
    z-index: 3001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}
.cart-panel.open { right: 0; }

.cart-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.cart-panel-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}
#cartClose {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text);
    padding: 0;
    line-height: 1;
}

.cart-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}
.cart-vacio {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin: 40px 0;
}
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.cart-item-info {
    flex: 1;
    min-width: 0;
}
.cart-item-nombre {
    font-size: 12px;
    color: var(--text-title);
    text-transform: uppercase;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-numero {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 2px;
}
.cart-item-precio {
    font-size: 13px;
    color: var(--price);
    font-weight: bold;
    white-space: nowrap;
}
.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
}
.cart-item-qty button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: none;
    color: var(--text);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: 0.15s;
}
.cart-item-qty button:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.cart-item-qty span {
    font-size: 14px;
    font-weight: bold;
    color: var(--text);
    min-width: 16px;
    text-align: center;
}
.cart-item-remove {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    line-height: 1;
}

.cart-panel-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.cart-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-weight: bold;
    color: var(--text);
    margin-bottom: 12px;
}
.cart-total-label {
    text-transform: uppercase;
    color: var(--text);
}
.cart-enviar {
    width: 100%;
    padding: 12px;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}
.cart-enviar:hover:not(:disabled) {
    opacity: 0.9;
}
.cart-enviar:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sin-resultados {
    display: none;
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    font-size: 18px;
}
.menu-section--oculta { display: none; }

#backToTopBtn {
    display: none; position: fixed; bottom: 20px; right: 20px; z-index: 2000; border: none;
    background-color: var(--accent); color: white; width: 45px; height: 45px; border-radius: 50%;
    font-size: 20px; box-shadow: 0 4px 8px rgba(0,0,0,0.3); cursor: pointer;
}

@media (max-width: 768px) {
    .navbar { 
        flex-direction: column; 
        position: relative; 
        padding-top: 20px !important;
    }

    .logo-container img { 
        height: 80px !important;
        margin-left: 0;
        margin-bottom: 15px; 
    }

    .nav-menu { 
        justify-content: center; 
        padding: 0 10px; 
    }

    .nav-menu li {
        margin: 8px 12px;
    }

    .nav-menu a {
        font-size: 16px !important;
        letter-spacing: 1px;
    }

    .content { margin-top: 0; }
    .menu-section { scroll-margin-top: 0; }
    .cart-panel { max-width: 100%; }
    .contact-column { border-left: none; border-bottom: 1px solid var(--contact-border-color); padding-bottom: 15px; }
    .alergias-img { max-width: 80%; }
    .grid-platos { grid-template-columns: 1fr; }
}
