﻿/* Main product image only */
.product-images .main-image-container {
    width: 100%;
    height: 520px;
    min-height: 520px;
    max-height: 520px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-images .image-zoom-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-images .main-image-container .main-image,
.product-images .main-image-container #main-product-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Responsive */
@media (max-width: 991.98px) {
    .product-images .main-image-container {
        height: 420px;
        min-height: 420px;
        max-height: 420px;
    }
}

@media (max-width: 575.98px) {
    .product-images .main-image-container {
        height: 320px;
        min-height: 320px;
        max-height: 320px;
    }
}

/* Quantity control follows Smart Theme Engine */
#qty-control button {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--default-color);
    height: 34px;
}

    #qty-control button:hover {
        background-color: color-mix(in srgb, var(--accent-color), transparent 88%);
        border-color: var(--accent-color);
        color: var(--accent-color);
    }

    #qty-control button:focus-visible {
        outline: none;
        box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--accent-color), transparent 75%);
    }

    #qty-control button:disabled {
        background-color: color-mix(in srgb, var(--default-color), transparent 92%);
        border-color: var(--border-color);
        color: var(--muted-color);
    }

    #qty-control button i,
    #qty-control button .bi::before {
        color: inherit;
    }

/* Size variants - dynamic layout + Smart Theme Engine */
.product-sizes .size-options {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items: flex-start !important;
}

.product-sizes .size-option {
    width: auto !important;
    height: auto !important;
    min-width: 44px !important;
    min-height: 40px !important;
    max-width: 100% !important;
    padding: 8px 14px !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    word-break: break-word !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 1 auto !important;
    text-align: center !important;
    border: 1px solid var(--border-color) !important;
    background-color: var(--surface-color) !important;
    color: var(--default-color) !important;
    transition: all 0.2s ease;
}

    .product-sizes .size-option:hover,
    .product-sizes .size-option.active {
        background-color: var(--accent-color) !important;
        border-color: var(--accent-color) !important;
        color: var(--contrast-color) !important;
    }

    .product-sizes .size-option:focus-visible {
        outline: none !important;
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color), transparent 70%) !important;
    }

    .product-sizes .size-option.disabled,
    .product-sizes .size-option:disabled {
        opacity: 0.45;
        cursor: not-allowed;
        background-color: color-mix(in srgb, var(--default-color), transparent 92%) !important;
        border-color: var(--border-color) !important;
        color: var(--muted-color) !important;
    }

.product-sizes .selected-option {
    display: block;
    margin-top: 8px;
}

@media (max-width: 767.98px) {
    #product-details,
    #product-details .product-images,
    #product-details .main-image-container,
    #product-details .image-zoom-container {
        overflow: visible !important;
        touch-action: auto !important;
    }

        #product-details #main-product-image {
            pointer-events: none !important;
            touch-action: auto !important;
            -webkit-user-drag: none;
            user-select: none;
        }
}

.product-inline-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    min-width: 0;
}

    .product-inline-breadcrumb a {
        color: var(--accent-color);
        font-size: 14px;
        font-weight: 500;
        text-decoration: none;
        overflow-wrap: anywhere;
        transition: color .2s ease;
    }

        .product-inline-breadcrumb a:hover,
        .product-inline-breadcrumb a:focus-visible {
            color: var(--heading-color);
            text-decoration: underline;
            text-underline-offset: 3px;
        }

.breadcrumb-separator {
    display: inline-flex;
    align-items: center;
    color: var(--muted-color);
    font-size: 10px;
    line-height: 1;
    opacity: .7;
}

@media (max-width: 575.98px) {
    .product-inline-breadcrumb a {
        font-size: 13px;
    }
}

/* Smart Color Family UI - active only when total shade count is > 15 */
.product-colors.color-family-mode .color-family-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.product-colors.color-family-mode .color-family-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--surface-color);
    color: var(--default-color);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s ease;
}

    .product-colors.color-family-mode .color-family-btn:hover,
    .product-colors.color-family-mode .color-family-btn.active {
        background: var(--accent-color);
        border-color: var(--accent-color);
        color: var(--contrast-color);
    }

.product-colors.color-family-mode .color-family-count {
    font-size: 11px;
    opacity: .75;
}

.product-colors.color-family-mode .color-family-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    color: var(--heading-color);
}

.product-colors.color-family-mode .color-family-title {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.product-colors.color-family-mode .color-family-heading::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--border-color);
}

.product-colors.color-family-mode .color-family-total {
    order: 3;
    color: var(--muted-color);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    white-space: nowrap;
}

/* Milad-style shade grid. The original compact swatch rules are untouched;
   these overrides exist only while .color-family-mode is active. */
.product-colors.color-family-mode .color-options {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 18px 14px !important;
    align-items: start !important;
}

.product-colors.color-family-mode .color-option.family-hidden,
.product-colors.color-family-mode .color-swatch.family-hidden {
    display: none !important;
}

.product-colors.color-family-mode .color-option,
.product-colors.color-family-mode .color-swatch {
    position: relative !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 105px !important;
    padding: 0 4px 42px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    overflow: visible !important;
    color: var(--default-color) !important;
}

    .product-colors.color-family-mode .color-option::before,
    .product-colors.color-family-mode .color-swatch::before {
        content: "";
        display: block;
        width: 58px;
        height: 58px;
        flex: 0 0 58px;
        border-radius: 50%;
        background: var(--swatch-color, #fff);
        border: 1px solid var(--border-color);
        box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--default-color), transparent 94%);
    }

    .product-colors.color-family-mode .color-option::after,
    .product-colors.color-family-mode .color-swatch::after {
        content: attr(data-label);
        white-space: pre-line;
        position: absolute;
        top: 66px;
        left: 2px;
        right: 2px;
        text-align: center;
        color: var(--default-color);
        font-size: 11px;
        line-height: 1.25;
        font-weight: 500;
        word-break: break-word;
    }

    .product-colors.color-family-mode .color-option:hover::before,
    .product-colors.color-family-mode .color-swatch:hover::before {
        transform: scale(1.04);
    }

    .product-colors.color-family-mode .color-option.active::before,
    .product-colors.color-family-mode .color-swatch.active::before {
        outline: 3px solid color-mix(in srgb, var(--accent-color), transparent 35%);
        outline-offset: 2px;
    }

    .product-colors.color-family-mode .color-option .swatch-check,
    .product-colors.color-family-mode .color-swatch .swatch-check {
        position: absolute !important;
        top: 20px !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
        color: var(--contrast-color) !important;
        text-shadow: 0 1px 2px rgba(0,0,0,.45);
        pointer-events: none;
    }

.product-colors.color-family-mode .selected-option {
    display: none;
}

@media (max-width: 575.98px) {
    .product-colors.color-family-mode .color-family-filter {
        gap: 6px;
    }

    .product-colors.color-family-mode .color-family-btn {
        min-height: 32px;
        padding: 6px 10px;
        font-size: 12px;
    }

    .product-colors.color-family-mode .color-options {
        grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
        gap: 16px 10px !important;
    }

    .product-colors.color-family-mode .color-option::before,
    .product-colors.color-family-mode .color-swatch::before {
        width: 50px;
        height: 50px;
        flex-basis: 50px;
    }

    .product-colors.color-family-mode .color-option::after,
    .product-colors.color-family-mode .color-swatch::after {
        top: 58px;
        font-size: 10px;
    }
}

/* Color availability by selected size
   ---------------------------------------------------------------
   A color can exist for the product but not for the currently
   selected size. Keep it clickable, but mark it clearly with a
   diagonal slash plus a short explanatory legend.
   --------------------------------------------------------------- */

/* Compact color selector (15 colors or fewer) */
.product-colors:not(.color-family-mode) .color-option.not-current-size,
.product-colors:not(.color-family-mode) .color-swatch.not-current-size {
    position: relative;
    opacity: 0.52;
    filter: grayscale(55%) saturate(45%);
    outline: 2px dashed var(--border-color);
    outline-offset: 2px;
    cursor: pointer;
}

    /* Diagonal slash. An X is intentionally avoided because the swatch
   remains selectable. */
    .product-colors:not(.color-family-mode) .color-option.not-current-size::after,
    .product-colors:not(.color-family-mode) .color-swatch.not-current-size::after {
        content: "";
        position: absolute;
        left: 8%;
        top: 48%;
        width: 84%;
        height: 2px;
        border-radius: 999px;
        background: var(--default-color);
        box-shadow: 0 0 0 1px color-mix(in srgb, var(--surface-color), transparent 45%);
        transform: rotate(-45deg);
        transform-origin: center;
        pointer-events: none;
        z-index: 3;
    }

    .product-colors:not(.color-family-mode) .color-option.not-current-size:hover,
    .product-colors:not(.color-family-mode) .color-swatch.not-current-size:hover,
    .product-colors:not(.color-family-mode) .color-option.not-current-size:focus-visible,
    .product-colors:not(.color-family-mode) .color-swatch.not-current-size:focus-visible {
        opacity: 0.78;
        filter: grayscale(25%) saturate(70%);
    }

/* >15 color-family selector.
   ::before is already the circular color sample, so draw the slash
   directly into that circle as a layered background. The existing
   ::after name/code label stays fully readable. */
.product-colors.color-family-mode .color-option.not-current-size::before,
.product-colors.color-family-mode .color-swatch.not-current-size::before {
    opacity: 0.52;
    filter: grayscale(55%) saturate(45%);
    outline: 2px dashed var(--border-color);
    outline-offset: 3px;
    background: linear-gradient( -45deg, transparent 46%, var(--default-color) 47%, var(--default-color) 53%, transparent 54% ), var(--swatch-color, #fff) !important;
}

.product-colors.color-family-mode .color-option.not-current-size:hover::before,
.product-colors.color-family-mode .color-swatch.not-current-size:hover::before,
.product-colors.color-family-mode .color-option.not-current-size:focus-visible::before,
.product-colors.color-family-mode .color-swatch.not-current-size:focus-visible::before {
    opacity: 0.78;
    filter: grayscale(25%) saturate(70%);
}

/* Keep the text readable in family mode even when its shade is unavailable. */
.product-colors.color-family-mode .color-option.not-current-size::after,
.product-colors.color-family-mode .color-swatch.not-current-size::after {
    opacity: 1;
}

/* Explanatory note - injected once by Details.js and displayed only
   when the selected size has at least one unavailable color. */
.product-colors .color-size-availability-note {
    display: none;
    align-items: center;
    gap: 7px;
    margin-top: 7px;
    color: var(--muted-color);
    font-size: 12px;
    line-height: 1.35;
}

    .product-colors .color-size-availability-note.is-visible {
        display: flex;
    }

.product-colors .color-size-availability-symbol {
    position: relative;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border: 1px solid var(--muted-color);
    border-radius: 50%;
    opacity: .85;
}

    .product-colors .color-size-availability-symbol::after {
        content: "";
        position: absolute;
        left: 1px;
        top: 6px;
        width: 12px;
        height: 1.5px;
        border-radius: 999px;
        background: var(--muted-color);
        transform: rotate(-45deg);
        transform-origin: center;
    }

@media (max-width: 575.98px) {
    .product-colors .color-size-availability-note {
        font-size: 11px;
        gap: 6px;
        margin-top: 6px;
    }
}


.product-thumbnails .product-thumbnails-slider {
    width: 100%;
    overflow: hidden;
}

.product-thumbnails .swiper-wrapper {
    display: flex;
}

.product-thumbnails .thumbnail-item {
    flex: 0 0 calc((100% - 30px) / 4);
    width: calc((100% - 30px) / 4);
    height: 100px;
    overflow: hidden;
}

    .product-thumbnails .thumbnail-item img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

@media (max-width: 575px) {
    .product-thumbnails .thumbnail-item {
        flex-basis: calc((100% - 20px) / 3);
        width: calc((100% - 20px) / 3);
    }
}
