/* =====================================================================
   electro_storefront — shopping cart (phase 2)

   Rows are rendered client-side by js/pages/cart-page.js using the
   .sf-cart-item contract; this sheet owns both the static skeleton
   and the JS-rendered rows.
   ===================================================================== */

.sf-cart-page {
    padding-block: 1.4em 3em;
    max-width: var(--sf-container);
    margin-inline: auto;
}

/* ------------------------------------------------------------ progress */
.sf-cart-progress {
    margin-block-end: 1.6em;
}

.sf-progress-steps {
    position: relative;
    display: flex;
    justify-content: center;
    gap: clamp(18px, 6vw, 72px);
    padding-block: 4px;
}

.sf-progress-connector {
    position: absolute;
    top: 17px;
    inset-inline: 12%;
    height: 2px;
    background: var(--sf-border);
    z-index: 0;
}

.sf-progress-step {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sf-progress-step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--sf-border);
    color: var(--sf-text-muted);
    font-size: 13px;
    font-weight: 700;
}

.sf-progress-step__label {
    font-size: 13px;
    color: var(--sf-text-muted);
}

.sf-progress-step.is-active .sf-progress-step__num {
    background: var(--sf-primary);
    border-color: var(--sf-primary);
    color: #000;
}

.sf-progress-step.is-active .sf-progress-step__label {
    color: var(--sf-dark);
    font-weight: 600;
}

/* ------------------------------------------------------------- header */
.sf-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-block-end: 1.4em;
}

.sf-cart-subtitle {
    margin: .3em 0 0;
    font-size: 13px;
    color: var(--sf-text-muted);
}

.sf-cart-continue {
    min-height: 42px;
    font-size: 13px;
}

/* -------------------------------------------------------- empty state */
.sf-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding: 70px 24px;
    background: #fff;
    border: 1px dashed var(--sf-border);
    border-radius: var(--sf-radius);
    color: var(--sf-text-muted);
}

.sf-cart-empty svg {
    color: #c9d2da;
}

.sf-cart-empty h2 {
    font-size: 1.25em;
    font-weight: 500;
    color: var(--sf-dark);
    margin: 0;
}

.sf-cart-empty p {
    max-width: 460px;
    font-size: 13.5px;
    line-height: 1.6;
    margin: 0;
}

.sf-cart-empty .sf-btn {
    min-height: 44px;
    margin-block-start: 8px;
}

/* -------------------------------------------------------------- grid */
.sf-cart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 26px;
    align-items: start;
}

.sf-cart-items-col {
    min-width: 0;
}

.sf-cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding-inline: 7px;
    margin-inline-start: 8px;
    background: var(--sf-primary);
    color: #000;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
    vertical-align: middle;
}

/* -------------------------------------------------------------- rows */
.sf-cart-item {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) auto minmax(110px, auto) 44px;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--sf-border);
    border-radius: var(--sf-radius);
    transition: opacity .2s ease;
}

.sf-cart-item + .sf-cart-item {
    margin-block-start: 12px;
}

.sf-cart-item.is-updating {
    opacity: .55;
    pointer-events: none;
}

.sf-cart-item__media {
    width: 88px;
    height: 88px;
    background: #fafafa;
    border: 1px solid var(--sf-border);
    border-radius: var(--sf-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sf-cart-item__media img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sf-cart-item__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c3ccd4;
}

.sf-cart-item__placeholder svg {
    width: 44%;
    height: auto;
}

.sf-cart-item__info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sf-cart-item__name {
    font-size: 14px;
    font-weight: 500;
    color: var(--sf-dark);
    margin: 0;
    line-height: 1.45;
}

.sf-cart-item__code {
    font-size: 11.5px;
    color: var(--sf-text-muted);
    margin: 0;
}

.sf-cart-item__price {
    font-size: 13px;
    color: var(--sf-text);
    font-weight: 600;
}

.sf-cart-item__stock {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--sf-text-muted);
}

.sf-cart-item__stock i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sf-success);
    flex-shrink: 0;
}

.sf-cart-item__stock.is-unavailable i {
    background: var(--sf-danger);
}

.sf-cart-item__stock.is-unavailable {
    color: var(--sf-danger);
}

/* qty stepper (same contract as the PDP .sf-qty) */
.sf-cart-item .sf-qty {
    display: inline-flex;
    border: 1px solid var(--sf-border);
    border-radius: var(--sf-radius);
    background: #fff;
    overflow: hidden;
}

.sf-cart-item__qty-btn {
    width: 36px;
    height: 38px;
    background: #fff;
    border: 0;
    color: var(--sf-dark);
    font-size: 16px;
    cursor: pointer;
    transition: background .15s ease;
}

.sf-cart-item__qty-btn:hover {
    background: #f2f2f2;
}

.sf-cart-item__qty-input {
    width: 48px;
    height: 38px;
    border: 0;
    border-inline: 1px solid var(--sf-border);
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--sf-dark);
    -moz-appearance: textfield;
}

.sf-cart-item__qty-input::-webkit-outer-spin-button,
.sf-cart-item__qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sf-cart-item__qty-input:focus {
    outline: 2px solid var(--sf-primary-active);
    outline-offset: -2px;
}

.sf-cart-item__total {
    font-size: 15px;
    font-weight: 700;
    color: var(--sf-dark);
    text-align: end;
    white-space: nowrap;
}

.sf-cart-item__remove {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--sf-radius);
    color: var(--sf-text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.sf-cart-item__remove:hover {
    color: #fff;
    background: var(--sf-danger);
    border-color: var(--sf-danger);
}

/* ------------------------------------------------------- summary card */
.sf-summary-card {
    background: #fff;
    border: 1px solid var(--sf-border);
    border-radius: var(--sf-radius);
}

.sf-summary-card__head {
    padding: 14px 18px;
    border-block-end: 1px solid var(--sf-border);
}

.sf-summary-card__head h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--sf-dark);
}

.sf-summary-card__body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sf-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
    color: var(--sf-text-muted);
}

.sf-summary-row span {
    min-width: 0;
}

.sf-summary-row[id] {
    color: var(--sf-dark);
    font-weight: 600;
}

.sf-summary-total {
    font-size: 16px;
    font-weight: 700;
    color: var(--sf-dark);
}

.sf-summary-divider {
    height: 1px;
    background: var(--sf-border);
}

/* ------------------------------------------------------------- coupon */
.sf-summary-coupon {
    flex-wrap: wrap;
}

.sf-coupon-input {
    display: flex;
    gap: 8px;
    width: 100%;
}

.sf-coupon-input .sf-input {
    flex: 1;
    min-width: 0;
    font-size: 13px;
}

.sf-coupon-input .sf-btn {
    min-height: 40px;
    font-size: 13px;
}

.sf-coupon-message {
    font-size: 12.5px;
    line-height: 1.5;
    width: 100%;
}

.sf-coupon-message.is-success {
    color: var(--sf-success);
}

.sf-coupon-message.is-error {
    color: var(--sf-danger);
}

.sf-summary-coupon-applied {
    color: var(--sf-success);
    flex-wrap: wrap;
}

.sf-summary-coupon-applied .sf-coupon-value {
    font-weight: 600;
}

.sf-coupon-remove {
    background: none;
    border: 0;
    color: var(--sf-text-muted);
    font-size: 13px;
    cursor: pointer;
}

.sf-coupon-remove:hover {
    color: var(--sf-danger);
}

/* ----------------------------------------------------------- checkout */
.sf-cart-checkout {
    min-height: 48px;
    font-size: 15px;
    font-weight: 700;
}

.sf-cart-note {
    font-size: 12px;
    line-height: 1.6;
    color: var(--sf-text-muted);
    text-align: center;
}

/* -------------------------------------------------------------- trust */
.sf-cart-trust {
    margin-block-start: 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #fff;
    border: 1px solid var(--sf-border);
    border-radius: var(--sf-radius);
    padding: 6px 18px;
}

.sf-cart-trust__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-block: 12px;
    color: var(--sf-primary-active);
}

.sf-cart-trust__item + .sf-cart-trust__item {
    border-block-start: 1px solid #f2f2f2;
}

.sf-cart-trust__item strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--sf-dark);
}

.sf-cart-trust__item small {
    display: block;
    font-size: 12px;
    color: var(--sf-text-muted);
}

/* ----------------------------------------------------------- skeleton */
.sf-cart-skeleton {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 26px;
    align-items: start;
}

.sf-cart-skel-row .sf-skeleton-card__img {
    aspect-ratio: 1 / 1;
    margin: 16px;
    max-width: 88px;
}

.sf-cart-skel-summary {
    min-height: 260px;
}

/* ---------------------------------------------------------- auth gate */
.sf-auth-gate {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: 440px;
    margin: auto;
}

.sf-auth-gate::backdrop {
    background: rgba(17, 24, 31, .55);
}

.sf-auth-gate.is-fallback-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 3000;
    overflow: auto;
}

.sf-auth-gate__card {
    position: relative;
    background: #fff;
    border-radius: var(--sf-radius);
    padding: 34px 30px 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    box-shadow: 0 18px 60px rgba(17, 24, 31, .25);
}

.sf-auth-gate__close {
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    width: 34px;
    height: 34px;
    background: none;
    border: 0;
    font-size: 20px;
    color: var(--sf-text-muted);
    cursor: pointer;
}

.sf-auth-gate__close:hover {
    color: var(--sf-danger);
}

.sf-auth-gate__icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--sf-primary);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sf-auth-gate__icon svg {
    width: 30px;
    height: 30px;
}

.sf-auth-gate__eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--sf-primary-active);
}

.sf-auth-gate__card h2 {
    font-size: 1.2em;
    font-weight: 600;
    margin: 0;
    color: var(--sf-dark);
}

.sf-auth-gate__card p {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--sf-text-muted);
    margin: 0;
}

.sf-auth-gate__actions {
    display: flex;
    gap: 10px;
    margin-block-start: 8px;
    width: 100%;
}

.sf-auth-gate__actions .sf-btn {
    flex: 1;
    min-height: 44px;
}

.sf-auth-gate__foot {
    font-size: 11.5px;
    color: var(--sf-text-muted);
}

/* --------------------------------------------------------- responsive */
@media (max-width: 991.98px) {
    .sf-cart-grid,
    .sf-cart-skeleton {
        grid-template-columns: minmax(0, 1fr);
    }

    .sf-progress-step__label {
        display: none;
    }

    .sf-progress-connector {
        inset-inline: 20%;
    }
}

@media (max-width: 767.98px) {
    .sf-cart-item {
        grid-template-columns: 72px minmax(0, 1fr);
        grid-template-areas:
            "media info"
            "media qty"
            "total total";
        row-gap: 10px;
    }

    .sf-cart-item__media { grid-area: media; width: 72px; height: 72px; }
    .sf-cart-item__info { grid-area: info; }
    .sf-cart-item .sf-qty { grid-area: qty; justify-self: start; }
    .sf-cart-item__total { grid-area: total; text-align: start; }
    .sf-cart-item__remove {
        position: absolute;
    }

    .sf-cart-item {
        position: relative;
    }

    .sf-cart-item__remove {
        top: 8px;
        inset-inline-end: 8px;
    }

    .sf-cart-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
