/**
 * Frontend Styles for Shoppable Reels
 */

/* Carousel Wrapper */
.sr-carousel-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
    padding: 10px 0;
}

/* Swiper Container Customizations */
.sr-swiper {
    width: 100%;
    padding: 10px 0 !important;
}

/* Carousel Slide (9:16 Aspect Ratio Card) */
.sr-reel-slide {
    height: auto;
    transition: transform 0.3s ease;
}

.sr-reel-card {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16;
    background-color: #111;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transform: translateZ(0);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.sr-reel-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.sr-reel-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.sr-reel-card:hover .sr-reel-thumbnail {
    transform: scale(1.08);
}

.sr-reel-thumbnail-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1e24, #2a2a35);
    color: #4f5061;
}

.sr-reel-thumbnail-fallback .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
}

/* Overlay & Micro-animations */
.sr-reel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 50%, rgba(0,0,0,0.85) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    box-sizing: border-box;
    z-index: 2;
}

.sr-play-btn-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(255,255,255,0.4);
}

.sr-reel-card:hover .sr-play-btn-wrapper {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.sr-play-svg {
    transform: translateX(2px);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    transition: transform 0.2s ease;
}

.sr-play-btn-wrapper:hover .sr-play-svg {
    transform: translateX(2px) scale(1.15);
}

/* Info badge top left */
.sr-reel-info-badge {
    align-self: flex-start;
}

.sr-badge-tag {
    background: var(--sr-btn-bg, #a46497);
    color: var(--sr-btn-text, #ffffff);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Custom autoplay video wrapper inside slide cards */
.sr-reel-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    pointer-events: none; /* Allows clicks to pass through and trigger the modal opening */
}

/* Product Info Badge bottom */
.sr-reel-meta {
    width: 100%;
}

.sr-reel-product-badge {
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-sizing: border-box;
}

.sr-product-badge-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sr-product-name {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.sr-product-price {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
}

.sr-carousel-buy-btn {
    background: var(--sr-btn-bg, #a46497);
    color: var(--sr-btn-text, #ffffff);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s ease, filter 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.sr-carousel-buy-btn:hover {
    transform: scale(1.04);
    filter: brightness(0.9);
}

.sr-product-price del {
    font-size: 11px;
    opacity: 0.65;
    margin-right: 4px;
    color: #e0e0e0;
}

.sr-product-price ins {
    text-decoration: none;
    color: #ffffff;
}

/* Navigation Customizations */
.sr-swiper-prev,
.sr-swiper-next {
    color: #ffffff !important;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    width: 44px !important;
    height: 44px !important;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: opacity 0.3s ease, background 0.3s ease;
}

.sr-swiper-prev::after,
.sr-swiper-next::after {
    font-size: 16px !important;
    font-weight: bold;
}

.sr-swiper-prev:hover,
.sr-swiper-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Lightbox Modal CSS */
.sr-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sr-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--sr-popup-bg, #000000);
    opacity: 0.8;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: opacity 0.3s ease;
}

.sr-lightbox-card {
    position: relative;
    z-index: 10;
    display: flex;
    width: 90%;
    max-width: 820px;
    height: 80vh;
    max-height: 680px;
    background: #ffffff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
    animation: srScaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes srScaleIn {
    0% { transform: scale(0.92); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.sr-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 100;
    background: rgba(0,0,0,0.5);
    border: none;
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: background 0.2s ease, transform 0.2s ease;
}

.sr-close-btn:hover {
    background: rgba(0,0,0,0.8);
    transform: scale(1.05);
}

.sr-lightbox-body {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Video Column (9:16 vertical player) */
.sr-video-section {
    position: relative;
    flex: 1 1 52%;
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    overflow: hidden;
}

.sr-video-player-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#sr-video-holder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000000;
}

#sr-video-holder iframe,
#sr-video-holder video {
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover; /* Keeps it full cover vertical format */
}

/* Modal Nav buttons */
.sr-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
    opacity: 0.6;
}

.sr-video-section:hover .sr-modal-nav {
    opacity: 1;
}

.sr-modal-nav:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-50%) scale(1.08);
}

.sr-modal-prev {
    left: 15px;
}

.sr-modal-next {
    right: 15px;
}

/* Toggle sound */
.sr-sound-toggle {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 50;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.15);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.sr-sound-toggle:hover {
    background: rgba(0,0,0,0.8);
}

/* Product details sidebar */
.sr-product-section {
    flex: 1 1 48%;
    background-color: #fafafa;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    border-left: 1px solid #eaeaea;
    overflow-y: auto;
    height: 100%;
}

.sr-product-card-body {
    padding: 35px 30px;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
    box-sizing: border-box;
}

.sr-product-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

#sr-modal-product-image {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #eaeaea;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.sr-product-title-price {
    flex-grow: 1;
}

#sr-modal-product-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e1e24;
    margin: 0 0 6px 0;
    line-height: 1.35;
}

#sr-modal-product-price {
    font-size: 18px;
    font-weight: 800;
    color: #111111;
}

#sr-modal-product-price del {
    font-weight: 500;
    font-size: 14px;
    color: #8f8f9e;
    margin-right: 6px;
}

#sr-modal-product-price ins {
    text-decoration: none;
    color: var(--sr-btn-bg, #a46497);
}

.sr-product-desc {
    font-size: 14px;
    color: #5d5d6a;
    line-height: 1.6;
    margin-bottom: 30px;
    overflow-y: auto;
    max-height: 160px;
}

/* Alerts CSS */
.sr-modal-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 20px;
    box-sizing: border-box;
    animation: srFadeIn 0.3s ease;
}

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

.sr-modal-alert.success {
    background-color: #e6f6ee;
    color: #1b5e3a;
    border: 1px solid #cceee0;
}

.sr-modal-alert.error {
    background-color: #fde8e8;
    color: #9b1c1c;
    border: 1px solid #fbd5d5;
}

/* Action Buttons list */
.sr-product-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
}

.sr-action-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    height: 48px !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    text-decoration: none !important;
    position: relative;
    border: none;
}

.sr-btn-cart {
    background: var(--sr-btn-bg, #a46497) !important;
    color: var(--sr-btn-text, #ffffff) !important;
    box-shadow: 0 4px 12px rgba(164, 100, 151, 0.25);
}

.sr-btn-cart:hover {
    background: var(--sr-btn-bg, #a46497) !important;
    filter: brightness(0.92);
    box-shadow: 0 6px 16px rgba(164, 100, 151, 0.35);
    transform: translateY(-2px);
}

.sr-btn-buy {
    background: #111111 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.sr-btn-buy:hover {
    background: #252528 !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.sr-btn-view {
    background: transparent !important;
    color: #4a4a58 !important;
    border: 1.5px solid #dcdce2 !important;
}

.sr-btn-view:hover {
    background: #f0f0f5 !important;
    color: #1e1e24 !important;
    border-color: #1e1e24 !important;
}

/* Spinner loader details */
.sr-btn-loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: srSpin 0.75s linear infinite;
    position: absolute;
}

.sr-btn-view .sr-btn-loader {
    border-top-color: #1e1e24;
}

@keyframes srSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Overrides (Mobile screens) */
@media (max-width: 768px) {
    .sr-lightbox-card {
        flex-direction: column;
        width: 92%;
        height: 85vh;
        max-height: 720px;
    }
    
    .sr-close-btn {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 26px;
    }

    .sr-lightbox-body {
        flex-direction: column;
    }

    /* Video top */
    .sr-video-section {
        flex: 1 1 54%;
        border-bottom: 1px solid #eaeaea;
        height: auto;
    }

    /* Product card bottom */
    .sr-product-section {
        flex: 0 0 46%;
        border-left: none;
        height: auto;
    }

    .sr-product-card-body {
        padding: 16px 20px;
        overflow-y: auto;
    }

    .sr-product-header {
        margin-bottom: 12px;
        gap: 12px;
    }

    #sr-modal-product-image {
        width: 56px;
        height: 56px;
        border-radius: 8px;
    }

    #sr-modal-product-title {
        font-size: 15px;
        margin-bottom: 2px;
    }

    #sr-modal-product-price {
        font-size: 15px;
    }

    .sr-product-desc {
        font-size: 12px;
        line-height: 1.45;
        margin-bottom: 15px;
        max-height: 70px;
    }
    
    .sr-modal-alert {
        margin-bottom: 12px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .sr-product-actions {
        gap: 8px;
    }

    .sr-action-btn {
        height: 40px !important;
        font-size: 13px !important;
        border-radius: 8px !important;
    }

    .sr-modal-nav {
        width: 36px;
        height: 36px;
    }
    
    .sr-modal-nav svg {
        width: 24px;
        height: 24px;
    }
}

/* Error Player placeholder styling */
.sr-error-player {
    color: #ff5252;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    padding: 24px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 240px;
    margin: 0 auto;
}
