/*
 * Product listings: the shared card (resources/themes/default/views/products/listing-card.blade.php),
 * the grids it sits in, and the category page's own card brought into line with it.
 *
 * Plain CSS, like product-page.css, so it ships with a pull and needs no asset rebuild.
 * The palette matches the product page.
 */

:root {
    --sbt-ink: #371E0F;
    --sbt-ink-soft: #6B5A4E;
    --sbt-muted: #8C7D72;
    --sbt-line: #E9E2DC;
    --sbt-cream: #F7F3EF;
}

/* Grid ------------------------------------------------------------------- */

.sbt-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 40px 24px;
}

/* Card ------------------------------------------------------------------- */

.sbt-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
}

.sbt-card-link {
    display: flex;
    flex-direction: column;
    color: inherit;
}

.sbt-card-media {
    position: relative;
    aspect-ratio: 1 / 1;
    margin-bottom: 14px;
    overflow: hidden;
    border-radius: 12px;
    background: var(--sbt-cream);
}

.sbt-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}

.sbt-card-link:hover .sbt-card-media img {
    transform: scale(1.04);
}

.sbt-card-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 6px;
    font-family: "Oswald", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--sbt-ink);
}

.sbt-card-price {
    margin: 0;
    font-family: "Roboto", sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--sbt-ink-soft);
}

/* The price stays under its name; it is the buttons that line up along the bottom of a row. */
.sbt-card .product-actions {
    margin-top: auto;
    padding-top: 14px;
}

.sbt-card .product-actions > button:first-child {
    height: 40px;
    border-radius: 9999px;
}

.sbt-card .product-actions > button:nth-child(2) {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Section headings on the flower page, the same as the product page's */

.sbt-section-title {
    margin: 0;
    font-family: "Oswald", sans-serif !important;
    font-size: 26px !important;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--sbt-ink);
    width: auto !important;
    min-width: 0 !important;
}

/* Carousel slides on the flower page size to the card, not to a fixed height */

.home-product-slider .swiper-slide {
    height: auto;
}

/* Category page: Bagisto's Vue card, brought into line ---------------------- */

.category-cards {
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column;
}

.category-cards > div:first-child {
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: 1 / 1;
    margin-bottom: 14px;
    overflow: hidden;
    border-radius: 12px !important;
    background: var(--sbt-cream);
}

.category-cards > div:first-child img,
.category-cards > div:first-child .shimmer {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    object-fit: cover;
    transition: transform .35s ease;
}

.category-cards > div:first-child > a,
.category-cards > div:first-child > a > div {
    display: block;
    width: 100%;
    height: 100%;
}

.category-cards:hover > div:first-child img {
    transform: scale(1.04);
}

/* "New" / "Sale" badges: small and quiet */
.category-cards .action-items > p {
    top: 10px !important;
    left: 10px !important;
    padding: 2px 10px !important;
    border-radius: 9999px !important;
    background: var(--sbt-ink) !important;
    font-family: "Roboto", sans-serif;
    font-size: 11px !important;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.category-cards > div:last-child {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    gap: 0 !important;
}

.category-cards > div:last-child > .grid {
    display: flex !important;
    flex-direction: column;
    gap: 6px !important;
}

.category-cards .cat-product-name {
    max-width: none !important;
    margin: 0 !important;
    font-family: "Oswald", sans-serif;
    font-size: 16px !important;
    line-height: 1.35 !important;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--sbt-ink);
}

.category-cards .cat-product-price {
    margin: 0 !important;
    font-family: "Roboto", sans-serif !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: var(--sbt-ink-soft);
}

.category-cards .cat-product-price p {
    margin: 0;
}

.category-cards .cat-action-items {
    margin-top: auto;
    padding-top: 14px;
}

.category-cards .cat-action-items .secondary-button {
    height: 40px;
    padding: 0 16px !important;
    border: 0 !important;
    border-radius: 9999px !important;
    background: var(--sbt-ink) !important;
    color: #fff !important;
    font-family: "Roboto", sans-serif;
    font-size: 13px !important;
}

.category-cards .cat-action-items .secondary-button:disabled {
    opacity: .45;
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 1023px) {
    .sbt-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    /* Two across on phones, as shops do; one per row made every listing a very long scroll. */
    .sbt-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 12px;
    }

    .sbt-card-name,
    .category-cards .cat-product-name {
        font-size: 14px !important;
    }

    .sbt-card-price,
    .category-cards .cat-product-price {
        font-size: 14px !important;
    }

    .sbt-card .product-actions {
        gap: 6px;
    }

    .sbt-card .product-actions > button:first-child {
        height: 36px;
        padding: 0 8px;
        font-size: 12px;
    }

    .sbt-card .product-actions > button:nth-child(2) {
        width: 36px;
        height: 36px;
    }

    .sbt-section-title {
        font-size: 22px !important;
    }
}

/* Sale and variant pricing on the card ----------------------------------- */

.sbt-card-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
}

.sbt-card-price .is-sale {
    color: #b42318;
}

.sbt-card-price del {
    font-size: 13px;
    font-weight: 400;
    color: #9a8f88;
}

.sbt-card-from {
    font-size: 13px;
    font-weight: 400;
}

.sbt-card-badge {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    z-index: 1;
    padding: 3px 9px;
    border-radius: 9999px;
    background: #b42318;
    color: #fff;
    font-family: "Roboto", sans-serif;
    font-size: 12px;
    font-weight: 600;
}

.sbt-card .product-actions > a:first-child {
    text-decoration: none;
}

/* Listing toolbar: result count and sort ---------------------------------- */

.sbt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(55, 30, 15, .1);
    font-family: "Roboto", sans-serif;
    font-size: 14px;
    color: var(--sbt-ink-soft, #6b5a50);
}

.sbt-toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sbt-toolbar select {
    height: 38px;
    padding: 0 34px 0 12px;
    border: 1px solid rgba(55, 30, 15, .2);
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23371E0F' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
    -webkit-appearance: none;
    appearance: none;
    color: #371E0F;
    font: inherit;
    cursor: pointer;
}

[dir="rtl"] .sbt-toolbar select {
    padding: 0 12px 0 34px;
    background-position: left 12px center;
}
