/* ============================================================
   GUARUS DELIVERY
   CARDS DE LOJAS EM CARROSSEL HORIZONTAL

   Caminho:
   public/css/store-cards-compact.css

   Comportamento:
   - Desktop: 4 lojas por linha
   - Notebook: 3 lojas por linha
   - Tablet: 2 lojas por linha
   - Mobile: uma única fileira horizontal
   - Mobile: exatamente 2 cards visíveis
   - Mobile: demais cards aparecem ao deslizar
   - Compatível com auto-scroll-cards.js
============================================================ */


/* ============================================================
   1. VARIÁVEIS
============================================================ */

:root {
    --store-primary: #e60012;
    --store-primary-dark: #a9000c;
    --store-primary-soft: #fff0f1;

    --store-success: #20c763;
    --store-success-dark: #15803d;
    --store-success-soft: #ebfff3;

    --store-danger: #ef233c;
    --store-danger-dark: #c91428;
    --store-danger-soft: #fff0f2;

    --store-title: #17191f;
    --store-text: #737985;
    --store-border: #e4e7ec;
    --store-background: #ffffff;
    --store-soft: #f6f7f9;

    --store-radius: 20px;
    --store-gap: 18px;
    --store-mobile-gap: 10px;

    --store-shadow:
        0 8px 24px
        rgba(15, 23, 42, 0.08);

    --store-shadow-hover:
        0 18px 42px
        rgba(15, 23, 42, 0.14);

    --store-transition:
        240ms
        cubic-bezier(
            0.22,
            1,
            0.36,
            1
        );
}


/* ============================================================
   2. SEÇÃO DE LOJAS
============================================================ */

.stores-section {
    position: relative;

    overflow: hidden;
}

.stores-section .section-container {
    max-width: 1240px;
}


/* ============================================================
   3. GRADE NO DESKTOP
============================================================ */

.stores-grid {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    align-items: stretch;

    gap: var(--store-gap);

    width: 100%;

    margin: 0;
    padding: 0;

    overflow: visible;
}

.stores-loading {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    align-items: stretch;

    gap: var(--store-gap);

    width: 100%;

    margin: 0;
    padding: 0;
}


/* ============================================================
   4. CARD PRINCIPAL
============================================================ */

.store-card {
    position: relative;
    isolation: isolate;

    display: flex;
    flex-direction: column;

    width: 100%;
    min-width: 0;
    min-height: 100%;

    overflow: hidden;

    color: var(--store-text);
    background: var(--store-background);

    border:
        1px solid
        var(--store-border);

    border-radius: var(--store-radius);

    box-shadow: var(--store-shadow);

    cursor: pointer;

    transition:
        border-color
        var(--store-transition),
        box-shadow
        var(--store-transition),
        transform
        var(--store-transition);
}

.store-card::before {
    position: absolute;
    inset: 0;
    z-index: -1;

    background:
        linear-gradient(
            180deg,
            transparent 50%,
            rgba(230, 0, 18, 0.018) 100%
        );

    content: "";

    pointer-events: none;
}

.store-card::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;

    height: 3px;

    background:
        linear-gradient(
            90deg,
            var(--store-primary),
            #ff4d5a,
            var(--store-primary-dark)
        );

    content: "";

    opacity: 0;

    transform: scaleX(0);
    transform-origin: center;

    transition:
        opacity
        200ms
        ease,
        transform
        200ms
        ease;
}

.store-card:hover {
    border-color:
        rgba(
            230,
            0,
            18,
            0.25
        );

    box-shadow:
        var(--store-shadow-hover);

    transform:
        translateY(-5px);
}

.store-card:hover::after {
    opacity: 1;

    transform:
        scaleX(1);
}

.store-card.is-closed {
    filter: saturate(0.9);
}


/* ============================================================
   5. BANNER
============================================================ */

.store-card-media {
    position: relative;

    flex: 0 0 auto;

    width: 100%;
    height: 150px;

    overflow: hidden;

    background:
        linear-gradient(
            135deg,
            #f1f2f4,
            #e5e7eb
        );
}

.store-card-banner,
.store-card-banner-placeholder {
    display: block;

    width: 100%;
    height: 100%;
}

.store-card-banner {
    object-fit: cover;

    transition:
        transform
        420ms
        ease,
        filter
        300ms
        ease;
}

.store-card:hover .store-card-banner {
    filter:
        saturate(1.06)
        contrast(1.02);

    transform:
        scale(1.04);
}

.store-card-banner-placeholder {
    display: grid;
    place-items: center;

    color: #ffffff;

    background:
        radial-gradient(
            circle at 82% 18%,
            rgba(255, 255, 255, 0.22),
            transparent 28%
        ),
        linear-gradient(
            140deg,
            var(--store-primary),
            var(--store-primary-dark)
        );

    font-size: 2.2rem;
    font-weight: 950;
}

.store-card-media::after {
    position: absolute;
    inset: 0;
    z-index: 1;

    background:
        linear-gradient(
            180deg,
            rgba(9, 10, 13, 0.01) 15%,
            rgba(9, 10, 13, 0.06) 58%,
            rgba(9, 10, 13, 0.48) 100%
        );

    content: "";

    pointer-events: none;
}


/* ============================================================
   6. LOGO
============================================================ */

.store-logo-wrapper {
    position: absolute;
    bottom: 12px;
    left: 14px;
    z-index: 5;

    display: grid;
    place-items: center;

    width: 68px;
    height: 68px;

    overflow: visible;

    background: #ffffff;

    border:
        3px solid
        #ffffff;

    border-radius: 50%;

    box-shadow:
        0 10px 24px
        rgba(15, 23, 42, 0.24);
}

.store-logo,
.store-logo-placeholder {
    display: block;

    width: 100%;
    height: 100%;

    overflow: hidden;

    border-radius: 50%;
}

.store-logo {
    object-fit: cover;

    background: #ffffff;
}

.store-logo-placeholder {
    display: grid;
    place-items: center;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--store-primary),
            var(--store-primary-dark)
        );

    font-size: 1.15rem;
    font-weight: 950;
    text-transform: uppercase;
}


/* ============================================================
   7. INDICADOR ONLINE
============================================================ */

.store-online-indicator {
    position: absolute;
    right: -2px;
    bottom: 2px;
    z-index: 8;

    width: 17px;
    height: 17px;

    border:
        3px solid
        #ffffff;

    border-radius: 50%;
}

.store-online-indicator.is-open {
    background: var(--store-success);

    box-shadow:
        0 0 0 2px
        rgba(32, 199, 99, 0.16),
        0 0 11px
        rgba(32, 199, 99, 0.55);
}

.store-online-indicator.is-closed {
    background: var(--store-danger);

    box-shadow:
        0 0 0 2px
        rgba(239, 35, 60, 0.14),
        0 0 10px
        rgba(239, 35, 60, 0.48);
}


/* ============================================================
   8. STATUS
============================================================ */

.store-status {
    position: absolute;
    top: 9px;
    right: 9px;
    z-index: 7;

    display: inline-flex;
    align-items: center;
    gap: 5px;

    min-height: 25px;

    padding:
        3px
        9px;

    color: var(--store-success-dark);

    background:
        rgba(
            235,
            255,
            243,
            0.96
        );

    border:
        1px solid
        rgba(32, 199, 99, 0.22);

    border-radius: 999px;

    box-shadow:
        0 5px 14px
        rgba(15, 23, 42, 0.13);

    font-size: 0.56rem;
    font-weight: 850;

    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.store-status::before {
    flex: 0 0 auto;

    width: 6px;
    height: 6px;

    background: var(--store-success);

    border-radius: 50%;

    content: "";
}

.store-status.is-open {
    color: var(--store-success-dark);
}

.store-status.is-closed {
    color: var(--store-danger-dark);

    background:
        rgba(
            255,
            240,
            242,
            0.96
        );

    border-color:
        rgba(239, 35, 60, 0.22);
}

.store-status.is-closed::before {
    background: var(--store-danger);
}


/* ============================================================
   9. CORPO DO CARD
============================================================ */

.store-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;

    min-width: 0;

    padding:
        14px
        14px
        15px;
}

.store-card-title-row {
    display: block;

    min-width: 0;

    margin-bottom: 3px;
}

.store-card-title {
    display: block;

    min-width: 0;

    margin: 0;

    overflow: hidden;

    color: var(--store-title);

    font-size: 0.96rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.2;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.store-card-category {
    display: block;

    margin:
        0
        0
        10px;

    overflow: hidden;

    color: var(--store-text);

    font-size: 0.65rem;
    font-weight: 500;
    line-height: 1.3;

    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ============================================================
   10. AVALIAÇÃO E TEMPO
============================================================ */

.store-card-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;

    min-height: 25px;

    margin-bottom: 10px;

    color: var(--store-text);

    font-size: 0.62rem;
}

.store-info-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;

    min-height: 25px;

    padding:
        3px
        8px;

    overflow: hidden;

    background: var(--store-soft);

    border:
        1px solid
        #e9ecf0;

    border-radius: 999px;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.store-info-icon {
    flex: 0 0 auto;

    color: var(--store-text);
}

.store-rating {
    color: var(--store-title);

    font-weight: 850;
}

.store-rating-star {
    color: #ffad0d;

    font-size: 0.78rem;
}


/* ============================================================
   11. ENTREGA E PEDIDO MÍNIMO
============================================================ */

.store-card-details {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 7px;

    margin-top: auto;
    margin-bottom: 10px;
}

.store-detail {
    position: relative;

    display: flex;
    flex-direction: column;
    gap: 2px;

    min-width: 0;

    padding:
        8px
        8px
        8px
        10px;

    overflow: hidden;

    background:
        linear-gradient(
            180deg,
            #fafbfc,
            #f3f5f7
        );

    border:
        1px solid
        #e8ebef;

    border-radius: 11px;
}

.store-detail::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;

    width: 2px;

    background: var(--store-primary);

    content: "";
}

.store-detail small {
    color: var(--store-text);

    font-size: 0.52rem;
    font-weight: 650;
    line-height: 1.2;
}

.store-detail strong {
    overflow: hidden;

    color: var(--store-title);

    font-size: 0.63rem;
    font-weight: 850;
    line-height: 1.25;

    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ============================================================
   12. BOTÃO
============================================================ */

.store-card-button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 40px;

    margin-top: auto;

    padding:
        6px
        14px;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--store-primary),
            var(--store-primary-dark)
        );

    border:
        1px solid
        var(--store-primary);

    border-radius: 11px;

    box-shadow:
        0 8px 18px
        rgba(230, 0, 18, 0.19);

    font-size: 0.7rem;
    font-weight: 900;

    transition:
        filter
        160ms
        ease,
        box-shadow
        160ms
        ease,
        transform
        160ms
        ease;
}

.store-card-button::after {
    margin-left: 6px;

    content: "→";

    font-size: 0.82rem;

    transition:
        transform
        160ms
        ease;
}

.store-card-button:hover {
    filter: brightness(1.06);

    box-shadow:
        0 11px 24px
        rgba(230, 0, 18, 0.28);

    transform:
        translateY(-1px);
}

.store-card-button:hover::after {
    transform:
        translateX(3px);
}

.store-card.is-closed .store-card-button {
    color: #686e79;
    background: #f0f1f3;

    border-color: #dfe2e6;

    box-shadow: none;
}


/* ============================================================
   13. SKELETON
============================================================ */

.store-skeleton {
    width: 100%;
    min-width: 0;
    min-height: 340px;

    overflow: hidden;

    background: #ffffff;

    border:
        1px solid
        var(--store-border);

    border-radius: var(--store-radius);
}

.skeleton-banner {
    height: 150px;
}

.skeleton-circle {
    width: 68px;
    height: 68px;

    margin:
        -82px
        0
        18px
        14px;

    border-width: 3px;
}

.stores-empty-state,
.stores-error-state,
.marketplace-message {
    grid-column: 1 / -1;
}


/* ============================================================
   14. NOTEBOOK
============================================================ */

@media (max-width: 1180px) {

    .stores-grid {
        grid-template-columns:
            repeat(
                3,
                minmax(0, 1fr)
            );

        gap: 16px;
    }

    .stores-loading {
        grid-template-columns:
            repeat(
                3,
                minmax(0, 1fr)
            );

        gap: 16px;
    }

}


/* ============================================================
   15. TABLET
============================================================ */

@media (max-width: 900px) {

    .stores-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 14px;
    }

    .stores-loading {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 14px;
    }

}


/* ============================================================
   16. MOBILE
   UMA ÚNICA FILEIRA COM DOIS CARDS VISÍVEIS
============================================================ */

@media (max-width: 680px) {

    .stores-section {
        overflow: hidden;

        padding-top: 36px;
        padding-bottom: 42px;
    }

    .stores-section .section-container {
        width: calc(100% - 16px);

        overflow: visible;
    }

    .stores-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: var(--store-mobile-gap);

        width: 100%;

        margin: 0;

        padding:
            5px
            0
            22px;

        overflow-x: auto;
        overflow-y: hidden;

        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: 0;
        overscroll-behavior-x: contain;

        scrollbar-width: none;

        -webkit-overflow-scrolling: touch;

        touch-action: pan-x pan-y;
    }

    .stores-grid::-webkit-scrollbar {
        display: none;
    }

    .stores-grid > .store-card {
        flex:
            0
            0
            calc(
                (
                    100%
                    -
                    var(--store-mobile-gap)
                )
                /
                2
            );

        width:
            calc(
                (
                    100%
                    -
                    var(--store-mobile-gap)
                )
                /
                2
            );

        min-width:
            calc(
                (
                    100%
                    -
                    var(--store-mobile-gap)
                )
                /
                2
            );

        max-width:
            calc(
                (
                    100%
                    -
                    var(--store-mobile-gap)
                )
                /
                2
            );

        min-height: 100%;

        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    .stores-grid > .stores-loading {
        flex:
            0
            0
            100%;

        width: 100%;
        min-width: 100%;
    }

    .stores-loading {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: var(--store-mobile-gap);

        width: 100%;

        margin: 0;

        padding:
            5px
            0
            22px;

        overflow-x: auto;
        overflow-y: hidden;

        scroll-snap-type: x mandatory;

        scrollbar-width: none;

        -webkit-overflow-scrolling: touch;
    }

    .stores-loading::-webkit-scrollbar {
        display: none;
    }

    .stores-loading > .store-skeleton {
        flex:
            0
            0
            calc(
                (
                    100%
                    -
                    var(--store-mobile-gap)
                )
                /
                2
            );

        width:
            calc(
                (
                    100%
                    -
                    var(--store-mobile-gap)
                )
                /
                2
            );

        min-width:
            calc(
                (
                    100%
                    -
                    var(--store-mobile-gap)
                )
                /
                2
            );

        scroll-snap-align: start;
    }

    .store-card {
        border-radius: 16px;

        box-shadow:
            0 6px 18px
            rgba(15, 23, 42, 0.08);
    }

    .store-card:hover {
        transform: none;
    }

    .store-card-media {
        height: 112px;
    }

    .store-card-banner-placeholder {
        font-size: 1.55rem;
    }

    .store-logo-wrapper {
        bottom: 8px;
        left: 9px;

        width: 48px;
        height: 48px;

        border-width: 2px;
    }

    .store-logo-placeholder {
        font-size: 0.82rem;
    }

    .store-online-indicator {
        width: 13px;
        height: 13px;

        border-width: 2px;
    }

    .store-status {
        top: 7px;
        right: 7px;

        gap: 3px;

        min-height: 20px;

        padding:
            2px
            6px;

        font-size: 0.44rem;
    }

    .store-status::before {
        width: 5px;
        height: 5px;
    }

    .store-card-body {
        padding:
            10px
            9px
            10px;
    }

    .store-card-title-row {
        margin-bottom: 2px;
    }

    .store-card-title {
        font-size: 0.78rem;
        line-height: 1.18;
    }

    .store-card-category {
        margin-bottom: 7px;

        font-size: 0.54rem;
        line-height: 1.3;
    }

    .store-card-info {
        flex-wrap: wrap;
        gap: 4px;

        min-height: 21px;

        margin-bottom: 7px;

        font-size: 0.5rem;
    }

    .store-info-item {
        min-height: 21px;

        padding:
            2px
            5px;
    }

    .store-rating-star {
        font-size: 0.63rem;
    }

    .store-card-details {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 4px;

        margin-bottom: 7px;
    }

    .store-detail {
        min-height: 42px;

        padding:
            6px
            4px
            6px
            7px;

        border-radius: 8px;
    }

    .store-detail small {
        font-size: 0.4rem;
    }

    .store-detail strong {
        font-size: 0.5rem;
    }

    .store-card-button {
        min-height: 34px;

        padding:
            5px
            8px;

        border-radius: 8px;

        font-size: 0.6rem;
    }

    .store-card-button::after {
        margin-left: 4px;

        font-size: 0.7rem;
    }

    .store-skeleton {
        min-height: 285px;

        border-radius: 16px;
    }

    .skeleton-banner {
        height: 112px;
    }

    .skeleton-circle {
        width: 48px;
        height: 48px;

        margin:
            -59px
            0
            14px
            9px;

        border-width: 2px;
    }

    .stores-empty-state,
    .stores-error-state,
    .marketplace-message {
        flex:
            0
            0
            100%;

        width: 100%;
        min-width: 100%;

        scroll-snap-align: start;
    }

}


/* ============================================================
   17. CELULARES PEQUENOS
============================================================ */

@media (max-width: 380px) {

    :root {
        --store-mobile-gap: 7px;
    }

    .stores-section .section-container {
        width: calc(100% - 12px);
    }

    .store-card-media {
        height: 102px;
    }

    .store-logo-wrapper {
        bottom: 7px;
        left: 7px;

        width: 44px;
        height: 44px;
    }

    .store-status {
        min-height: 18px;

        padding:
            1px
            5px;

        font-size: 0.39rem;
    }

    .store-card-body {
        padding: 8px;
    }

    .store-card-title {
        font-size: 0.7rem;
    }

    .store-card-category {
        margin-bottom: 5px;

        font-size: 0.48rem;
    }

    .store-card-info {
        margin-bottom: 5px;

        font-size: 0.44rem;
    }

    .store-info-item {
        min-height: 19px;

        padding-inline: 4px;
    }

    .store-card-details {
        gap: 3px;

        margin-bottom: 5px;
    }

    .store-detail {
        min-height: 38px;

        padding:
            5px
            3px
            5px
            6px;
    }

    .store-detail small {
        font-size: 0.36rem;
    }

    .store-detail strong {
        font-size: 0.45rem;
    }

    .store-card-button {
        min-height: 31px;

        font-size: 0.55rem;
    }

    .store-skeleton {
        min-height: 265px;
    }

    .skeleton-banner {
        height: 102px;
    }

}


/* ============================================================
   18. REDUÇÃO DE MOVIMENTO
============================================================ */

@media (prefers-reduced-motion: reduce) {

    .stores-grid,
    .stores-loading {
        scroll-behavior: auto;
    }

    .store-card,
    .store-card::after,
    .store-card-banner,
    .store-card-button,
    .store-card-button::after {
        transition: none;
    }

    .store-card:hover,
    .store-card:hover .store-card-banner {
        transform: none;
    }

}


/* ============================================================
   19. IMPRESSÃO
============================================================ */

@media print {

    .stores-grid {
        display: grid;

        grid-template-columns:
            repeat(
                3,
                minmax(0, 1fr)
            );

        gap: 10px;

        overflow: visible;
    }

    .store-card {
        break-inside: avoid;

        width: 100%;
        min-width: 0;

        box-shadow: none;
    }

}