/* ===== EXACT PRODUCT PAGE STYLES - MATCHING SCREENSHOT ===== */

/* Product Grid - 2 Column Layout */
.product-details {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 2rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 1.5rem !important;
    margin-bottom: 2rem !important;
}

@media (max-width: 1023px) {
    .product-details {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
}

/* Slider Container */
.product-slider {
    position: relative !important;
    width: 100% !important;
    height: 500px !important;
    overflow: hidden !important;
    border-radius: 20px !important;
    direction: rtl !important;
    background-color: transparent !important;
    padding: 0 !important;
}

@media (min-width: 768px) {
    .product-slider {
        height: 700px !important;
    }
}

.slider {
    display: flex !important;
    height: 100% !important;
    transition: transform 0.5s ease-in-out !important;
    direction: rtl !important;
}

.slide {
    flex: 0 0 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    border-radius: inherit !important;
    overflow: hidden !important;
}

.slider-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    border-radius: inherit !important;
    opacity: 1 !important;
    transition: opacity 0.3s ease !important;
}

/* Reel mode: auto height that follows image */
.product-slider.reel {
    height: auto !important;
    aspect-ratio: auto !important;
    max-height: none !important;
    background: transparent !important;
}

.product-slider.reel .slide {
    border-radius: inherit !important;
}

.product-slider.reel .slider { height: auto !important; }
.product-slider.reel .slide { height: auto !important; }
.product-slider.reel .slider-image {
    height: auto !important;
    object-fit: contain !important;
    background: transparent !important;
    border-radius: inherit !important;
}

/* Mobile Responsive Styles */
@media (max-width: 767px) {
    /* Ensure padding doesn't expand widths */
    *, *::before, *::after { box-sizing: border-box; }

    /* Prevent horizontal scroll */
    html, body {
        overflow-x: auto !important; /* avoid clipping hidden content */
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Container mobile adjustments */
    .container {
        padding: 0rem !important;
        max-width: 100% !important;
    }
    
    .product-page {
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: visible !important;
    }
    
    /* Product details grid */
    .product-details {
        padding: 0.5rem !important;
        gap: 1rem !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: visible !important;
        /* Allow grid children to shrink instead of overflowing */
        grid-template-columns: 1fr !important;
    }

    /* Critical: allow grid children to shrink */
    .product-details > * { min-width: 0 !important; }
    .product-info-main,
    .product-price-section,
    .summary,
    #order-form { min-width: 0 !important; }
    
    /* Gallery */
    .product-gallery {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Slider adjustments */
    .product-slider {
        border-radius: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }
    
    .product-slider.reel {
        height: auto !important;
        aspect-ratio: auto !important;
        max-height: none !important;
        border-radius: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .slider { width: 100% !important; max-width: 100% !important; height: auto !important; }
    .slide { width: 100% !important; max-width: 100% !important; height: auto !important; }
    .slide img { display: block !important; width: 100% !important; height: auto !important; object-fit: contain !important; }

    /* Product info */
    .product-info-main {
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    
    .product-title {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Price section */
    .product-price-section {
        margin-bottom: 1rem !important;
        width: 100% !important;
        overflow: hidden !important;
    }
    
    .price-group-compact {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        width: 100% !important;
        overflow: hidden !important;
    }
    
    .price-item {
        font-size: 0.875rem !important;
        white-space: normal !important; /* allow wrapping to avoid overflow */
        flex: 0 1 auto !important;
    }
    
    .price-discount, .price-current {
        font-size: 1.25rem !important;
    }
    
    /* Form */
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    /* Variations */
    .product-variations {
        padding: 0.75rem !important;
    }
    
    /* Thumbnails */
    .thumbnails-container {
        gap: 0.5rem !important;
    }
    
    .thumbnail {
        width: 50px !important;
        height: 50px !important;
    }
}

/* Safety net: ensure no key wrapper exceeds viewport on very small screens */
@media (max-width: 767px) {
    .main-content,
    .product-page,
    .container,
    .product-details,
    .product-gallery,
    .sticky-container,
    .sticky-element,
    .product-slider,
    .slider,
    .slide,
    .product-info-main,
    .summary,
    #order-form {
        max-width: 100vw !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

.slider-image.lazy {
    opacity: 1 !important;
}

.slider-image.lazy[src*="data:image"] {
    opacity: 0.3 !important;
}

/* Make embedded media fully fluid */
img, video, canvas, iframe {
    max-width: 100% !important;
    height: auto !important;
}

/* Extra-small screens (<= 480px) */
@media (max-width: 480px) {
    .product-details { gap: 0.75rem !important; padding: 0.5rem !important; }
    .product-slider { border-radius: 10px !important; }
    .product-slider.reel { max-height: 65vh !important; border-radius: 10px !important; }
    .prev-btn, .next-btn { width: 32px !important; height: 32px !important; }
    .prev-btn { right: 8px !important; }
    .next-btn { left: 8px !important; }
    .thumbnail { width: 44px !important; height: 44px !important; }
    .product-title { font-size: 1.375rem !important; }
    .price-discount, .price-current { font-size: 1.125rem !important; }
    .price-original { font-size: 0.8125rem !important; }
    .price-item { font-size: 0.8125rem !important; }
}

/* Very small screens (<= 360px) */
@media (max-width: 360px) {
    .product-title { font-size: 1.25rem !important; }
    .product-details { gap: 0.6rem !important; }
    .price-item { font-size: 0.75rem !important; }
}

/* Navigation Buttons */
.nav-btn {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 40px !important;
    height: 40px !important;
    background: rgba(0, 0, 0, 0.3) !important;
    border: none !important;
    border-radius: 50% !important;
    color: white !important;
    font-size: 1.2rem !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
}

.prev-btn {
    right: 20px !important;
    left: auto !important;
}

.next-btn {
    left: 20px !important;
    right: auto !important;
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.5) !important;
    transform: translateY(-50%) scale(1.1) !important;
}

/* Thumbnails */
.thumbnails-container {
    display: flex !important;
    gap: 0.5rem !important;
    margin-top: 1rem !important;
    justify-content: center !important;
    padding: 0 !important;
    flex-wrap: wrap !important;
}

.thumbnail {
    width: 60px !important;
    height: 60px !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    overflow: hidden !important;
    border: 2px solid transparent !important;
    transition: all 0.3s ease !important;
    opacity: 0.7 !important;
    padding: 0 !important;
    background-color: #f8f8f8 !important;
}

.thumbnail:hover {
    opacity: 1 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important;
}

.thumbnail.active {
    border-color: #C4A484 !important;
    opacity: 1 !important;
    box-shadow: 0 4px 12px rgba(196, 164, 132, 0.2) !important;
}

.thumbnail img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 10px !important;
}

@media (max-width: 767px) {
    .thumbnails-container {
        display: none !important;
    }
}

/* Sticky Container */
.sticky-container {
    position: relative !important;
    width: 100% !important;
    height: fit-content !important;
}

.sticky-element {
    position: sticky !important;
    top: 20px !important;
    z-index: 40 !important;
    background: transparent !important;
}

@media (max-width: 1023px) {
    .sticky-element {
        position: relative !important;
        top: 0 !important;
    }
}

/* Product Info Section */
.product-info-main {
    background: white !important;
    border-radius: 1rem !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    padding: 1rem !important;
}

.product-title {
    font-size: 1.875rem !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin-bottom: 1rem !important;
}

.product-price-section {
    margin-bottom: 1.5rem !important;
}

/* Compact Price Group */
.price-group-compact {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.75rem !important;
    flex-wrap: nowrap !important;
}

.price-item {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    white-space: nowrap !important;
}

.price-item i {
    font-size: 1rem !important;
    color: var(--button-color, #000) !important;
    opacity: 0.7 !important;
}

.price-original {
    font-size: 1rem !important;
    font-weight: 500 !important;
    color: #9ca3af !important;
    text-decoration: line-through !important;
}

.price-discount {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: var(--button-color, #000) !important;
}

.price-current {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: var(--button-color, #000) !important;
}

.savings {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: #10b981 !important;
}

.savings-item i {
    color: #10b981 !important;
}

/* Form Styling */
#order-form {
    margin-top: 0 !important;
}

.form-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
    margin-top: 0 !important;
}

@media (max-width: 767px) {
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

.input-wrap {
    position: relative !important;
}

.input-wrap input,
.input-wrap select {
    width: 100% !important;
    padding: 0.75rem 1rem !important;
    padding-right: 2.5rem !important;
    padding-left: 0.75rem !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    background-color: #f9fafb !important;
    font-size: 1rem !important;
    transition: all 0.2s !important;
    text-align: right !important;
    direction: rtl !important;
}

.input-wrap input:focus,
.input-wrap select:focus {
    background-color: white !important;
    border-color: var(--button-color, #3b82f6) !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

.input-icon {
    position: absolute !important;
    right: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: var(--button-color, #000) !important;
    pointer-events: none !important;
}

/* Variations Section */
.product-variations {
    grid-column: 1 / -1 !important;
    margin-top: 0px !important; 
    padding: 1px 5px 1px 5px;
    background: white !important; 
    border: Opx solid var(--button-color, #000) !important; 
    border-radius: 0px !important;
}
.variation-group {
    margin-bottom: 1.5rem !important;
}

.variation-group:last-child {
    margin-bottom: 0 !important;
}

.variation-label {
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.75rem !important;
    display: block !important;
}

/* Color Options */
.color-options {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
}

.color-option {
    position: relative !important;
    cursor: pointer !important;
    display: inline-block !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    border: 2px solid #e5e7eb !important;
}

.color-option input[type="radio"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 100% !important;
    height: 100% !important;
    cursor: pointer !important;
    z-index: 10 !important;
}

.color-circle {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    border: 2px solid #e5e7eb !important;
    transition: all 0.2s !important;
    position: relative !important;
}

.color-option:hover .color-circle {
    border-color: var(--button-color, #000) !important;
}

/* Hover/selected support when element itself is the circle */
.color-option:hover {
    border-color: var(--button-color, #000) !important;
}

.color-option.selected {
    border-color: var(--button-color, #000) !important;
}

.color-option input[type="radio"]:checked + .color-circle {
    border-color: var(--button-color, #000) !important;
}

/* Also reflect visual selection when JS toggles .selected on the wrapper */
.color-option.selected .color-circle {
    border-color: var(--button-color, #000) !important;
}

.color-check {
    position: absolute !important;
    bottom: -2px !important;
    right: -2px !important;
    width: 16px !important;
    height: 16px !important;
    background-color: var(--button-color, #000) !important;
    border-radius: 50% !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    opacity: 0 !important;
    transition: opacity 0.2s !important;
}

.color-option input[type="radio"]:checked ~ .color-check {
    opacity: 1 !important;
}

/* Show check when wrapper is marked selected */
.color-option.selected .color-check {
    opacity: 1 !important;
}

/* Tooltip */
.color-option .tooltip {
    opacity: 0 !important;
    visibility: hidden !important;
    position: absolute !important;
    bottom: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin-bottom: 8px !important;
    padding: 4px 8px !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    font-size: 12px !important;
    border-radius: 4px !important;
    white-space: nowrap !important;
    z-index: 50 !important;
    transition: all 0.2s ease !important;
}

.color-option:hover .tooltip {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Size Options */
.size-options {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
}

.size-option {
    padding: 0.5rem 1rem !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    font-weight: 500 !important;
    background: white !important;
}

.size-option:hover {
    border-color: var(--button-color, #000) !important;
    background-color: rgba(0, 0, 0, 0.02) !important;
}

.size-option.active {
    border-color: var(--button-color, #000) !important;
    background-color: rgba(0, 0, 0, 0.05) !important;
}

/* Support .selected class for sizes */
.size-option.selected {
    border-color: var(--button-color, #000) !important;
    background-color: rgba(0, 0, 0, 0.05) !important;
}

/* Selected Value Display */
.selected-value {
    font-size: 0.875rem !important;
    color: #6b7280 !important;
    margin-top: 0.5rem !important;
    display: block !important;
}

/* Summary Section */
.summary {
    margin-top: 1rem !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.75rem !important;
    padding: 1rem !important;
}

.summary .row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    padding: 0.5rem 0 !important;
    border-bottom: 1px solid #f0f0f0 !important;
}

.summary .row:last-child {
    border-bottom: none !important;
}

.shipping-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 0.75rem !important;
    padding: 0.75rem !important;
    background: #ffffff !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.shipping-btn:hover {
    border-color: var(--button-color, #000) !important;
    background-color: rgba(0,0,0,0.03) !important;
}

.shipping-btn.active {
    border-color: var(--button-color, #000) !important;
    background-color: rgba(0, 0, 0, 0.06) !important;
}

.shipping-btn.selected {
    border-color: var(--button-color, #000) !important;
    background-color: rgba(0, 0, 0, 0.06) !important;
}

.summary .total {
    font-weight: 800 !important;
}

/* Submit Button */
.btn-primary {
    width: 100% !important;
    margin-top: 1.5rem !important;
    padding: 1rem !important;
    background-color: var(--button-color, #000) !important;
    color: white !important;
    border: none !important;
    border-radius: 0.5rem !important;
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
}

.btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.9) !important;
    z-index: 100000 !important;
    display: none !important;
}

.lightbox-close {
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    width: 40px !important;
    height: 40px !important;
    background: rgba(0, 0, 0, 0.5) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    font-size: 32px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 100002 !important;
    transition: all 0.3s ease !important;
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.7) !important;
}

.lightbox-content {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 100001 !important;
}

#lightbox-image {
    max-width: min(700px, 70vw) !important;
    max-height: 75vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
}

/* Lazy Loading */
.lazy:not([src]) {
    background-color: #f0f0f0 !important;
    animation: pulse 1.5s infinite ease-in-out !important;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.3; }
}
