/**
 * Product View Page Styles
 * Layout: Hero (60/40 image/info), Size Cards, Info Cards, Related Products
 */

/* ========================================
   Product Hero Section
   ======================================== */

.product-hero {
    padding: 60px 0 20px;
    background: #f8f9fa;
}

.product-hero__grid {
    display: grid;
    grid-template-columns: 3fr 2fr;  /* 60/40 split */
    gap: 40px;
    align-items: start;
}

@media (max-width: 992px) {
    .product-hero__grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* Product Image Column (grid cell) */
.product-hero__image {
    min-width: 0; /* Prevents grid cell content from overflowing */
}

/* Product Gallery */
.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0; /* Prevents flex children from overflowing grid */
    max-width: 100%;
}

.product-gallery__main {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    border: 2px solid #ddd;
    transition: box-shadow 0.2s ease;
}

.product-gallery__main:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.product-gallery__main img {
    width: 100%;
    height: auto;
    object-fit: cover;
    cursor: pointer;
}

.product-gallery__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #999;
    min-height: 300px;
    background: #fff;
    border-radius: 8px;
}

.product-gallery__placeholder i {
    font-size: 4rem;
}

/* Thumbnails */
.product-gallery__thumbs {
    display: flex;
    justify-content: center;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 0;
}

.product-gallery__thumb {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 6px;
    background: #f5f5f5;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.product-gallery__thumb:hover {
    border-color: #ccc;
    transform: translateY(-2px);
}

.product-gallery__thumb.active {
    border-color: var(--primary-color, #213a86);
}

.product-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Thumbnail Wrapper with Arrow Scrolling */
.product-gallery__thumbs-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    max-width: 100%; /* Never exceed parent (main image) width */
    width: 100%;
}

.product-gallery__thumbs-wrapper .product-gallery__thumbs {
    flex: 1;
    justify-content: flex-start;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.product-gallery__thumbs-wrapper .product-gallery__thumbs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.thumb-scroll-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
}

.product-gallery__thumbs-wrapper:hover .thumb-scroll-btn {
    opacity: 1;
    visibility: visible;
}

.thumb-scroll-btn:hover {
    background: var(--primary-color, #213a86);
    border-color: var(--primary-color, #213a86);
    color: #fff;
}

.thumb-scroll-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.thumb-scroll-btn:disabled:hover {
    background: #fff;
    border-color: #ddd;
    color: #666;
}

.thumb-scroll-btn i {
    font-size: 1rem;
}

/* Video thumbnail overlay */
.product-gallery__thumb {
    position: relative;
}

.thumb-video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.thumb-video-icon i {
    font-size: 0.9rem;
    margin-left: 2px; /* Visual centering for play icon */
}

/* Responsive: Always show arrows on mobile */
@media (max-width: 768px) {
    .thumb-scroll-btn {
        width: 32px;
        height: 32px;
        opacity: 1;
        visibility: visible;
    }
}

/* Product Info Column */
.product-hero__info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-hero__title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color, #213a86);
    line-height: 1.2;
    margin: 0;
}

.product-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e9ecef;
    color: #666;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    width: fit-content;
}

.product-hero__price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color, #213a86);
}

.product-hero__description {
    color: #555;
    line-height: 1.8;
    font-size: 1rem;
    margin-top: 16px;
}

.product-hero__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 10px;
    transition: color 0.2s ease;
}

.product-hero__back:hover {
    color: var(--primary-color, #213a86);
}

/* Size Selection (inside hero info column) */
.product-hero__sizes {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.product-hero__sizes-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
}

/* ========================================
   Product Details Section (Description + Info Cards)
   ======================================== */

.product-details {
    padding: 40px 0 50px;
    background: #f8f9fa;
}

/* ========================================
   Size Chips (Compact Size Selector)
   ======================================== */

.size-chips {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

/* Single size: don't stretch a lone chip across the full row */
.size-chips--count-1 {
    grid-template-columns: minmax(0, 220px);
}

/* Two sizes: balanced 2-column layout */
.size-chips--count-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.size-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 16px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 0;
    text-align: center;
    font-family: inherit;
    outline: none;
}

.size-chip:hover {
    border-color: var(--primary-hover-color, #0073ff);
    background: #f8f9fb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.size-chip:focus-visible {
    border-color: var(--primary-hover-color, #0073ff);
    box-shadow: 0 0 0 3px rgba(0, 115, 255, 0.2);
}

.size-chip.selected {
    border-color: var(--primary-color, #213a86);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(33, 58, 134, 0.15);
}

.size-chip__name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-title-color, #333);
    line-height: 1.2;
}

.size-chip.selected .size-chip__name {
    color: var(--primary-color, #213a86);
}

.size-chip__price {
    font-size: 0.8rem;
    font-weight: 500;
    color: #888;
}

.size-chip.selected .size-chip__price {
    color: var(--primary-color, #213a86);
}

@media (max-width: 576px) {
    .size-chips,
    .size-chips--count-1,
    .size-chips--count-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .size-chips--count-1 {
        grid-template-columns: minmax(0, 220px);
    }

    .size-chip {
        padding: 8px 12px;
    }
}

/* ========================================
   Size Detail Panel (Expandable)
   ======================================== */

.size-detail-panel {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
    margin-top: 0;
}

.size-detail-panel.open {
    max-height: 1000px;
    opacity: 1;
    margin-top: 20px;
}

.size-detail-panel__inner {
    background: #fff;
    border: 2px solid var(--primary-color, #213a86);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.size-detail-panel.open .size-detail-panel__inner {
    animation: detailPanelFadeIn 0.4s ease;
}

@keyframes detailPanelFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.size-detail-panel__heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-title-color, #333);
    margin: 0 0 14px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.size-detail-panel .size-pricing-table {
    margin-bottom: 16px;
}

/* Custom Quantity Calculator */
.custom-qty-calc {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 14px;
}

.custom-qty-calc__label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.custom-qty-calc__input {
    width: 90px;
    padding: 8px 10px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.2s ease;
}

.custom-qty-calc__input:focus {
    outline: none;
    border-color: var(--primary-color, #213a86);
}

.custom-qty-calc__result {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.custom-qty-calc__price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color, #213a86);
}

.custom-qty-calc__total {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
}

.custom-qty-calc__note {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

/* Detail Panel Actions */
.size-detail-panel__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
    flex-wrap: wrap;
}

.detail-action-or {
    color: #888;
    font-weight: 500;
    font-size: 0.9rem;
}

.upload-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 6px 0;
    width: 100%;
}
.upload-divider::before,
.upload-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
}
.upload-divider span {
    color: #999;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: lowercase;
}

.btn-upload-files {
    flex-basis: 100%;
    padding: 10px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-upload-files i {
    margin-right: 4px;
}

.detail-cart-label {
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.detail-cart-qty {
    width: 80px;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.2s ease;
}

.detail-cart-qty:focus {
    outline: none;
    border-color: var(--primary-color, #213a86);
}

@media (max-width: 576px) {
    .size-detail-panel__inner {
        padding: 16px;
    }

    .size-detail-panel__actions {
        flex-direction: column;
    }

    .size-detail-panel__actions .btn {
        width: 100%;
    }

    .detail-action-or {
        display: none;
    }

    .detail-cart-qty {
        width: 70px;
    }
}

/* ========================================
   Info Cards (inside product-details section)
   ======================================== */

.info-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
    margin-top: 50px;
}

@media (max-width: 768px) {
    .info-cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.info-card {
    background: #fff;
    border-radius: 12px;
    padding: 25px 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.info-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.info-card i {
    font-size: 2rem;
    color: var(--primary-color, #213a86);
    margin-bottom: 12px;
    display: block;
}

.info-card-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-title-color, #333);
    margin-bottom: 6px;
}

.info-card-text {
    font-size: 0.9rem;
    color: #888;
}

/* ========================================
   Media Lightbox (Images & Videos)
   ======================================== */

.media-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    cursor: pointer;
    flex-direction: column;
    padding: 60px 60px 20px;
    box-sizing: border-box;
}

.media-lightbox.active {
    display: flex;
}

/* Main content area - takes remaining space */
.lightbox-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    cursor: default;
}

.media-lightbox #lightboxImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: none;
}

.media-lightbox #lightboxImage.active {
    display: block;
}

#lightboxVideo {
    width: 100%;
    max-width: 1000px;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: none;
}

#lightboxVideo.active {
    display: block;
}

#lightboxVideo iframe {
    width: 100%;
    height: 100%;
}

/* Navigation arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Thumbnail strip */
.lightbox-thumbs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 16px 0;
    cursor: default;
}

.lightbox-thumb {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
}

.lightbox-thumb:hover {
    opacity: 0.9;
    border-color: rgba(255, 255, 255, 0.5);
}

.lightbox-thumb.active {
    border-color: white;
    opacity: 1;
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lightbox-thumb .thumb-video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* Close button */
.media-lightbox-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2.5rem;
    color: #fff;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    z-index: 10002;
}

.media-lightbox-close:hover {
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .media-lightbox {
        padding: 50px 10px 10px;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .lightbox-prev {
        left: 5px;
    }

    .lightbox-next {
        right: 5px;
    }

    .lightbox-thumbs {
        gap: 6px;
        padding: 10px 0;
    }

    .lightbox-thumb {
        width: 50px;
        height: 38px;
    }

    .media-lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 2rem;
    }
}

/* ========================================
   Related Products Section
   ======================================== */

.related-products {
    padding: 60px 0;
    background: #fff;
}

.related-products h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-title-color, #333);
    margin-bottom: 5px;
    text-align: center;
}

.related-products .section-subtitle {
    color: #666;
    margin-bottom: 30px;
    text-align: center;
}

.related-products .product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.related-products .product-card {
    height: 100%;
}

.related-products .product-card__image {
    min-height: 180px;
}
