/*
 * Product card Style 21 (product-card/standard-one.blade.php) and its option picker.
 * Button colours: --card-cart-btn-* / --card-buy-btn-* set by the layout from
 * Settings → Appearance. Both buttons always show their own colour — no hover-only state.
 */

/* ── Card ──────────────────────────────────────────────────────────────── */

.fs-pcard {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid #eceef1;
    border-radius: var(--appearance-product-card-border-radius, var(--appearance-card-border-radius, 8px));
    background: #fff;
    transition: box-shadow .2s ease, transform .2s ease;
}

.fs-pcard:hover {
    box-shadow: 0 10px 26px -14px rgba(15, 23, 42, .35);
}

.fs-pcard__media {
    position: relative;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f6f7f9;
}

.fs-pcard__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}

.fs-pcard:hover .fs-pcard__media img {
    transform: scale(1.04);
}

.fs-pcard__badge {
    position: absolute;
    top: 8px;
    inset-inline-start: 8px;
    z-index: 1;
    padding: 3px 8px;
    border-radius: 4px;
    background: #ffd400;
    color: #1f2937;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.fs-pcard__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    padding: 10px 10px 12px;
    text-align: center;
}

.fs-pcard__title {
    display: -webkit-box;
    /* Bangla vowel signs reach above / below the Latin line: taller line box + padding
       so they are not clipped (Bug 108). Two lines are reserved for alignment. */
    min-height: calc(2 * 1.55em + .24em);
    margin: 0;
    padding: .12em 0;
    overflow: hidden;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.fs-pcard__title a {
    color: #111827;
    text-decoration: none;
}

.fs-pcard__title a:hover {
    color: var(--appearance-primary, #0d6efd);
}

.fs-pcard__price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 2px 8px;
    font-size: 14px;
}

.fs-pcard__price del {
    color: #9ca3af;
    font-size: 13px;
}

.fs-pcard__final {
    color: #16a34a;
    font-weight: 700;
}

/* Buttons sit at the bottom so a row of cards lines up whatever the title length. */
.fs-pcard__actions {
    display: grid;
    gap: 6px;
    margin-top: auto;
}

.fs-pcard__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 38px;
    padding: 6px 10px;
    border: 0;
    border-radius: var(--appearance-button-border-radius, 4px);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    cursor: pointer;
    transition: filter .15s ease, transform .1s ease;
}

.fs-pcard__btn--cart {
    background: var(--card-cart-btn-bg, #0d8255);
    color: var(--card-cart-btn-text, #fff);
}

.fs-pcard__btn--buy {
    background: var(--card-buy-btn-bg, #1faa39);
    color: var(--card-buy-btn-text, #fff);
}

.fs-pcard__btn:hover {
    filter: brightness(.93);
}

.fs-pcard__btn:active {
    transform: translateY(1px);
}

.fs-pcard__btn:focus-visible {
    outline: 2px solid #111827;
    outline-offset: 2px;
}

.fs-pcard__btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    filter: none;
}

.fs-pcard__btn.is-loading {
    cursor: wait;
}

.fs-pcard__btn.is-loading::after {
    content: "";
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-inline-end-color: transparent;
    border-radius: 50%;
    animation: fs-pcard-spin .7s linear infinite;
}

@keyframes fs-pcard-spin {
    to { transform: rotate(360deg); }
}

body[data-theme="dark"] .fs-pcard {
    border-color: #2f3542;
    background: #1b1f27;
}

body[data-theme="dark"] .fs-pcard__media {
    background: #222733;
}

body[data-theme="dark"] .fs-pcard__title a {
    color: #f3f4f6;
}

@media (max-width: 575.98px) {
    .fs-pcard__body {
        padding: 8px 8px 10px;
    }

    .fs-pcard__btn {
        min-height: 34px;
        font-size: 12px;
    }
}

/* ── Option picker ─────────────────────────────────────────────────────── */

/* Above any sticky header, below the login popup (which a guest's Buy Now can open). */
.modal.fs-popt-modal {
    --bs-modal-zindex: 100030;
    --bs-modal-width: 760px;
    z-index: 100030;
}

body.fs-popt-open .modal-backdrop {
    --bs-backdrop-zindex: 100020;
    z-index: 100020;
}

.fs-popt-modal .fs-popt__dialog {
    max-width: 760px;
}

.fs-popt-modal .fs-popt {
    position: relative;
    border: 0;
    border-radius: var(--appearance-card-border-radius, 12px);
    background: #fff;
    color: #111827;
    box-shadow: 0 30px 80px -20px rgba(15, 23, 42, .45);
}

.fs-popt__close {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    color: #6b7280;
    font-size: 18px;
    cursor: pointer;
}

.fs-popt__body {
    padding: 24px;
}

.fs-popt__grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 24px;
}

.fs-popt__media {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--appearance-card-border-radius, 8px);
    background: #f6f7f9;
}

.fs-popt__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fs-popt__info {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.fs-popt__title {
    margin: 0;
    padding-inline-end: 32px;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
}

.fs-popt__price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: -6px;
    font-size: 20px;
}

.fs-popt__price strong {
    color: #16a34a;
}

.fs-popt__price del {
    color: #9ca3af;
    font-size: 15px;
}

.fs-popt__stock {
    margin-top: -8px;
    font-size: 13px;
    font-weight: 600;
}

.fs-popt__stock.is-in { color: #16a34a; }
.fs-popt__stock.is-out { color: #dc2626; }

.fs-popt__group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fs-popt__label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.fs-popt__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fs-popt__chip {
    min-height: 36px;
    padding: 6px 14px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #111827;
    font-size: 13.5px;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.fs-popt__chip:hover {
    border-color: #111827;
}

.fs-popt__chip.is-selected {
    border-color: var(--card-cart-btn-bg, #0d8255);
    background: color-mix(in srgb, var(--card-cart-btn-bg, #0d8255) 10%, #fff);
    color: var(--card-cart-btn-bg, #0d8255);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px var(--card-cart-btn-bg, #0d8255);
}

.fs-popt__chip.is-unavailable {
    border-style: dashed;
    color: #9ca3af;
    text-decoration: line-through;
}

.fs-popt__group.is-missing .fs-popt__chips {
    animation: fs-popt-shake .4s ease;
}

@keyframes fs-popt-shake {
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.fs-popt__input {
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: var(--appearance-input-border-radius, 6px);
}

.fs-popt__warning {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 13px;
}

.fs-popt__qty {
    display: inline-flex;
    align-self: flex-start;
    overflow: hidden;
    border: 1px solid #d1d5db;
    border-radius: var(--appearance-input-border-radius, 6px);
}

.fs-popt__qty button {
    width: 38px;
    border: 0;
    background: #f3f4f6;
    font-size: 18px;
    cursor: pointer;
}

.fs-popt__qty input {
    width: 54px;
    height: 38px;
    border: 0;
    text-align: center;
    -moz-appearance: textfield;
}

.fs-popt__qty input::-webkit-inner-spin-button,
.fs-popt__qty input::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.fs-popt__error {
    margin: 0;
    color: #dc2626;
    font-size: 13px;
}

.fs-popt__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.fs-popt__actions .fs-pcard__btn {
    min-height: 44px;
    font-size: 14px;
}

/* The action clicked on the card comes first. */
.fs-popt__actions .is-intent {
    order: -1;
}

.fs-popt__details {
    align-self: flex-start;
    color: #6b7280;
    font-size: 13px;
    text-decoration: underline;
}

.fs-popt__loading {
    display: grid;
    place-items: center;
    min-height: 260px;
}

.fs-popt__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--card-cart-btn-bg, #0d8255);
    border-radius: 50%;
    animation: fs-pcard-spin .7s linear infinite;
}

body[data-theme="dark"] .fs-popt-modal .fs-popt {
    background: #1b1f27;
    color: #f3f4f6;
}

body[data-theme="dark"] .fs-popt__label { color: #d1d5db; }

body[data-theme="dark"] .fs-popt__chip,
body[data-theme="dark"] .fs-popt__input,
body[data-theme="dark"] .fs-popt__qty input {
    border-color: #3a4150;
    background: #222733;
    color: #f3f4f6;
}

body[data-theme="dark"] .fs-popt__qty,
body[data-theme="dark"] .fs-popt__qty button {
    border-color: #3a4150;
    background: #2a303c;
    color: #f3f4f6;
}

@media (max-width: 767.98px) {
    .fs-popt__body {
        padding: 18px 16px 20px;
    }

    .fs-popt__grid {
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 6px 14px;
    }

    .fs-popt__media {
        grid-row: 1 / span 3;
        align-self: start;
    }

    .fs-popt__info > .fs-popt__group,
    .fs-popt__info > .fs-popt__actions {
        margin-top: 8px;
    }

    /* Below the thumbnail row, everything spans the full width. */
    .fs-popt__info {
        display: contents;
    }

    .fs-popt__info > :not(.fs-popt__title):not(.fs-popt__price):not(.fs-popt__stock) {
        grid-column: 1 / -1;
    }

    .fs-popt__title,
    .fs-popt__price,
    .fs-popt__stock {
        grid-column: 2;
    }

    .fs-popt__title { font-size: 16px; }
    .fs-popt__price { margin-top: 0; font-size: 17px; }
    .fs-popt__stock { margin-top: 0; }
}
