/* ========================================
   Product Quick View Modal Styles
   Independent stylesheet to avoid conflicts with style.css
   ======================================== */

/* ========================================
   1. Modal Base Styles
   ======================================== */

/* Modal Container */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
}

.product-modal.show {
    display: flex;
    opacity: 1;
}

/* Background Overlay */
.product-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Modal Body */
.product-modal-content {
    position: relative;
    background: #FAF9F6;
    max-width: 1500px;
    width: 95%;
    max-height: 90vh;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    z-index: 1;
}

.product-modal.show .product-modal-content {
    transform: scale(1);
}

/* Close Button */
.product-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    padding: 0;
}

/* X Icon Container */
.product-modal-close::before,
.product-modal-close::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2.5px;
    background-color: #333;
    transition: all 0.2s ease;
}

/* First Line (top-left to bottom-right) */
.product-modal-close::before {
    transform: rotate(45deg);
}

/* Second Line (top-right to bottom-left) */
.product-modal-close::after {
    transform: rotate(-45deg);
}

/* Remove default focus styles */
.product-modal-close:focus {
    outline: none;
}

/* Hover and focus effects */
.product-modal-close:hover,
.product-modal-close:focus {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.product-modal-close:hover::before,
.product-modal-close:hover::after,
.product-modal-close:focus::before,
.product-modal-close:focus::after {
    background-color: #000;
}

/* Modal Body */
.product-modal-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 90vh;
}

/* ========================================
   2. Media Display Section
   ========================================*/

.product-media-section {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #fff;
}

/* Main Display Area */
.product-main-display {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Note: .product-main-display overflow: visible merged into desktop layout breakpoint below */

.product-main-image,
.product-main-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    border-radius: 4px;
    overflow: hidden;
}

.product-main-image.active,
.product-main-video.active {
    display: block;
}

/* ========================================
   3. Thumbnail Navigation Bar (Responsive Direction)
   ======================================== */

/* Portrait Devices (<768px): Horizontal Layout */
@media (max-width: 767px) {
    .product-thumbnails {
        display: flex;
        flex-direction: row;
        gap: 10px;
        margin-top: 15px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }
    
    .product-media-section {
        flex-direction: column;
    }
}

/* Tablet (768px-1279px): Horizontal Thumbnail Layout */
@media (min-width: 768px) and (max-width: 1279px) {
    .product-thumbnails {
        display: flex;
        flex-direction: row;
        gap: 10px;
        margin-bottom: 15px;
        overflow-x: auto;
        overflow-y: visible;
        padding: 4px 0 12px 0;
        width: 100%;
    }
    
    .product-media-section {
        flex-direction: column;
    }
}

/* Desktop (≥1280px): Vertical Thumbnail Layout */
@media (min-width: 1280px) {
    .product-thumbnails {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-right: 5px;
        overflow-y: auto;
        overflow-x: visible;
        max-height: 600px;
        padding: 0 12px 0 4px;
        width: 110px;
        min-width: 110px;
        flex-shrink: 0;
    }
    
    .product-media-section {
        flex-direction: row;
    }
}

/* Thumbnail Styles */
.product-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: #fff;
}

.product-thumbnail.active {
    border-color: #495057;
    box-shadow: 0 2px 8px rgba(73, 80, 87, 0.3);
}

.product-thumbnail:hover {
    border-color: #6c757d;
    /* Removed scale effect to avoid overflow, using shadow and opacity instead */
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
    opacity: 0.9;
}

/* Video Thumbnail Indicator */
/* Video Thumbnail Container */
.product-thumbnail-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    overflow: hidden;
}

.product-thumbnail-wrapper.active {
    border-color: #495057;
    box-shadow: 0 2px 8px rgba(73, 80, 87, 0.3);
}

.product-thumbnail-wrapper:hover {
    border-color: #6c757d;
    box-shadow: 0 4px 12px rgba(73, 80, 87, 0.2);
}

.product-thumbnail-wrapper .product-thumbnail {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    cursor: pointer;
}

/* Video Play Icon */
.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    pointer-events: none;
    z-index: 10;
    transition: transform 0.2s ease;
}

.video-play-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Hover Effect */
.product-thumbnail-wrapper:hover .video-play-icon {
    transform: translate(-50%, -50%) scale(1.15);
}

.product-thumbnail-wrapper:hover .video-play-icon circle {
    fill: rgba(0, 0, 0, 0.85);
}

/* Custom Scrollbar Styles */
.product-thumbnails::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.product-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.product-thumbnails::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.product-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   4. Image Zoom Feature (E-commerce Style)
   ======================================== */

/* Desktop Image Zoom Container - Only enabled in two-column layout (≥1280px) */
/* Actual enablement is determined by JavaScript based on touch screen detection */
@media (min-width: 1280px) {
    .product-main-image {
        cursor: crosshair;
    }
    
    /* Square Mask Layer (indicates zoom area) */
    .zoom-lens {
        position: absolute;
        border: 2px solid rgba(0, 0, 0, 0.3);
        background-color: rgba(255, 255, 255, 0.3);
        cursor: none;
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
        z-index: 10;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }
    
    .zoom-lens.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Right-side Zoom Display Area */
.zoom-result {
    position: absolute; /* 相对于 product-modal-body 定位 */
    /* 位置由 JavaScript 动态计算 */
    border: 1px solid #e9ecef;
    background-color: #fff;
    background-repeat: no-repeat;
    background-size: 200%; /* 2x zoom */
    opacity: 0;
    visibility: hidden;
    z-index: 100; /* Above product info section */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    overflow: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none; /* No mouse events, avoid blocking content interaction below */
}
    
    .zoom-result.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Single-column layout and small screens (<1280px) disable zoom feature */
@media (max-width: 1279px) {
    .product-main-image {
        cursor: default;
    }
    
    .zoom-lens,
    .zoom-result {
        display: none !important; /* Completely hidden, no space occupied */
    }
}

/* ========================================
   5. Video Playback Controls
   ======================================== */

.product-main-video {
    cursor: default;
}

.product-main-video::-webkit-media-controls-fullscreen-button {
    display: inline-block;
}

/* ========================================
   6. Product Info Section
   ======================================== */

.product-info-section {
    padding: 30px;
    overflow-y: auto;
    background: #FAF9F6;
}

.product-title {
    font-family: 'League Spartan', sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
    line-height: 1.3;
}

.product-price {
    font-size: 24px;
    font-weight: bold;
    color: #495057;
    margin-bottom: 20px;
}
.product-description {
    font-size: 16px;
    line-height: 1.6;
    color: #6c757d;
    margin-bottom: 25px;
}

/* Specifications Table */
.product-specifications {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 14px;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.product-specifications th,
.product-specifications td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.product-specifications th {
    font-weight: 600;
    background: #f8f9fa;
    color: #495057;
    width: 35%;
}

.product-specifications td {
    color: #6c757d;
}

.product-specifications tr:last-child td,
.product-specifications tr:last-child th {
    border-bottom: none;
}

.product-specifications tbody tr:hover {
    background: #f8f9fa;
}

/* Variant Selector Container */
.variant-selector {
    margin: 20px 0;
    padding: 16px;
    background: #f9fafb;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.variant-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.variant-label::before {
    content: '📦 ';
    margin-right: 4px;
}

/* Swatch Button Group */
.variant-swatch-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Individual Swatch Button */
.variant-swatch {
    position: relative;
    min-width: 70px;
    padding: 12px 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background: white;
    font-family: 'League Spartan', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    /* Synchronized transition: all properties change at the same speed */
    transition: 
        background-color 0.12s ease-out,
        border-color 0.12s ease-out,
        color 0.12s ease-out,
        box-shadow 0.12s ease-out;
    text-align: center;
    /* Performance: enable GPU acceleration */
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Swatch Hover State */
.variant-swatch:hover:not(.disabled):not(.active) {
    border-color: #7F9688;
    background-color: rgba(127, 150, 136, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

/* Swatch Active/Selected State */
.variant-swatch.active {
    border-color: #7F9688;
    background-color: #7F9688;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(127, 150, 136, 0.3);
}

/* Swatch Active with checkmark indicator */
.variant-swatch.active::after {
    content: '✓';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #5a7566;
    color: white;
    font-size: 10px;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    /* Performance: use GPU acceleration */
    transform: translateZ(0);
    /* Instant appearance: no transition for checkmark */
    transition: none;
}

/* Swatch Disabled/Out of Stock State */
.variant-swatch.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af;
    position: relative;
}

/* Diagonal strikethrough for out of stock */
.variant-swatch.disabled::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 5%;
    width: 90%;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #9ca3af 10%, #9ca3af 90%, transparent 100%);
    transform: rotate(-12deg);
    transform-origin: center;
}

/* Loading Variations State */
.loading-variations {
    padding: 16px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    font-style: italic;
    animation: pulse-loading 1.5s ease-in-out infinite;
}

@keyframes pulse-loading {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Swatch Focus State for Accessibility */
.variant-swatch:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(127, 150, 136, 0.3);
}

.variant-swatch:focus:not(.active) {
    border-color: #7F9688;
}

/* Hide the original select dropdown (fallback) */
.variant-select-hidden {
    display: none !important;
}

/* Action Buttons Area */
.product-actions {
    margin-top: 25px;
}

.product-actions .btn-add-to-cart {
    width: 100%; /* Full-width button */
    padding: 14px 30px; /* Slightly increased vertical padding for emphasis */
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-align: center;
    background: #7F9688;
    color: #fff;
}

.product-actions .btn-add-to-cart:hover:not(:disabled) {
    background: rgba(127, 150, 136, 0.85);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(127, 150, 136, 0.4);
}

.product-actions .btn-add-to-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   7. Responsive Layout
   ======================================== */

/* Tablet (768px-991px): Single-column Layout */
@media (min-width: 768px) and (max-width: 991px) {
    /* Tablet Modal shifted down to avoid navbar */
    .product-modal {
        top: 60px; /* Tablet navbar height is 60px */
        height: calc(100vh - 60px);
        align-items: flex-start; /* 从顶部对齐，不居中 */
    }
    
    /* Tablet hides overlay to keep navbar interactive */
    .product-modal-backdrop {
        display: none;
    }
    
    .product-modal-content {
        width: 90%;
        max-width: 900px;
        height: calc(100vh - 60px);
        max-height: calc(100vh - 60px);
        border-top: 1px solid #e9ecef; /* 区分导航栏和内容 */
    }
    
    .product-modal-body {
        flex-direction: column;
        max-height: calc(100vh - 60px);
        overflow-y: auto; /* Allow vertical scrolling */
        overflow-x: hidden; /* Disable horizontal scrolling */
        padding: 0; /* Remove padding, let children control independently */
    }
    
    .product-media-section {
        width: 100%;
        padding: 30px;
        flex-shrink: 0; /* 防止内容被压缩 */
        border-bottom: 1px solid #e9ecef;
    }
    
    .product-info-section {
        width: 100%;
        padding: 30px;
        max-height: none; /* 移除高度限制 */
        overflow-y: visible; /* 不需要独立滚动 */
        flex-shrink: 0; /* 防止内容被压缩 */
        border-left: none; /* 移除左边框 */
    }
}

/* Medium Tablet/Small Desktop (992px-1279px): Single-column Layout */
@media (min-width: 992px) and (max-width: 1279px) {
    /* Modal shifted down to avoid navbar */
    .product-modal {
        top: 80px; /* Navbar height is 80px */
        height: calc(100vh - 80px);
        align-items: flex-start; /* 从顶部对齐，不居中 */
    }
    
    /* 隐藏遮罩，保持导航栏可交互 */
    .product-modal-backdrop {
        display: none;
    }
    
    .product-modal-content {
        width: 90%;
        max-width: 1000px;
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
        border-top: 1px solid #e9ecef; /* 区分导航栏和内容 */
    }
    
    .product-modal-body {
        flex-direction: column;
        max-height: calc(100vh - 80px);
        overflow-y: auto; /* 允许垂直滚动 */
        overflow-x: hidden; /* 禁止横向滚动 */
        padding: 0;
    }
    
    .product-media-section {
        width: 100%;
        padding: 30px;
        flex-shrink: 0; /* 防止内容被压缩 */
        border-bottom: 1px solid #e9ecef;
    }
    
    .product-info-section {
        width: 100%;
        padding: 30px;
        max-height: none; /* 移除高度限制 */
        overflow-y: visible; /* 不需要独立滚动 */
        flex-shrink: 0; /* 防止内容被压缩 */
        border-left: none; /* 移除左边框 */
    }
}

/* Desktop (≥1280px): Two-column Layout + Zoom Feature */
@media (min-width: 1280px) {
    /* Desktop modal: Set top offset to avoid navbar, solve scaling issues through space isolation */
    .product-modal {
        padding-top: 90px; /* Navbar height 80px + 10px spacing */
        align-items: flex-start; /* Top-aligned */
    }
    
    .product-modal-content {
        margin: 0 auto; /* Horizontal center */
        max-height: calc(100vh - 110px); /* Viewport height - top offset - bottom margin */
    }
    
    .product-modal-body {
        position: relative; /* Positioning context for zoom-result */
        flex-direction: row;
        overflow-y: auto;
        max-height: calc(100vh - 110px); /* Consistent with modal-content */
    }
    
    .product-media-section {
        flex: 1 1 55%; /* Increased media area width, avoid thumbnail+main image compression */
        padding: 20px; /* Compressed padding to save space */
        max-height: calc(100vh - 110px);
        overflow-y: auto;
        min-width: 0; /* Key: Allow flex item to shrink below content width, solve overflow */
    }
    
    .product-info-section {
        flex: 1 1 30%; /* Compressed product info area, make room for media area */
        max-height: calc(100vh - 110px);
        overflow-y: auto;
        border-left: 1px solid #e9ecef;
    }
    
    /* Allow zoom area to overflow display, let main image take remaining space */
    .product-main-display {
        overflow: visible;
        width: auto;  /* Remove 100%, use auto */
        flex: 1;      /* Take remaining space besides thumbnail column */
        min-width: 0; /* Allow shrinking */
    }
}

/* Small Phones (481px-767px): Single-column Stacked */
@media (min-width: 481px) and (max-width: 767px) {
    /* Modal shifted down to avoid navbar */
    .product-modal {
        top: 50px; /* Navbar height is 50px */
        height: calc(100vh - 50px);
        align-items: flex-start;
    }
    
    /* Hide overlay to keep navbar interactive */
    .product-modal-backdrop {
        display: none;
    }
    
    .product-modal-content {
        width: 100%;
        height: calc(100vh - 50px);
        max-height: calc(100vh - 50px);
        border-radius: 0;
        max-width: 100%;
        border-top: 1px solid #e9ecef;
    }
    
    .product-modal-body {
        flex-direction: column;
        max-height: calc(100vh - 50px);
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .product-media-section,
    .product-info-section {
        padding: 20px;
        flex-shrink: 0;
    }
    
    .product-media-section {
        width: 100%;
    }
    
    .product-info-section {
        max-height: none;
        overflow-y: visible;
        border-left: none;
        border-top: 1px solid #e9ecef;
    }
    
    .product-title {
        font-size: 24px;
    }
    
    .product-price {
        font-size: 20px;
    }
    
    .product-modal-close {
        width: 48px;
        height: 48px;
        top: 10px;
        right: 10px;
        background: rgba(255, 255, 255, 0.98);
        z-index: 150;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    }
    
    .product-modal-close::before,
    .product-modal-close::after {
        width: 22px;
        height: 3px;
    }
    
    .product-modal-close:active {
        transform: scale(0.95);
        background: rgba(255, 255, 255, 1);
    }
    
    .product-modal-close:active::before,
    .product-modal-close:active::after {
        background-color: #000;
    }
}

/* Smaller Phones (361px-480px) */
@media (min-width: 361px) and (max-width: 480px) {
    /* Modal shifted down to avoid navbar */
    .product-modal {
        top: 45px; /* Navbar height is 45px */
        height: calc(100vh - 45px);
        align-items: flex-start;
    }
    
    .product-modal-backdrop {
        display: none;
    }
    
    .product-modal-content {
        width: 100%;
        height: calc(100vh - 45px);
        max-height: calc(100vh - 45px);
        border-radius: 0;
        max-width: 100%;
        border-top: 1px solid #e9ecef;
    }
    
    .product-modal-body {
        flex-direction: column;
        max-height: calc(100vh - 45px);
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .product-media-section,
    .product-info-section {
        padding: 18px;
        flex-shrink: 0;
    }
    
    .product-media-section {
        width: 100%;
    }
    
    .product-info-section {
        max-height: none;
        overflow-y: visible;
        border-left: none;
        border-top: 1px solid #e9ecef;
    }
    
    .product-title {
        font-size: 22px;
    }
    
    .product-price {
        font-size: 19px;
    }
    
    .product-modal-close {
        width: 46px;
        height: 46px;
        top: 8px;
        right: 8px;
    }
    
    .product-modal-close::before,
    .product-modal-close::after {
        width: 20px;
        height: 2.5px;
    }
}

/* Extra Small Phones (≤360px) */
@media (max-width: 360px) {
    /* Modal shifted down to avoid navbar */
    .product-modal {
        top: 40px; /* Navbar height is 40px */
        height: calc(100vh - 40px);
        align-items: flex-start;
    }
    
    .product-modal-backdrop {
        display: none;
    }
    
    .product-modal-content {
        width: 100%;
        height: calc(100vh - 40px);
        max-height: calc(100vh - 40px);
        border-radius: 0;
        max-width: 100%;
        border-top: 1px solid #e9ecef;
    }
    
    .product-modal-body {
        flex-direction: column;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .product-media-section,
    .product-info-section {
        padding: 15px;
        flex-shrink: 0;
    }
    
    .product-media-section {
        width: 100%;
    }
    
    .product-info-section {
        max-height: none;
        overflow-y: visible;
        border-left: none;
        border-top: 1px solid #e9ecef;
    }
    
    .product-title {
        font-size: 20px;
    }
    
    .product-price {
        font-size: 18px;
    }
    
    .product-modal-close {
        width: 44px;
        height: 44px;
        top: 6px;
        right: 6px;
    }
    
    .product-modal-close::before,
    .product-modal-close::after {
        width: 18px;
        height: 2.5px;
    }
}

/* ========================================
   8. Loading and Animation Effects
   ======================================== */

/* Image Loading Placeholder */
.product-main-display::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #495057;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-main-display.loading::before {
    opacity: 1;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Smooth Fade In/Out */
.product-main-image,
.product-main-video {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========================================
   9. Accessibility Enhancements
   ======================================== */

/* Focus Styles */
.product-thumbnail:focus,
.product-actions .btn:focus {
    outline: 2px solid #495057;
    outline-offset: 2px;
}

/* Keyboard Navigation Hint */
.keyboard-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 5;
}

.product-modal.show .keyboard-hint {
    opacity: 1;
}

/* Hide Keyboard Hint on Mobile */
@media (max-width: 767px) {
    .keyboard-hint {
        display: none;
    }
}

/* Hide Keyboard Hint on Touch Devices */
.product-modal.touch-device .keyboard-hint {
    display: none !important;
}

/* ========================================
   10. Performance Optimization
   ======================================== */

/* GPU Acceleration */
.product-modal-content,
.product-main-image,
.product-main-video,
.product-thumbnail {
    will-change: transform;
}

.product-modal.show .product-modal-content,
.product-modal.show .product-main-image,
.product-modal.show .product-main-video {
    will-change: auto;
}

/* Reduce Repaints */
.product-modal *,
.product-modal *::before,
.product-modal *::after {
    box-sizing: border-box;
}

/* ========================================
   11. Print Styles
   ======================================== */

@media print {
    .product-modal {
        display: none !important;
    }
}

