/* Palettes */
:root {
    /* Palette A */
    --sea-green: #029353ff;
    --cream: #eff7cfff;
    --garnet: #732c2cff;
    --chocolate-cosmos: #420c14ff;
    --pacific-cyan: #23b5d3ff;
    /* Palette B */
    --sea-green: #029353ff;
    --prussian-blue: #083249ff;
    --saffron: #e8c547ff;
    --alabaster: #d9dbd1ff; /*FFFAFB*/
    --blue-ncs: #2589bdff;
    /* Palette C */
    --sea-green: #029353ff;
    --prussian-blue: #083249ff;
    --white: #ffffffff;
    --light-red: #ff6b6bff;
    --white-2: #ffffffff;
    /* Palette D, more monochrome*/
    --sea-green: #029353ff;
    --prussian-blue: #083249ff;
    --seasalt: #fcfafaff;
    --silver: #e9f3f5ff;
    --ash-gray: #a6b1b3ff;
    --powder-blue: #a4b8c4ff;
    --teal: #6dafbdff;


    --vivid-sky-blue: #44CCFFFF;
    --celeste: #ADEEE3FF;
    --azure: #007bffff;
    --azure-lighter: #e8f5ffff;
    --prussian-blue-disabled: #96a6b0ff;
    --crimson-light: #de493e;

    /* Variabili per il tema */
    --bg: var(--seasalt);
    --bg-variant: var(--vivid-sky-blue);
    --bg-contrast: var(--white);

    --card-bg: var(--silver);
    --card-border: var(--ash-gray);
    --card-highlight: var(--prussian-blue);

    --error-bg: var(--crimson-light);
    --error-content: var(--white);

    --on-primary: var(--white);
    --primary: var(--prussian-blue);
    --primary-disabled: var(--prussian-blue-disabled);

    --secondary: var(--saffron);
    --secondary-variant: var(--white);

    --tertiary: var(--teal);

    --highlight-bg: var(--azure);
    --highlight-bg-lighter: var(--azure-lighter);
    --highlight-content: var(--white);
}


/* ===== LAYOUT DI BASE ===== */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 16px;
    color: var(--primary);
    background-color: var(--bg);
    margin: 0;
    padding: 0;
}

.container {
    flex: 1; /* Permette al container di espandersi e occupare lo spazio disponibile */
}

.safe-header-padding {
    padding-top: 6rem !important; /* top padding for avoiding page content under header */
}

/* ===== HEADER E NAVIGAZIONE ===== */
.fixed-top {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
}

.header-main-logo {
    transition: height 0.2s ease-in-out, margin-bottom 0.2s ease-in-out;
    height:34px;
    margin-bottom: 2px;
    margin-right: 10px;
    margin-left: 10px;
}
.header-main-logo:hover {
    height:36px;
    margin-bottom: 0px;
}

.header-navbar .row {
    padding-top: 10px;
    padding-bottom: 10px;
    background-color: var(--bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-footer {
    background-color: var(--primary);
    color: var(--on-primary);
    padding-top: 1rem;
}

/* Personalizzazione hamburger menu */
.navbar-toggler-icon {
    background-image: none !important;
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    line-height: 1.5em;
    text-align: center;
}

.navbar-toggler-icon::before {
    content: "\f0c9";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}

/* ===== CARD MERCATI ===== */
.market-icon-big {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 3rem;
}

.market-icon-small {
    width: 32px;
    height: 32px;
    margin-right: 10px;
    object-fit: contain;
}

.market-icon-big img {
    max-height: 80px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
}

/* ===== CARD PRODOTTI ===== */
.product-grid {
    margin-top: 1rem;
}

.special-type-icon{
    width: 47px;
    height: 47px;
    object-fit: contain;
}

/* ===== ELEMENTI DI REGISTRAZIONE ===== */

/* ===== BADGES ===== */
.badge-pill {
    display: inline-block;
    padding: 0.4em 0.8em !important;
    border-radius: 10rem !important;
    font-size: 0.9em !important; /* Regola la dimensione del font come desiderato */
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    transition: all 0.15s ease-in-out;
}

.product-badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 150px; /* Limita la larghezza per forzare il wrapping */
    align-content: flex-start;
}

.badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    height: 42px; /* Dimensione ridotta */
    width: 42px; /* Dimensione ridotta */
    text-align: center;
    transition: all 0.15s ease-in-out;
    padding: 0 !important;
    margin: 2px;
}

.badge-icon-with-border {
    box-sizing: border-box; /* Include padding e bordo nel calcolo della larghezza */
    text-align: center;
}

.badge-icon i {
    font-size: 1.5rem; /* Riduce la dimensione dell'icona */
}

.header-navbar {
    padding-top: 10px;
    padding-bottom: 10px;
    background-color: var(--bg);
}

.header-navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-static-content {
    flex-shrink: 0; /* Impedisce a questi contenitori di restringersi */
}

.header-market-info {
    flex-grow: 1; /* Permette a questo contenitore di crescere per occupare lo spazio */
    flex-shrink: 1; /* Permette a questo contenitore di restringersi se necessario */
    min-width: 0; /* Necessario per permettere il restringimento in un contenitore flex */
    display: flex;
    justify-content: center; /* Centra il logo del supermercato */
}

.header-market-info a {
    display: inline-block;
}

.header-market-info img {
    max-width: 100%;
    max-height: 32px;
    height: auto;
    object-fit: contain;
}

/* ===== PAGINAZIONE ===== */
.pagination {
    margin-top: 2rem;
}

.pagination .page-link {
    color: var(--highlight-bg);
    border-color: var(--card-border);
    transition: all 0.2s ease;
}

.pagination .page-item.active .page-link {
    background-color: var(--highlight-bg);
    border-color: var(--highlight-bg);
    color: var(--highlight-content);
}

.pagination .page-link:hover {
    background-color: var(--highlight-bg);
    color: var(--bg);
}

.pagination .page-item.disabled .page-link {
    color: var(--primary-disabled);
}

/* ===== SEARCH BAR ===== */
.input-group {
    position: relative;
}
#headerClearSearch {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
#headerClearSearch.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.type-icon-svg {
    fill: currentColor; /* Applica il colore corrente del testo */
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.product-info-search {
    flex: 1;
}

.product-price-search {
    flex: 0 0 auto; /* Do not grow, do not shrink, base size is auto */
    font-weight: bold;
    margin-left: 10px;
    white-space: nowrap;
}
/* ===== ANIMAZIONI ===== */
/* Animazioni per un caricamento più fluido */
.fade-in {
    animation: fadeIn 0.5s ease-in;
    opacity: 0;
    animation-fill-mode: forwards;
}

.fade-in-fast {
    animation: fadeIn 0.2s ease-in-out;
    opacity: 0;
    animation-fill-mode: forwards;
}

.fade-zoom-in {
    animation: fadeZoomIn 0.5s ease-in-out;
    opacity: 0;
    animation-fill-mode: forwards;
}

.fade-zoom-in-fast {
    animation: fadeZoomIn 0.2s ease-in-out;
    opacity: 0;
    animation-fill-mode: forwards;
}


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

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes fadeZoomIn {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Stili specifici per la pagina di dettaglio prodotto */
.product-detail-badge {
    font-size: 0.9rem;
    padding: 0.4rem;
}

/* Stile del modal dei dettagli prodotto */
.modal-content {
    border-radius: 10px;
    overflow: hidden;
}

#productDetailModal .modal-header {
    padding: 1rem 1rem 0.5rem;
    background-color: var(--bg);
}

#productDetailModal .close {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

#productDetailModal .close:hover {
    opacity: 1;
}

#filterMenu {
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    border-radius: 5px;
    position: absolute;
    z-index: 1000;
    padding-bottom: 60px !important; /* Spazio aggiuntivo per i pulsanti fissi */
    max-height: 400px; /* Altezza massima fissa */
    display: none;
    overflow: hidden; /* Impedisce lo scorrimento del menu principale */
}

.filter-options {
    max-height: 272px; /* Riduci l'altezza per lasciare spazio ai pulsanti */
    overflow-y: auto;
    padding-bottom: 10px;
}

.filter-buttons-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 55px; /* Altezza fissa per i pulsanti */
    padding: 10px;
    background-color: var(--bg);
    border-top: 1px solid var(--card-border);
    border-radius: 0 0 5px 5px;
    display: flex;
    align-items: center;
}

.filter-buttons-container .btn {
    min-height: 35px; /* Altezza minima per i pulsanti */
}

.cursor-pointer {
    cursor: pointer;
}

/* Animazione per l'icona di errore */
.error-animation i {
    animation: shakeX 0.8s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shakeX {
    10%, 90% {
        transform: translate3d(-1px, 0, 0);
    }
    20%, 80% {
        transform: translate3d(2px, 0, 0);
    }
    30%, 50%, 70% {
        transform: translate3d(-4px, 0, 0);
    }
    40%, 60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Animazione per il segno di spunta */
.success-animation {
    display: inline-block;
}

.checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-miterlimit: 10;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}