/* Main Carousel Container */
.amazon-carousel {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Carousel Header */
.carousel-header {
    font-size: 20px;
    margin-bottom: 15px;
    font-weight: bold;
    color: #333;
    font-family: "Amazon Ember", Arial, sans-serif;
}

/* Carousel Container */
.carousel-container {
    position: relative;
    overflow: hidden;
    min-height: 200px; /* Ensures space for loading indicator */
}

/* Loading Indicator - Updated with GIF */
.loading-indicator {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 0;
    background: transparent;
    z-index: 5;
    color: transparent;
    font-size: 0;
}

.loading-indicator.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.loading-indicator::before {
    content: "";
    display: block;
    width: 100px;
    height: 100px;
    background-image: url('https://www.roymall.com/e/lam/adminstyle/1/images/logo.gif');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: 0 auto;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Carousel Track */
.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-item {
    flex: 0 0 auto;
    padding: 0 10px;
    box-sizing: border-box;
}

/* Navigation Arrows */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
    background: white;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transition: all 0.3s ease;
}

.carousel-nav:hover {
    background: #f7f7f7;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.carousel-prev {
    left: 0;
    border-radius: 0 3px 3px 0;
}

.carousel-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.carousel-nav.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.carousel-nav-arrow {
    font-size: 20px;
    color: #555;
}

/* Product Card Styles */
.product-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.product-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.product-image {
    height: 150px;
    background-color: #f8f8f8;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.03);
}

.product-title {
    font-size: 14px;
    margin-bottom: 5px;
    color: #333;
    text-decoration: none;
    line-height: 21px;
    height: 63px;
    overflow: hidden;
    font-family: "Amazon Ember", Arial, sans-serif;
}

.product-title:hover {
    text-decoration: underline;
    color: #c45500;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    font-family: "Amazon Ember", Arial, sans-serif;
    color: #fd3636;
    margin-bottom: 5px;
    margin-top: auto;
}

/* Video Card Styles */
.video-card {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.video-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.video-thumbnail {
    position: relative;
    height: 0;
    padding-bottom: 56.25%;
    background-color: #000;
    overflow: hidden;
    margin-bottom: 10px;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
}

.splay-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255,255,255,0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    text-decoration: none;
    transition: all 0.3s ease;
}

.splay-button:hover {
    background-color: rgba(255,255,255,0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

.splay-button:after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 20px solid #555;
    margin-left: 4px;
    transition: all 0.3s ease;
}

.splay-button:hover:after {
    border-left-color: #333;
}

.video-title {
    font-size: 14px;
    color: #333;
    text-decoration: none;
    padding: 0 10px 10px;
    line-height: 21px;
    height: 63px;
    overflow: hidden;
    font-family: "Amazon Ember", Arial, sans-serif;
}

.video-title:hover {
    text-decoration: underline;
    color: #c45500;
}

/* Video Popup Styles */
.video-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.video-popup-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    overflow: hidden;
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Video Loading Animation - Updated */
.video-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.video-loading-gif {
    width: 80px;
    height: 80px;
    background-image: url('https://www.roymall.com/e/lam/adminstyle/1/images/logo.gif');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.video-loading-text {
    color: white;
    margin-top: 15px;
    font-size: 16px;
    font-family: "Amazon Ember", Arial, sans-serif;
}

/* Close Button */
.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-style: normal;
    font-size: 40px;
    font-family: Arial, Baskerville, monospace;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 100001;
    opacity: 0.8;
    transition: opacity 0.3s;
    line-height: 1;
}

.close-btn:hover {
    opacity: 1;
}

/* Error Message */
.error-message {
    color: #d32f2f;
    text-align: center;
    padding: 20px;
    font-family: "Amazon Ember", Arial, sans-serif;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .product-image {
        height: 130px;
    }
    
    .product-title {
        font-size: 13px;
        line-height: 19px;
        height: 57px;
    }
    .video-title {
        font-size: 13px;
        line-height: 19px;
        height: 67px;
    }
    
    .product-price {
        font-size: 14px;
    }
    
    .video-loading-gif {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 768px) {
    .amazon-carousel {
        padding: 15px;
        margin: 15px auto;
    }
    
    .carousel-header {
        font-size: 18px;
    }
    
    .product-image {
        height: 110px;
    }
    
    .video-thumbnail {
        margin-bottom: 8px;
    }
    
    .close-btn {
        top: 15px;
        right: 15px;
        font-size: 35px;
    }
    
    .loading-indicator::before {
        width: 80px;
        height: 80px;
    }
    
    .video-loading-gif {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .amazon-carousel {
        padding: 10px;
        margin: 10px auto;
        border: none;
    }
    
    .carousel-header {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .product-image {
        height: 90px;
    }
    
    .carousel-nav {
        width: 30px;
        height: 40px;
    }
    
    .carousel-nav-arrow {
        font-size: 16px;
    }
    
    .close-btn {
        top: 10px;
        right: 10px;
        font-size: 30px;
    }
    
    /* Mobile fullscreen video */
    .video-popup-content {
        width: 100%;
        height: 100%;
    }
    
    .video-container {
        padding-bottom: 0;
        height: 100%;
    }
    
    .video-container iframe {
        height: 100%;
    }
    
    .loading-indicator::before {
        width: 60px;
        height: 60px;
    }
    
    .video-loading-gif {
        width: 50px;
        height: 50px;
    }
    
    .video-loading-text {
        font-size: 14px;
    }
}