/* =====================================================================
   electro_storefront — product layer (4 of 6)

   Covers the shop layout (sidebar + main), the product detail page
   (gallery / summary / price / tabs / reviews), sidebar widgets and
   product cards (grid + carousel), all following the Electro reference.
   ===================================================================== */

/* ----------------------------------------------------------- shop layout */
.sf-shop-layout {
    display: grid;
    grid-template-columns: var(--sf-sidebar-width) minmax(0, 1fr);
    gap: var(--sf-gutter);
    align-items: start;
}

.sf-shop-layout.is-full-width { grid-template-columns: minmax(0, 1fr); }
.sf-shop-main { min-width: 0; }
/* --------------------------------------------------------------- widgets */
.sf-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--sf-gutter);
    position: sticky;
    top: 20px;
}

.sf-widget {
    background: var(--sf-body-bg);
    border: 1px solid var(--sf-border);
}

/* Electro widget title: underline + short yellow tick */
.sf-widget__title {
    position: relative;
    font-size: 1.214em;
    font-weight: 500;
    padding: 0.85em 1em 0.75em;
    margin: 0;
    border-bottom: 1px solid var(--sf-border);
}

.sf-widget__title::after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    bottom: -1px;
    width: 83px;
    height: 2px;
    background: var(--sf-primary);
}

.sf-cat-list {
    margin: 0;
    padding: 6px 0;
}

.sf-cat-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 16px 9px 14px;
    color: var(--sf-text);
}

.sf-cat-list li + li a {
    border-top: 1px solid #f0f0f0;
}

.sf-cat-list a:hover {
    background: #f5f5f5;
    font-weight: 700;
    text-decoration: none;
}

/* ------------------------------------------------------- price filter */
.sf-price-filter {
    padding: 1em;
}

.sf-price-filter__inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1em;
}

.sf-price-filter__inputs label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.786em;
    color: var(--sf-secondary);
}

.sf-price-filter .sf-btn {
    min-height: 42px;
}

/* --------------------------------------------------- mini products widget */
.sf-mini-products {
    margin: 0;
    padding: 10px 14px;
}

.sf-mini-product {
    display: flex;
    gap: 12px;
    padding: 10px 0;
}

.sf-mini-product + .sf-mini-product {
    border-top: 1px solid #f0f0f0;
}

.sf-mini-product__media {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border: 1px solid var(--sf-border);
    display: grid;
    place-items: center;
    overflow: hidden;
}

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

.sf-mini-product__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.sf-mini-product__title {
    font-size: 0.929em;
    font-weight: 400;
    margin: 0;
}

.sf-mini-product__title a:hover {
    text-decoration: underline;
}

.sf-mini-product .sf-price {
    font-size: 1em;
}

/* ----------------------------------------------------------- tag cloud */
.sf-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 1em;
}

.sf-tag {
    display: inline-flex;
    padding: 0.25em 0.8em;
    background: #f5f5f5;
    color: var(--sf-secondary);
    font-size: 0.786em;
    border-radius: var(--sf-radius-sm);
}

.sf-tag:hover {
    background: var(--sf-primary);
    color: #000;
    text-decoration: none;
}

/* ================================================================ PDP */
.sf-pdp {
    background: var(--sf-body-bg);
    border: 1px solid var(--sf-border);
    padding: 30px;
}

.sf-pdp__layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 34px;
}

/* ------------------------------------------------------------- gallery */
.sf-gallery {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 14px;
}

.sf-gallery__thumbs {
    display: flex;
    flex-direction: row;
    order: 2;
    gap: 10px;
    overflow-x: auto;
    flex: 0 0 auto;
}

.sf-thumb {
    position: relative;
    width: 68px;
    height: 68px;
    flex-shrink: 0;
    background: var(--sf-body-bg);
    border: 1px solid var(--sf-border);
    padding: 5px;
    overflow: hidden;
    transition: border-color var(--sf-transition);
}

.sf-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sf-thumb:hover {
    border-color: var(--sf-dark);
}

.sf-thumb.is-active {
    border: 2px solid var(--sf-primary);
    padding: 4px;
}

.sf-gallery__main {
    position: relative;
    flex: 1;
    border: 1px solid var(--sf-border);
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.sf-gallery__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 160ms ease;
}

.sf-gallery__zoom { position: absolute; inset-block-start: 10px; inset-inline-end: 10px; z-index: 6; }
.sf-gallery__main.has-broken-media .sf-gallery__zoom { display: none; }
.sf-gallery-dialog { border: 0; border-radius: 8px; padding: 16px; width: min(90vw, 1000px); max-height: 90vh; background: var(--sf-surface); }
.sf-gallery-dialog::backdrop { background: rgba(0,0,0,.7); }
.sf-gallery-dialog img { width: 100%; max-height: 75vh; object-fit: contain; }
.sf-gallery-dialog button { display: flex; margin-inline-start: auto; margin-block-end: 6px; }
[data-image-zoom="1"] .sf-gallery__image { cursor: zoom-in; transform-origin: var(--sf-zoom-x, 50%) var(--sf-zoom-y, 50%); }
.sf-gallery__main.is-zooming .sf-gallery__image { transform: scale(2); }
.sf-gallery-dialog__viewport { overflow: auto; max-height: 68vh; }
.sf-gallery-dialog.is-zoomed img { width: 200%; max-width: none; max-height: none; height: auto; }
.sf-gallery-dialog [data-sf-gallery-toggle] { margin-block-end: 8px; }


.sf-gallery__placeholder {
    color: var(--sf-secondary);
}

.sf-badge--sale {
    position: absolute;
    top: 14px;
    inset-inline-start: 14px;
    z-index: 5;
}

/* ------------------------------------------------------------- summary */
.sf-summary {
    min-width: 0;
}

.sf-summary__title {
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0 0 0.6em;
}

.sf-summary__rating {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.2em;
}

.sf-summary__reviews-link {
    font-size: 0.857em;
    color: var(--sf-secondary);
    text-decoration: underline;
}

.sf-summary__reviews-link:hover {
    color: var(--sf-dark);
}

.sf-price-box {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.75em;
    margin-bottom: 1em;
}

.sf-price--large {
    font-size: 1.714em;
    font-weight: 600;
}

.sf-price-box .sf-price-old {
    font-size: 1.071em;
}

.sf-price-save {
    font-size: 0.786em;
    font-weight: 700;
    color: #fff;
    background: var(--sf-badge-sale-bg);
    padding: 0.25em 0.7em;
}

.sf-availability {
    font-weight: 600;
    margin: 0 0 1.2em;
}

.sf-availability.is-in-stock {
    color: var(--sf-success);
}

.sf-availability.is-out-of-stock {
    color: var(--sf-danger);
}

.sf-summary__short {
    color: var(--sf-text-muted);
    font-size: 0.929em;
    margin-bottom: 1.4em;
}

.sf-summary__short ul {
    padding-inline-start: 1.2em;
    margin: 0.8em 0 0;
}

.sf-summary__short li {
    list-style: disc;
    margin-bottom: 0.35em;
}

/* buy row */
.sf-summary__actions {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 1.6em;
}

/* ----------------------------------------------------------- qty stepper */
.sf-qty {
    display: inline-flex;
    border: 1px solid var(--sf-border);
    background: var(--sf-body-bg);
}

.sf-qty__btn {
    width: 44px;
    align-self: stretch;
    background: transparent;
    border: 0;
    color: var(--sf-dark);
    font-size: 1.2em;
    font-weight: 600;
    transition: background-color var(--sf-transition);
}

.sf-qty__btn:hover {
    background: #f5f5f5;
}

.sf-qty__input {
    width: 56px;
    border: 0;
    border-inline: 1px solid var(--sf-border);
    text-align: center;
    font-family: inherit;
    font-size: 1em;
    font-weight: 600;
    color: var(--sf-text);
    min-height: 46px;
    -moz-appearance: textfield;
}

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

/* ----------------------------------------------------------------- meta */
.sf-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    border-top: 1px solid var(--sf-border);
    padding-top: 1.2em;
    margin: 0;
    font-size: 0.857em;
    color: var(--sf-secondary);
}

.sf-meta__row {
    display: flex;
    gap: 8px;
}

.sf-meta__row dt {
    min-width: 64px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.3px;
}

.sf-meta__row dd {
    margin: 0;
    color: var(--sf-text);
}

.sf-meta__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sf-meta__tags a {
    color: var(--sf-secondary);
    text-decoration: underline;
}

/* ============================================================ tabs */
.sf-tabs {
    margin-top: 34px;
}

.sf-tabs__nav {
    display: flex;
    gap: 2.14em;
    border-bottom: 1px solid var(--sf-border);
    margin: 0;
    padding: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.sf-tabs__nav::-webkit-scrollbar {
    display: none;
}

.sf-tabs__nav li {
    flex-shrink: 0;
}

.sf-tabs__nav a {
    position: relative;
    display: block;
    padding: 0 0.2em 1em;
    font-size: 1.286em;
    line-height: 1;
    color: var(--sf-text);
    white-space: nowrap;
}

.sf-tabs__nav a:hover {
    text-decoration: none;
    color: var(--sf-dark);
}

.sf-tabs__nav li.is-active a {
    font-weight: 700;
}

/* yellow tick under the active tab (Electro signature) */
.sf-tabs__nav li.is-active a::before {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 4px;
    border-radius: 0 0 10px 10px;
    background: var(--sf-primary);
}

/* white gap that interrupts the gray line under the active tab */
.sf-tabs__nav li.is-active a::after {
    content: "";
    position: absolute;
    bottom: -1px;
    inset-inline: -0.2em;
    border-bottom: 2px solid var(--sf-body-bg);
}

.sf-tabs__panels {
    padding-top: 1.6em;
}

.sf-tab-panel {
    display: none;
}

.sf-tab-panel.is-active {
    display: block;
    animation: sf-tab-in 200ms ease;
}

@keyframes sf-tab-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sf-tab-panel__title {
    font-size: 1.143em;
    margin-bottom: 1em;
}

/* description prose */
.sf-prose {
    max-width: 75ch;
    color: var(--sf-text);
}

.sf-prose ul {
    padding-inline-start: 1.3em;
    margin: 0 0 1em;
}

.sf-prose li {
    list-style: disc;
    margin-bottom: 0.4em;
}

/* specification table */
.sf-spec-table {
    width: 100%;
    border-collapse: collapse;
    max-width: 720px;
}

.sf-spec-table th,
.sf-spec-table td {
    border: 1px solid var(--sf-border);
    padding: 10px 14px;
    font-size: 0.929em;
    text-align: start;
}

.sf-spec-table th {
    background: #f5f5f5;
    width: 42%;
    font-weight: 600;
}

/* ------------------------------------------------------------ reviews */
.sf-reviews {
    margin: 0 0 2em;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sf-review {
    border: 1px solid var(--sf-border);
    padding: 16px 18px;
}

.sf-review__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.sf-review__author {
    font-size: 0.929em;
}

.sf-review__date {
    font-size: 0.786em;
    color: var(--sf-secondary);
}

.sf-review .sf-stars {
    display: block;
    margin-bottom: 8px;
}

.sf-review__text {
    margin: 0;
    color: var(--sf-text);
}

.sf-review--empty {
    color: var(--sf-secondary);
    padding: 18px;
}

/* review form */
.sf-review-form {
    border: 1px solid var(--sf-border);
    padding: 22px;
    max-width: 640px;
}

.sf-review-form__rating {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.2em;
    flex-wrap: wrap;
}

.sf-review-form__label {
    font-size: 0.857em;
    font-weight: 600;
    color: var(--sf-text);
}

.sf-rate-input {
    display: inline-flex;
}

.sf-rate-input__star {
    border: 0;
    background: transparent;
    color: #dadada;
    font-size: 1.35em;
    line-height: 1;
    padding: 0 2px;
    transition: color var(--sf-transition);
}

.sf-rate-input__star.is-filled {
    color: var(--sf-star);
}

.sf-review-form__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 1.2em;
}

/* ============================================================== related */
/* The related grid is a .sf-rail (owned by cards.css); only page
   spacing lives here. */
.sf-related {
    max-width: var(--sf-container);

    margin-top: 3.5em;
}

.sf-purchase-guidance { color: var(--sf-text-muted); margin-block: 0.6rem; }
.sf-mobile-purchase { display: none; }
@media (max-width: 767px) {
    .sf-mobile-purchase { display: block; position: fixed; inset-inline: 12px; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); z-index: 790; }
    .sf-mobile-purchase .sf-btn { width: 100%; box-shadow: var(--sf-shadow-md); }
    .sf-pdp-page { padding-bottom: 55px; }
}
