/* Product Detail Overlay Styles */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
}

/* ================== OVERLAY BACKDROP ================== */
.product-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
}

.overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(12px);
    background-color: rgba(0, 0, 0, 0.9);
}

/* Fallback for browsers that don't support backdrop-filter */
@supports not (backdrop-filter: blur(12px)) {
    .overlay-backdrop {
        background-color: rgba(0, 0, 0, 0.7);
    }
}

/* ================== OVERLAY CONTENT ================== */
.overlay-content {
    position: relative;
    z-index: 10000;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 2rem;
    box-sizing: border-box;
}

.overlay-close-btn {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.8);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.overlay-close-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* ================== PAGE WRAPPER ================== */
.item-details-page-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.0030);
    padding: 2rem;
    border-radius: 16px;
}

/* ================== THUMBNAIL GALLERY ================== */
.thumbnail-gallery {
    flex-shrink: 0;
}

.image-thumbnails-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.image-thumbnails-left .thumbnail-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.image-thumbnails-left img,
.image-thumbnails-left video {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid transparent;
    transition: border 0.2s ease, transform 0.2s ease;
    display: block;
}

.image-thumbnails-left img:hover,
.image-thumbnails-left video:hover {
    border-color: #570d0d;
    transform: scale(1.05);
}

.image-thumbnails-left img.active,
.image-thumbnails-left video.active {
    border-color: #ffffff;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: white;
    text-shadow: 0 0 4px rgba(0,0,0,0.7);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.thumbnail-wrapper:hover .play-icon {
    opacity: 1;
}

/* ================== MAIN ITEM CONTAINER ================== */
.item-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 700px;
    flex: 1;
}

.main-display-container {
    position: relative;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
}

.item-main-image {
    max-width: 700px;
    width: 100%;
    object-fit: contain;
    border-radius: 16px;
    display: block;
    margin: 0 auto;
    cursor: zoom-in;
}

.item-main-video {
    max-width: 700px;
    width: 100%;
    object-fit: contain;
    border-radius: 16px;
    display: block;
    margin: 0 auto;
}

/* ================== ZOOM FUNCTIONALITY ================== */
.zoomed-image-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 650px;
    height: 450px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    overflow: hidden;
    display: none;
    z-index: 9999;
    background-color: rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

.zoomed-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    min-width: 100%;
    min-height: 100%;
    max-width: none;
    max-height: none;
    pointer-events: none;
    transform-origin: top left;
    transition: transform 0.05s linear;
}

/* ================== RIGHT INFO AREA ================== */
.item-info-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    max-width: 350px;
    width: 100%;
    box-sizing: border-box;
}

.item-name-container,
.item-price-container,
.item-description-container {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 12px;
    padding: 1rem;
    box-sizing: border-box;
    color: #ffffff;
}

.item-name-container h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
}

.item-price-container .price {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6b35; /* Custom accent color - orange instead of green */
}

.item-description-container ul {
    list-style: disc;
    margin: 0;
    padding-left: 1.5rem;
}

.item-description-container li {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

/* ================== RELATED ITEMS SECTION ================== */
.related-items-section {
    max-width: 1400px;
    margin: 3rem auto 0;
    padding: 1rem;
    font-family: 'Inter', sans-serif;
}

.related-items-section h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: #fff;
    text-align: center;
}

.related-items-container {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding-bottom: 1rem;
    scroll-behavior: smooth;
}

.related-item-card {
    min-width: 200px;
    max-width: 200px;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.3);
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.related-item-card:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.related-item-card img {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    margin: 0 auto;
}

.related-item-card h3 {
    font-size: 1rem;
    margin: 0.5rem 0;
    color: #ffffff;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.related-item-card:hover h3 {
    text-decoration: underline;
    text-decoration-color: #ff6b35;
}

.related-item-card .price {
    font-weight: bold;
    color: #ff6b35; /* Custom accent color */
    margin: 0.5rem 0 0;
}

/* ================== ERROR MESSAGE ================== */
.error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 600px;
    padding: 1rem;
    background: #ffe5e5;
    color: #b30000;
    border-left: 6px solid #b30000;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    z-index: 10002;
}

/* ================== RESPONSIVE DESIGN ================== */
@media (max-width: 1024px) {
    .item-info-right {
        position: static;
        order: 3;
        max-width: 100%;
    }
    
    .item-details-page-wrapper {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .overlay-content {
        padding: 1rem;
    }
    
    .overlay-close-btn {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
    
    .item-details-page-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        margin: 0;
        padding: 1rem;
    }

    /* Name above main image */
    .item-name-container {
        order: 0;
    }

    /* Main image container */
    .item-details {
        order: 1;
        max-width: 100%;
    }

    /* Thumbnails under main image */
    .thumbnail-gallery {
        order: 2;
        width: 100%;
    }
    
    .image-thumbnails-left {
        flex-direction: row;
        justify-content: flex-start;
        overflow-x: auto;
        gap: 10px;
        padding: 0.5rem 0;
    }

    .image-thumbnails-left img,
    .image-thumbnails-left video {
        width: 60px;
        height: 60px;
    }

    /* Right info containers below main image */
    .item-price-container,
    .item-description-container {
        order: 3;
        max-width: 100%;
    }

    .item-main-image,
    .item-main-video {
        max-width: 100%;
    }
    
    .zoomed-image-container {
        width: 300px;
        height: 250px;
    }

    /* Related items adjustments */
    .related-item-card {
        min-width: 150px;
        max-width: 150px;
        padding: 0.75rem;
    }

    .related-item-card img {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 600px) {
    .overlay-content {
        padding: 0.5rem;
    }
    
    .item-details-page-wrapper {
        padding: 0.5rem;
    }
    
    .image-thumbnails-left img,
    .image-thumbnails-left video {
        width: 50px;
        height: 50px;
    }

    .related-item-card {
        min-width: 120px;
        max-width: 120px;
        padding: 0.5rem;
    }

    .related-item-card img {
        width: 100px;
        height: 100px;
    }

    .item-main-image {
        max-width: 100%;
    }
    
    .zoomed-image-container {
        width: 250px;
        height: 200px;
    }
    
    .item-name-container h1 {
        font-size: 1.25rem;
    }
    
    .item-price-container .price {
        font-size: 1.25rem;
    }
}

/* ================== ACCESSIBILITY ================== */
.product-detail-overlay:focus-within {
    outline: 2px solid #ff6b35;
}

.overlay-close-btn:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

.thumbnail-wrapper:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

.related-item-card:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

/* ================== SCROLLBAR STYLING ================== */
.related-items-container::-webkit-scrollbar {
    height: 8px;
}

.related-items-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.related-items-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.related-items-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.image-thumbnails-left::-webkit-scrollbar {
    height: 6px;
}

.image-thumbnails-left::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.image-thumbnails-left::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.image-thumbnails-left::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
