/* Carrossel de destaques - menudigital */

/*
 * Destaques logo abaixo da barra de chips (vão explícito; z-index abaixo do sticky).
 * Tailwind `space-y-8` no <main> não aplica margin-top neste par — usamos margem aqui.
 */
#category-chips-bar {
    margin-block-end: 0 !important;
    margin-bottom: 0 !important;
    /* Cola ao fundo do header fixo: safe area + altura da row interna (~76px, logo 60px + py-2) */
    top: calc(env(safe-area-inset-top, 0px) + 76px);
}

#category-chips-bar + #section-destaques-carousel {
    position: relative;
    z-index: 10; /* chips sticky usa z-40 — o carrossel fica por baixo ao rolar */
    /* Margem até ficar por baixo da barra sticky (chips ~64px + overlap do -mt-8 no fluxo). */
    margin-top: 3rem !important;
    margin-block-start: 3rem !important;
}

@media (min-width: 768px) {
    #category-chips-bar + #section-destaques-carousel {
        margin-top: 3.75rem !important;
        margin-block-start: 3.75rem !important;
    }
}

/* ── Carousel filter buttons ── */
.carousel-filter-btn {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 1.5px solid #e0e0e0;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
    white-space: nowrap;
}
.carousel-filter-btn:not(.active):hover {
    opacity: 0.8;
}
/* active colors applied inline via JS using data-color */

/* Mobile filter (select-like) */
.carousel-filter-select {
    display: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.5rem 2.25rem 0.5rem 1rem;
    border-radius: 999px;
    border: 1.5px solid #e0e0e0;
    background: #fff;
    color: #1c1b1a;
    cursor: pointer;
    line-height: 1.1;
    box-shadow: 0 4px 14px rgba(28,27,26,0.06);
    background-image:
        linear-gradient(45deg, transparent 50%, #00693E 50%),
        linear-gradient(135deg, #00693E 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}
.carousel-filter-select:focus {
    outline: none;
    border-color: rgba(0,105,62,0.55);
    box-shadow: 0 0 0 4px rgba(0,105,62,0.10);
}

@media (max-width: 767px) {
    #carousel-filters {
        flex: 1;
        justify-content: flex-end;
        min-width: 0;
    }
    .carousel-filter-select {
        display: inline-flex;
        max-width: 100%;
    }
    .carousel-filter-buttons {
        display: none !important;
    }
}

/* ── Chips nav ── */
.chips-nav__wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0;
}

.chips-nav__pinned {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.06);
    margin-left: 0.75rem;
    margin-right: 1.5rem;
}

.chips-nav__view-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.15rem;
    background: #f1f3f4;
    border-radius: 0.75rem;
    padding: 0.2rem;
    margin-left: 1.5rem;
    margin-right: 0.75rem;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.06);
}

.chips-nav__scrollable {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.chips-nav__scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    padding: 0.25rem 2.75rem;
    flex: 1;
    cursor: grab;
    user-select: none;
}
.chips-nav__scroll:active { cursor: grabbing; }
.chips-nav__scroll::-webkit-scrollbar { display: none; }

.chips-nav__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #00693E;
    box-shadow: 0 2px 10px rgba(0, 105, 62, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.15s, opacity 0.2s, transform 0.15s;
}
.chips-nav__arrow:hover {
    box-shadow: 0 4px 16px rgba(0, 105, 62, 0.28);
    transform: translateY(-50%) scale(1.08);
}
.chips-nav__arrow[hidden] { display: none; }
.chips-nav__arrow--prev { left: 0.25rem; }
.chips-nav__arrow--next { right: 0.25rem; }

/* Mobile: chips take full width (hide pinned + view toggle) */
@media (max-width: 767px) {
    .chips-nav__pinned,
    .chips-nav__view-toggle {
        display: none !important;
    }

    .chips-nav__scrollable {
        flex: 1 1 100%;
        width: 100%;
    }

    .chips-nav__scroll {
        width: 100%;
        /* keep a little left padding, and space for the right arrow */
        padding-left: 0.75rem;
        padding-right: 2.75rem;
    }
}

.md-carousel__wrapper {
    position: relative;
    --md-carousel-photo: 168px;
    --md-carousel-card-pad-x: 1rem;
}

.md-carousel__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: #00693E;
    box-shadow: 0 4px 12px rgba(0, 105, 62, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}

.md-carousel__arrow:hover {
    background: #fff;
    box-shadow: 0 6px 20px rgba(0, 105, 62, 0.28);
    transform: translateY(-50%) scale(1.08);
}

.md-carousel__arrow--prev { left: 0.5rem; }
.md-carousel__arrow--next { right: 0.5rem; }

.md-carousel__viewport {
    overflow: hidden;
}

.md-carousel__track {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
    padding: 0.25rem 0.25rem 0.5rem;
}

.md-carousel__track:active { cursor: grabbing; }
.md-carousel__track::-webkit-scrollbar { display: none; }
.md-carousel__track * { user-select: none; }

/* Largura do slide = largura da foto + padding do card (sem slide largo só por %) */
.md-carousel__item {
    flex: 0 0 auto;
    width: fit-content;
    max-width: min(calc(var(--md-carousel-photo, 168px) + var(--md-carousel-card-pad-x, 1rem)), calc(100vw - 2.5rem));
    min-width: 0;
    position: relative;
}

@media (max-width: 575px) {
    .md-carousel__item {
        max-width: min(calc(var(--md-carousel-photo, 168px) + var(--md-carousel-card-pad-x, 1rem)), calc(100vw - 1.5rem));
    }
}

.md-carousel__card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    border-radius: 1.5rem;
    overflow: visible;
    text-decoration: none;
    box-sizing: border-box;
    width: 100%;
    max-width: calc(var(--md-carousel-photo, 168px) + var(--md-carousel-card-pad-x, 1rem));
    margin-inline: auto;
    /* Mesma cadência do zoom da foto — evita efeito “seco” no hover */
    transition: transform 0.5s cubic-bezier(0.33, 1, 0.68, 1), box-shadow 0.5s cubic-bezier(0.33, 1, 0.68, 1);
    background: #ffffff;
    padding: 0.65rem 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.md-carousel__card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.md-carousel__cover {
    position: relative;
    overflow: visible;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.md-carousel__bg {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 1rem;
    background-color: #f7f3f0;
    background-size: cover !important;
    background-repeat: no-repeat !important;
    background-position: center center;
    transition: transform 0.45s ease-out;
    z-index: 1;
}

/* carrossel: quando usa <img> em vez de background-image */
.md-carousel__bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1rem;
    z-index: 1;
    transform-origin: center center;
    transition: transform 0.55s cubic-bezier(0.33, 1, 0.68, 1);
}
.md-carousel__card:hover .md-carousel__bg-img {
    transform: scale(1.04);
}

.md-carousel__badge {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    z-index: 4;
    background: #00693E;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
}

.md-carousel__info {
    padding: 0 0.15rem 0.2rem;
    background: transparent;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    max-width: var(--md-carousel-photo, 168px);
    width: 100%;
    margin-inline: auto;
}

.md-carousel__name {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1c1b1a;
    margin: 0 0 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.md-carousel__desc {
    font-size: 0.74rem;
    color: #564337;
    margin: 0 0 0.4rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.md-carousel__bg-link {
    display: block;
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    text-decoration: none;
    aspect-ratio: 1 / 1;
    width: var(--md-carousel-photo, 168px);
    max-width: 100%;
    max-height: var(--md-carousel-photo, 168px);
    margin-left: auto;
    margin-right: auto;
}

.md-carousel__cat {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #00693E;
    background: rgba(0, 105, 62, 0.10);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    margin-bottom: 0.2rem;
}

.md-carousel__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.md-carousel__footer > div:first-child {
    min-width: 0;
}

.md-carousel__price {
    font-size: 1rem;
    font-weight: 900;
    color: #944a00;
}

/* Linha secundária atacado (gerada em destaques-carousel.js) */
.md-carousel__atacado {
    display: block;
    font-size: 0.625rem;
    font-weight: 400;
    color: rgba(86, 67, 55, 0.5);
    margin-top: 0.2rem;
    line-height: 1.35;
    letter-spacing: 0.01em;
}

.md-carousel__add {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    background: #e8f5ef;
    color: #00693E;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    flex-shrink: 0;
}
.md-carousel__add:hover  { background: #00693E; color: #fff; }
.md-carousel__add:active { transform: scale(0.88); }

/* ═══════════════════════════════════════════════════════════════
   Product Detail Modal
═══════════════════════════════════════════════════════════════ */

/* Overlay */
#product-modal {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
#product-modal:not([hidden]) { pointer-events: auto; }
#product-modal.modal-open    { opacity: 1; }

/* ── Sheet ── */
#product-modal-sheet {
    position: relative;
    z-index: 1;
    width: calc(100% - 2rem);
    max-width: 960px;
    height: 88dvh;
    max-height: 700px;
    background: #fff;
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
    /* scale animation */
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.22s ease;
}
#product-modal.modal-open #product-modal-sheet {
    transform: scale(1);
    opacity: 1;
}

/* ── Image col (mobile: top stripe) ── */
#modal-img-col {
    position: relative;
    flex-shrink: 0;
    height: 220px;
    background: #f1f3f4;
    overflow: hidden;
}
#modal-img-col img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
#modal-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 3px 10px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
#modal-badge.hidden { display: none; }

/* ── Modal image carousel controls ── */
.modal-img-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(0,0,0,.45);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: background .15s, opacity .15s, transform .15s;
    -webkit-tap-highlight-color: transparent;
}
.modal-img-arrow:hover  { background: rgba(0,0,0,.65); }
.modal-img-arrow:active { transform: translateY(-50%) scale(.88); }
.modal-img-arrow--prev  { left: 8px; }
.modal-img-arrow--next  { right: 8px; }
.modal-img-arrow .material-symbols-outlined { font-size: 1.25rem; line-height: 1; }

#modal-img-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
}
.modal-img-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.5);
    cursor: pointer;
    transition: background .2s, transform .2s;
    flex-shrink: 0;
}
.modal-img-dot--active {
    background: #fff;
    transform: scale(1.35);
}

/* Fade transition on image swap */
#modal-img.modal-img--fade {
    opacity: 0;
    transition: opacity .12s ease;
}
#modal-img {
    transition: opacity .12s ease;
}

/* ── Details col (mobile: flex-1, scrollable inside) ── */
#modal-details-col {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
#modal-header {
    flex-shrink: 0;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,.08);
}
#modal-close {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: none;
    background: #f1f3f4;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, transform .15s;
}
#modal-close:hover  { background: #e0e0e0; }
#modal-close:active { transform: scale(.88); }

/* Scrollable variations */
#modal-variations {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    scrollbar-width: none;
}
#modal-variations::-webkit-scrollbar { display: none; }

/* Footer */
#modal-footer {
    flex-shrink: 0;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid rgba(0,0,0,.08);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #fff;
}
#modal-qty-ctrl {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #f1f3f4;
    border-radius: 0.75rem;
    padding: 0.25rem 0.5rem;
}
#modal-qty-ctrl button {
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
    transition: background .15s, transform .15s;
}
#modal-qty-ctrl button:hover  { background: #e0e0e0; }
#modal-qty-ctrl button:active { transform: scale(.88); }
#modal-qty {
    font-weight: 700;
    font-size: 1rem;
    color: #1c1b1a;
    min-width: 1.5rem;
    text-align: center;
    user-select: none;
}
#modal-add-btn {
    background: #00693E;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.625rem 2rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,105,62,.3);
    transition: background .15s, transform .15s;
}
#modal-add-btn:hover  { background: #005432; }
#modal-add-btn:active { transform: scale(.95); }

/* ── Desktop: 2-column side-by-side ── */
@media (min-width: 768px) {
    #product-modal-sheet {
        flex-direction: row;
    }
    #modal-img-col {
        width: 42%;
        flex-shrink: 0;
        height: 100%;
    }
    #modal-details-col {
        flex: 1;
        height: 100%;
    }
}

/* ── Variation options ── */
.variation-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    border: 1.5px solid rgba(0,0,0,.1);
    cursor: pointer;
    background: transparent;
    transition: border-color .15s, background .15s;
    user-select: none;
}
.variation-option:hover:not(.variation-option--checked) {
    background: rgba(0,0,0,.03);
}
.variation-option--checked {
    border-color: #00693E;
    background: rgba(0, 105, 62, 0.06);
}
.variation-option input[type="radio"] {
    width: 1rem;
    height: 1rem;
    accent-color: #00693E;
    flex-shrink: 0;
}
.variation-option__name  { font-size: .875rem; color: #1c1b1a; }
.variation-option__extra { font-size: .75rem; color: #00693E; font-weight: 600; }

/* Required group error */
.variation-group--error {
    animation: shake 0.35s ease;
    outline: 2px solid #ba1a1a;
    outline-offset: 4px;
    border-radius: 12px;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    60%       { transform: translateX(6px); }
}

/* Estilos do dropdown de sugestões de busca: ver common.css */
