/* 
    SETUP
*/

@font-face {
    font-family: 'ss';
    src: url('src/fonts/StrangerThings.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    box-sizing: border-box;
}

:root {
    --bg: #141217;
    --bg2: linear-gradient(#333333, #333333) padding-box, linear-gradient(125deg, var(--accent), var(--secondary)) border-box;
    --secondary: #4800A0;
    --text: #FFFFFF;
    --accent: #D10000;
}

html {
    margin: 0px;
    background-color: var(--bg);
    font-family: 'ss', sans-serif;
    font-weight: 400;
    font-style: normal;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

html.modal-open {
    overflow: hidden;
}

body {
    margin: 0px;
    color: var(--text);
}

.backgroundImg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    z-index: -1;
}

.footerLine {
    height: 3px;
    width: calc(100%-20px);

    background-color: var(--accent);

    margin: 0 10px;
}

/* 
    Header Section
*/

header {
    padding-inline: 10px;
    padding-bottom: 20px;
}

.toolBar {
    display: flex;
    justify-content: space-between;
    padding: 20px 0px 0px 0px;
}

.backButton {
    display: flex;
    justify-content: center;
    padding: 5px;

    align-items: center;
}

.backButton>svg,
.backButton>svg>path {
    stroke: var(--accent);
}

.searchButton {
    all: unset;
    display: flex;
    justify-content: center;
    padding: 5px;
}

.title {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    align-items: center;

    margin: 2rem;
}

.title>* {
    margin: 0;
}

.title>h1 {
    font-size: 32px;
    display: none;
}

.title>h2 {
    font-size: 24px;
}

.btnContainer {
    display: flex;
    align-items: center;
    justify-content: space-around;

    margin: 3rem;
}

.main-button {
    background: var(--bg);
    border: 3px solid transparent;
    border-top: 3px solid var(--accent);
    border-bottom: 3px solid var(--accent);
    box-shadow: 0 1px hsl(0 0% 100% / 0.15) inset;
    cursor: pointer;

    color: var(--text);
    text-decoration: none;
}

.btnContainer>a {
    width: 110px;
    text-align: center;
}

.main-button>h3 {
    margin: 10px;
    font-size: 1rem;
}

/* 
    Slider Section
*/

.sliderSection {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sliderWrapper {
    display: flex;
    flex-direction: row;
    padding: 10px;
    gap: 5px;
    color: var(--text);
    align-items: center;
}

.sliderSection.is-stuck {
    box-shadow: 0px 1px 5px 1px rgba(0, 0, 0, 0.05);
    -webkit-box-shadow: 0px 1px 5px 1px rgba(0, 0, 0, 0.05);
    -moz-box-shadow: 0px 1px 5px 1px rgba(0, 0, 0, 0.05);
    background-color: var(--bg);
}

.sliderWrapper a {
    background: none;
    color: inherit;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    outline: inherit;
    text-decoration: none;
}

.horizontalScroll {
    display: flex;
    overflow-x: scroll;
    scrollbar-width: 0px;
    gap: 10px;

    /* Hide the scrollbar for Chrome, Safari & Opera */
    &::-webkit-scrollbar {
        display: none;
    }

    /* Hide the scrollbar for Edge & IE */
    -ms-overflow-style: none;

    /* Hide the scrollbar for Firefox  */
    scrollbar-width: none;
}

.horizontalScroll a.active .sliderOption {
    color: var(--accent);
}

.sliderOption {
    background: var(--bg);
    border: 3px solid transparent;
    border-top: 3px solid var(--accent);
    border-bottom: 3px solid var(--accent);
    box-shadow: 0 1px hsl(0 0% 100% / 0.15) inset;
    cursor: pointer;
    color: var(--text);
    text-decoration: none;

    transition: all 0.3s;
}

.sliderOption>h6 {
    margin: 10px;
    font-size: 1rem;
    line-height: 1.2;
    white-space: nowrap;
}

.search-wrapper {
    position: relative;
    height: 0;
    /* inizialmente non occupa spazio */
    overflow: hidden;
    /* nasconde l’input */
    transition: height 0.3s ease;
}

#search-button-active {
    background-color: var(--accent);
    border-radius: 100%;
    margin: auto;
}

#search-box {
    opacity: 0;
    transition: opacity 0.2s ease;
    height: 42px;
    padding: 12px;
    border-radius: 10px;
    margin: 0 12px 0 12px;
    border: 0;
    box-shadow: 0px 1px 5px 1px rgba(0, 0, 0, 0.05);
    -webkit-box-shadow: 0px 1px 5px 1px rgba(0, 0, 0, 0.05);
    -moz-box-shadow: 0px 1px 5px 1px rgba(0, 0, 0, 0.05);
    width: calc(100% - 24px);
    box-sizing: border-box;
}

#search-box:focus {
    border: 2px solid var(--accent);
    outline: none;
}

/* Stato visibile */
.search-wrapper.search-visible {
    height: 42px;
    margin-bottom: 12px;
}

.search-wrapper.search-visible #search-box {
    opacity: 1;
}

/* 
    PIATTI MENU
*/

.menuSection {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-inline: 14px;
    margin-top: 24px;

    scroll-margin-top: 64px;
}

.menuSection>h1 {
    text-align: center;
    margin-bottom: 0;
    text-decoration: underline solid var(--accent) 3px;
}

.menuSection>p {
    font-family: "Poppins", sans-serif;
    color: var(--text);
    text-align: center;
    margin: 0px;
    margin-bottom: 2px;
}

.menuSection>.section-description {
    font-size: 0.8rem;
}

.menuSection>.section-footer {
    font-size: 0.6rem;
    font-style: italic;
}

.menuItem {
    background: var(--bg2);
    border: 3px solid transparent;
    border-radius: 10px;
    display: flex;
    flex-direction: row;
    flex: 1;
    flex-basis: grow;
    height: 144px;
    max-height: 144px;
    min-height: 144px;
    cursor: pointer;

    font-family: "Poppins", sans-serif;
    font-weight: 400;
    position: relative;
}

.menuItemLeft {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: 14px;
    width: 65%;
    padding-inline: 16px;
}

.menuItemInfo>h3 {
    margin: 14px 0 0px 0;
    font-size: .9rem;

    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    overflow: hidden;
    -webkit-box-orient: vertical;
}

.menuItemInfo>p {
    margin: 0;
    font-size: .775rem;

    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    overflow: hidden;
    -webkit-box-orient: vertical;
}

.menuItemIcons {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 24px;
}

.menuItemInfoButton {
    all: unset;
    text-align: center;
    /* height: 32px; */
    /* padding-inline: 4px; */
    padding: 2px 4px 2px 4px;
    border-radius: 8px;
    border: 2px solid var(--accent);
    font-size: .775rem;

    white-space: nowrap;
    /* impedisce l'andata a capo */
    overflow: hidden;
    /* nasconde il testo che esce dal box */
    text-overflow: ellipsis;
    /* mostra i puntini di sospensione (...) */
    display: inline-block;
    /* serve perché funzioni correttamente */
}

.icons {
    display: flex;
    align-items: center;
    gap: 5px;
}

.icons>img {
    width: 24px;
    height: 24px;
}

.menuItemImg {
    width: 35%;
    object-fit: cover;
    border-top-right-radius: 7px;
    border-bottom-right-radius: 7px;
}

.compactMenuItem {
    background: linear-gradient(#333333, #333333) padding-box, linear-gradient(125deg, var(--accent), var(--secondary)) border-box;
    border: 3px solid transparent;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
    flex-basis: grow;

    cursor: pointer;

    font-family: "Poppins", sans-serif;
    font-weight: 400;
    position: relative;
}

.compactMenuDataContainer {
    padding: 14px 16px;
}

.compactmenuTitlePrice {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.compactmenuTitlePrice>h3 {
    margin: 0px;
    font-size: .9rem;

    display: -webkit-box;
    line-clamp: 1;
    -webkit-line-clamp: 1;
    overflow: hidden;
    -webkit-box-orient: vertical;
}

.compactMenuItemInfoButton {
    all: unset;
    text-align: center;
    padding: 2px 4px 2px 4px;
    border-radius: 8px;
    border: 2px solid var(--accent);
    font-size: .775rem;
    white-space: nowrap;
    overflow: hidden;
    display: inline-block;
}

.compactMenuDataContainer>p {
    margin: 0;
    font-size: .775rem;

    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    overflow: hidden;
    -webkit-box-orient: vertical;
}

/* SOCIAL SECTION */

.socialBtnContainer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;

    margin-inline: 14px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    border-radius: 16px;

    margin-block: 24px;
}

.socialBtn {
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
}

.socialBtnImg {
    width: 36px;
    height: 100%;
}

.modal-container {
    display: flex;
    flex-direction: column;
    /* height: 100%; */
    position: relative;
    z-index: 999;

    /* Hide the scrollbar for Chrome, Safari & Opera */
    &::-webkit-scrollbar {
        display: none;
    }

    /* Hide the scrollbar for Edge & IE */
    -ms-overflow-style: none;

    /* Hide the scrollbar for Firefox  */
    scrollbar-width: none;
}

/* --- Backdrop del Modal --- */
/* Corrisponde a: fixed inset-0 bg-black bg-opacity-50 z-40 hidden transition-opacity duration-300 */
#modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    /* Nascosto e non interagibile */
    transition: opacity 300ms ease-in-out, visibility 300ms ease-in-out;
}

/* --- Modal Principale --- */
/* Corrisponde a: fixed bottom-0 left-0 right-0 w-full h-[75vh] bg-white rounded-t-2xl shadow-2xl z-50 transform translate-y-full transition-transform duration-500 ease-in-out */
#item-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 75vh;
    background-color: #ffffff;
    border-top-left-radius: 1rem;
    /* rounded-t-2xl */
    border-top-right-radius: 1rem;
    /* rounded-t-2xl */
    /* shadow-2xl adattato per un modal che sale dal basso */
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.1), 0 -8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 50;
    transform: translateY(100%);
    /* Stato iniziale, fuori dallo schermo */
    transition: transform 500ms ease-in-out;
}

/* === STATI ATTIVI (da gestire con JavaScript) === */
/* Aggiungi questa classe al <body> per mostrare il modal */
body.modal-open #modal-backdrop {
    opacity: 1;
    visibility: visible;
}

body.modal-open #item-modal {
    transform: translateY(0);
}

/* --- Bottone di Chiusura --- */
/* Corrisponde a: absolute top-4 right-4 text-gray-500 hover:text-gray-800 z-10 */
#close-modal-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #6B7280;
    z-index: 10;
    background: none;
    border: none;
    padding: 8px;
    border-radius: 100%;
    cursor: pointer;
    transition: .2s all;
}

#close-modal-btn:hover {
    color: #1F2937;
    background-color: var(--accent);
}

#close-modal-btn svg {
    height: 2rem;
    /* h-8 */
    width: 2rem;
    /* w-8 */
    stroke: currentColor;
    stroke-width: 2;
}

/* --- Contenuto del Modal --- */
/* Corrisponde a: h-full overflow-y-auto pb-8 */
#modal-content {
    height: 100%;
    overflow-y: auto;
    padding-bottom: 2rem;
    background-color: var(--bg);
    color: var(--text);

    /* Hide the scrollbar for Chrome, Safari & Opera */
    &::-webkit-scrollbar {
        display: none;
    }

    /* Hide the scrollbar for Edge & IE */
    -ms-overflow-style: none;

    /* Hide the scrollbar for Firefox  */
    scrollbar-width: none;
}

/* --- Immagine --- */
/* Corrisponde a: w-full h-56 object-cover */
#modal-img {
    width: 100%;
    height: 17rem;
    object-fit: cover;
}

/* Corrisponde a: p-6 */
.modal-body-container {
    padding: 1.5rem;
}

/* --- Titolo e Descrizione --- */
/* Corrisponde a: text-3xl font-bold text-gray-900 mb-2 */
#modal-name {
    font-family: var(--font-poppins), sans-serif;
    font-size: 1.875rem;
    font-weight: 700;
    /* color: #111827; */
    color: var(--accent);
    margin-bottom: 0.5rem;
}

/* Corrisponde a: text-gray-600 mb-6 */
#modal-description {
    /* color: #4B5567; */
    color: var(--text);
    margin-bottom: 2rem;
    white-space: pre-line;
}

/* --- Sezioni --- */
/* Corrisponde a: mb-6 */
.modal-section {
    margin-bottom: 2rem;
}

/* Corrisponde a: text-lg font-semibold text-gray-800 mb-2/mb-3 border-b pb-2 */
.modal-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    /* color: #1F2937; */
    color: #D2D2D2;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #E5E7EB;
}

/* --- Lista Prezzi --- */
/* Corrisponde a: list-disc list-inside space-y-1 text-gray-700 */
#modal-prices {
    list-style-type: disc;
    list-style-position: inside;
    /* color: #374151; */
    color: var(--text);
}

#modal-prices li+li {
    /* space-y-1 */
    margin-top: 0.25rem;
}

/* --- Indicatori (Piccante, etc.) --- */
/* Corrisponde a: flex items-center space-x-4 mb-4 */
#modal-tags,
#modal-allergens {
    display: flex;
    flex-direction: row;
    gap: 8px;
    flex-wrap: wrap;
}

/* Corrisponde a: flex items-center space-x-2 text-sm text-gray-600 */
.modal-tags-item,
.modal-allergens-allergen {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
    background-color: var(--bg);
    color: var(--text);
    padding: 6px 12px;
    /* Ridotto padding */
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 0.85em;
    /* Ridotta dimensione font */
    user-select: none;
    border: 1px solid var(--accent);
}

.modal-tags-item img,
.modal-allergens-allergen img {
    width: 24px;
    height: 24px;
}

.important-tags {
    position: absolute;
    top: 4px;
    right: 4px;
}

.important-tags img {
    width: 28px;
    height: 28px;
}

/* @media (min-width: 600px) {
    html {
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    body {
        max-width: 425px;
        max-height: 90vh;
        width: 100%;
        height: 100%;
        overflow-y: auto;
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
        scrollbar-width: none;
        -ms-overflow-style: none;

        border-radius: 20px;

        position: relative;
    }

    body::-webkit-scrollbar {
        display: none;
    }

    .socialBtnContainer {
        position: fixed; 
        bottom: 5vh;
        left: calc(50vh - 192,5px);

        display: flex;
        flex-direction: column;

        margin-inline: 0px;
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
        border-radius: 16px;

        margin-block: 0px;

        z-index: 100;
    }

    .socialBtn {
        text-decoration: none;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 8px;
    }

    .socialBtnImg {
        width: 36px;
        height: 100%;
    }
} */

@media (min-width: 600px) {
    html {
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        /* Scegli un colore di sfondo per la visualizzazione desktop */

    }

    body {
        max-width: 425px;
        max-height: 700px;
        width: 100%;
        height: 100%;

        overflow-y: auto;
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
        scrollbar-width: none;
        -ms-overflow-style: none;
        border-radius: 20px;
        position: relative;
        /* Necessario per il posizionamento di elementi figli */
    }

    body::-webkit-scrollbar {
        display: none;
    }

    /* Questo riposiziona i bottoni social a sinistra su desktop */
    /* Puoi rimuoverlo se vuoi che restino in basso */
    .socialBtnContainer {
        position: fixed;
        /* Cambia position per "sganciarlo" dal flusso */
        bottom: 50%;
        /* Distanza dal basso */
        transform: translateY(50%);
        left: calc(50% - 425px / 2 - 90px);
        /* Calcola la posizione a sinistra del body */
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 8px;
        background-color: var(--secondary);
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
        border-radius: 16px;
        margin: 0;
    }

    /* --- FIX PER IL MODAL SU DESKTOP ---
      Questo codice centra il modal e lo adatta alla larghezza del body.
    */
    #item-modal {
        left: 50%;
        /* Lo centra orizzontalmente */
        right: auto;
        /* La trasformazione iniziale lo sposta a metà della sua larghezza e lo nasconde sotto */
        transform: translateX(-50%) translateY(100%);
        max-width: 425px;
        /* Imposta la larghezza massima uguale al body */
        border-radius: 1rem;
        /* Applica il border-radius a tutti gli angoli */
    }

    /* Quando il modal è aperto, la trasformazione lo centra e lo fa salire */
    body.modal-open #item-modal {
        transform: translateX(-50%) translateY(-5vh);
    }
}