/* ============================================
   Product Detail Page
   ============================================ */

/* === Container === */
.product-container {
    max-width: 1100px;
    margin: 0 auto;
    overflow-x: hidden;
}

.product-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .product-detail {
        grid-template-columns: minmax(0, 1fr) 480px;
        gap: 3rem;
        max-width: 100%;
    }
}

/* === Gallery (Swiper) === */
.product-gallery {
    position: sticky;
    top: 5.5rem; /* header height: banner (~2rem) + nav (~3.5rem) */
    align-self: start;
    max-width: 100%;
    width: 100%;
}

.product-swiper {
    width: 100% !important;
    max-width: 100% !important;
    /* Keep the gallery stable while another colour's images are loading. */
    height: min(600px, calc((100vw - 2rem) * 4 / 3));
    border-radius: 0.75rem;
    overflow: hidden;
    background: #f8f8f8;
}

.product-swiper .swiper-wrapper {
    height: 100%;
    max-width: 100% !important;
}

.product-swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    overflow: hidden;
    height: 100%;
    width: 100% !important;
    max-width: 100% !important;
}

.product-swiper .swiper-slide img {
    width: 100%;
    max-width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.product-swiper .img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 4rem;
}

/* Swiper navigation */
.product-swiper .swiper-button-next,
.product-swiper .swiper-button-prev {
    color: #333;
    background: rgba(255, 255, 255, 0.85);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    backdrop-filter: blur(4px);
}

.product-swiper .swiper-button-next::after,
.product-swiper .swiper-button-prev::after {
    font-size: 16px;
    font-weight: bold;
}

.product-swiper .swiper-button-next:hover,
.product-swiper .swiper-button-prev:hover {
    background: rgba(255, 255, 255, 1);
}

/* Thumbnails */
.product-thumbs {
    margin-top: 0.5rem;
    padding: 0 2px;
}

.product-thumbs .swiper-slide {
    width: 56px;
    min-width: 56px;
    max-width: 56px;
    height: 74px;
    flex-shrink: 0;
    border-radius: 0.375rem;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    border: 2px solid transparent;
    background: #f8f8f8;
}

.product-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: var(--brand-500, #e04d75);
}

.product-thumbs .swiper-slide:hover {
    opacity: 0.8;
}

.product-thumbs .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* === Product Brand (над заголовком) === */
.product-brand {
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #888;
    padding-left: 2px;
}

@media (min-width: 1024px) {
    .product-brand {
        font-size: 1rem;
    }
}

@media (max-width: 767px) {
    .product-brand {
        font-size: 0.8rem;
    }
}

/* === Product Title (Full Width — над галереей) === */
.product-title-fullwidth {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    color: #1a1a1a;
    margin: 0 0 1.5rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

@media (min-width: 1024px) {
    .product-title-fullwidth {
        font-size: 1.75rem;
    }
}

@media (max-width: 767px) {
    .product-title-fullwidth {
        font-size: 1.25rem;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }
}

/* === Product Info === */
.product-info {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 600px;
}

.product-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    color: #1a1a1a;
    margin: 0;
}

@media (min-width: 1024px) {
    .product-title {
        font-size: 1.75rem;
    }
}

/* === Category Badges === */
.product-category-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    overflow: hidden;
    max-width: 100%;
}

.category-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 2rem;
    font-size: 0.8rem;
    color: #555;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

/* Mobile: limit badge width to viewport */
@media (max-width: 767px) {
    .product-category-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        overflow: hidden;
        max-width: 100%;
        min-width: 0;
    }
    
    .category-badge {
        max-width: calc(100vw - 3rem);
        flex-shrink: 1;
        min-width: 0;
    }
}

.category-badge:hover {
    background: #eee;
    border-color: #ccc;
    color: #333;
}

/* === Rating === */
.product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.rating-stars {
    display: flex;
    align-items: center;
    gap: 1px;
}

.rating-stars .star {
    font-size: 18px;
    color: #ddd;
}

.rating-stars .star.filled {
    color: #fbbd23;
}

.rating-stars .star.half {
    color: #fbbd23;
}

.rating-value {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.rating-count {
    font-size: 0.85rem;
    color: #888;
}

/* === Price === */
.product-price {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.price-current {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
}

.price-current.sale {
    color: #cc2d5a;
}

.price-original {
    font-size: 1.1rem;
    color: #999;
    text-decoration: line-through;
}

/* === Option Label === */
.option-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === Color Swatches === */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.color-swatch-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 2px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.2s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 12px;
}

.color-swatch-btn:hover {
    transform: scale(1.1);
}

.color-swatch-btn.active {
    border-color: var(--brand-500, #e04d75);
    box-shadow: 0 0 0 2px rgba(224, 77, 117, 0.2);
}

.color-swatch-btn.out-of-stock {
    opacity: 0.4;
    cursor: not-allowed;
}

.color-swatch-btn.out-of-stock:hover {
    transform: none;
}

.color-swatch-btn.size-unavailable {
    position: relative;
    cursor: not-allowed;
    opacity: 0.7;
}

.color-swatch-btn.size-unavailable::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 7%;
    right: 7%;
    height: 2px;
    background: #cc2d5a;
    transform: translateY(-50%) rotate(135deg);
    border-radius: 1px;
    pointer-events: none;
    z-index: 1;
}

.color-swatch-btn.size-unavailable:hover {
    transform: none;
}

/* === Link variant of color swatch (for other variant groups) === */
a.color-swatch-btn.color-swatch-link {
    text-decoration: none;
    color: inherit;
    display: flex;
}

.color-swatch-btn img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.swatch-text {
    font-size: 0.65rem;
    font-weight: 600;
    color: #555;
}

/* === Badge on Color Swatch === */
.color-swatch-badge {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.4375rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 2;
    line-height: 1.3;
    pointer-events: none;
    letter-spacing: 0.02em;
}

.color-swatch-badge--newcolor {
    background: #8b5cf6;
    color: #fff;
}

.color-swatch-badge--new {
    background: #cc2d5a;
    color: #fff;
}

.color-swatch-badge--topseller {
    background: #f59e0b;
    color: #fff;
}

.color-swatch-badge--newstyle {
    background: #3b82f6;
    color: #fff;
}

.color-swatch-badge--toprated {
    background: #10b981;
    color: #fff;
}

/* === Size Options === */
.size-options,
.size-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.size-row {
    margin-bottom: 0.5rem;
}

.size-btn {
    min-width: 48px;
    height: 44px;
    padding: 4px 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    background: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.size-btn .size-main {
    font-weight: 600;
    font-size: 0.85rem;
}

.size-btn .size-sub {
    font-size: 0.7rem;
    color: #888;
    font-weight: 400;
}

.size-btn.active .size-sub {
    color: rgba(255, 255, 255, 0.75);
}

.size-btn.available:hover {
    border-color: #333;
    background: #f8f8f8;
    color: #333;
}

.size-btn.active {
    border-color: #333;
    background: #333;
    color: #fff;
}

.size-btn.unavailable {
    opacity: 0.35;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* === Actions === */
.product-actions {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.btn-add-to-cart {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-add-to-cart:hover:not(:disabled) {
    background: #1a1a1a;
}

.btn-add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-add-to-cart .material-icons {
    font-size: 20px;
}

.btn-favorite {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 0.75rem;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-favorite:hover {
    border-color: #cc2d5a;
    color: #cc2d5a;
}

.btn-favorite.active {
    border-color: #cc2d5a;
    color: #cc2d5a;
}

.btn-favorite.active .material-icons {
    color: #cc2d5a;
}

/* === Description === */
.product-description {
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.product-description h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555;
    margin: 0 0 0.5rem 0;
}

.product-description p,
.product-description #descriptionContent {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555;
    margin: 0;
}

/* === Fabrication (Характеристики) === */
.product-fabrication {
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.product-fabrication h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555;
    margin: 0 0 0.5rem 0;
}

.product-fabrication #fabricationContent {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #555;
    margin: 0;
}

/* === Variants === */
.product-variants {
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.variant-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.variant-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.variant-btn:hover {
    border-color: #333;
    background: #f8f8f8;
}

.variant-btn.active {
    border-color: #333;
    background: #333;
    color: #fff;
}

/* === Lightbox (Swiper Carousel) === */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
}

.lightbox-overlay.active {
    display: block;
}

.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10001;
    line-height: 1;
    padding: 0.5rem;
    transition: opacity 0.2s ease;
}

.lightbox-close:hover {
    opacity: 0.7;
}

/* Lightbox Swiper */
.lightbox-swiper {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.lightbox-swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    overflow: hidden;
    transition: opacity 0.35s ease, transform 0.35s ease;
    opacity: 0.3;
    transform: scale(0.8);
}

.lightbox-swiper .swiper-slide-active {
    opacity: 1;
    transform: scale(1);
}

.lightbox-swiper .swiper-slide img {
    max-width: 60vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 0.5rem;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.lightbox-swiper .swiper-slide-active img {
    max-width: 65vw;
    max-height: 88vh;
}

/* Lightbox Swiper navigation arrows */
.lightbox-swiper .swiper-button-next,
.lightbox-swiper .swiper-button-prev {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    backdrop-filter: blur(6px);
    transition: background 0.2s ease;
}

.lightbox-swiper .swiper-button-next:hover,
.lightbox-swiper .swiper-button-prev:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-swiper .swiper-button-next::after,
.lightbox-swiper .swiper-button-prev::after {
    font-size: 20px;
    font-weight: bold;
}

/* Lightbox pagination counter */
.lightbox-counter {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10001;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.4);
    padding: 0.35rem 1rem;
    border-radius: 2rem;
    backdrop-filter: blur(4px);
}

/* === Responsive === */
@media (max-width: 1023px) {
    .product-detail {
        grid-template-columns: 1fr;
    }

    .product-gallery {
        position: static;
    }

    .product-info {
        max-width: 100%;
    }
}

@media (max-width: 767px) {
    .product-swiper .swiper-button-next,
    .product-swiper .swiper-button-prev {
        width: 30px;
        height: 30px;
    }

    .product-swiper .swiper-button-next::after,
    .product-swiper .swiper-button-prev::after {
        font-size: 13px;
    }

    .product-thumbs .swiper-slide {
        width: 48px;
        min-width: 48px;
        max-width: 48px;
        height: 64px;
    }

    .price-current {
        font-size: 1.5rem;
    }

    .product-title {
        font-size: 1.25rem;
    }

    /* Lightbox mobile */
    .lightbox-swiper .swiper-slide img {
        max-width: 70vw;
        max-height: 75vh;
    }

    .lightbox-swiper .swiper-slide-active img {
        max-width: 80vw;
        max-height: 80vh;
    }

    .lightbox-swiper .swiper-button-next,
    .lightbox-swiper .swiper-button-prev {
        width: 40px;
        height: 40px;
    }

    .lightbox-swiper .swiper-button-next::after,
    .lightbox-swiper .swiper-button-prev::after {
        font-size: 16px;
    }
}

/* === Discontinued (Снят с продажи) === */
.discontinued-label {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 0.25rem;
    vertical-align: middle;
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.discontinued-block {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: #fafafa;
    border: 2px dashed #e5e7eb;
    border-radius: 1rem;
    margin: 1rem 0;
}

.discontinued-icon {
    margin-bottom: 1rem;
}

.discontinued-icon .material-icons {
    font-size: 3rem;
    color: #9ca3af;
}

.discontinued-title {
    font-size: 1.375rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.5rem 0;
}

.discontinued-text {
    font-size: 0.95rem;
    color: #6b7280;
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

.discontinued-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.discontinued-link:hover {
    color: #4f46e5;
    text-decoration: underline;
}

.discontinued-link .material-icons {
    font-size: 1.1rem;
}
