/* CSS Cleanup: Removed generic selectors (*, body) to avoid conflicts */
/* Scoped Variables */
.reels-section-container,
.reel-widget,
.reels-modal {
    --primary-color: #459647;
    --secondary-color: #FFC0CB;
    --text-dark: #333;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.reels-section-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.reels-section-container header {
    text-align: center;
    margin-bottom: 50px;
}

.reels-section-container header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.reels-section-container header p {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* Reels Grid - Horizontal Slider */
.reels-grid-container {
    position: relative;
    margin-bottom: 50px;
    padding: 0 60px;
}

.reels-grid {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    /* Fix vertical scrollbar */
    scroll-behavior: smooth;
    padding: 20px 0;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;

    /* Hide scrollbar but keep functionality */
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.25) transparent;
}
.product-content{
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.25) transparent;
}
.reels-grid::-webkit-scrollbar, .product-content::-webkit-scrollbar {
    width: 3px;
}

.reels-grid::-webkit-scrollbar-track, .product-content::-webkit-scrollbar-track {
    background: transparent;
}

.reels-grid::-webkit-scrollbar-thumb, .product-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.25);
    border-radius: 4px;
}

.reels-grid::-webkit-scrollbar-thumb:hover, .product-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Slider Navigation Buttons */
.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: var(--white);
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.slider-nav:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-50%) scale(1.1);
    box-shadow: var(--shadow-lg);
}

.slider-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.slider-nav:disabled:hover {
    background: var(--white);
    transform: translateY(-50%);
}

.slider-nav.prev {
    left: 0;
}

.slider-nav.next {
    right: 0;
}

.slider-nav svg {
    width: 24px;
    height: 24px;
}

.reel-card {
    position: relative;
    flex: 0 0 280px;
    width: 280px;
    aspect-ratio: 9/16;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--white);
}

.reel-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.reel-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.reel-card video:not([data-loaded]) {
    opacity: 0.7;
}

.reel-card video[data-loaded] {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Loading spinner for videos */
.reel-card.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    opacity: 1;
    z-index: 3;
    pointer-events: none;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.reel-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    pointer-events: none;
}

.reel-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    color: var(--white);
    z-index: 1;
}

.reel-info h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.reel-info p {
    font-size: 0.85rem;
    opacity: 0.9;
}

.play-icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.reel-card:hover .play-icon-overlay {
    opacity: 1;
}

.play-icon-overlay svg {
    width: 30px;
    height: 30px;
    fill: var(--primary-color);
    margin-left: 4px;
}

/* Full Grid Layout for All Videos Page */
.reels-full-grid-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.reels-full-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

.reel-card-full {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--white);
}

.reel-card-full:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.reel-card-full video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.reel-card-full video:not([data-loaded]) {
    opacity: 0.7;
}

.reel-card-full video[data-loaded] {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.reel-card-full.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    opacity: 1;
    z-index: 3;
    pointer-events: none;
}

.reel-card-full::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    pointer-events: none;
}

/* Mobile adjustments for full grid */
@media (max-width: 768px) {
    .reels-full-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
        padding: 15px 0;
    }
    
    .reels-full-grid-container {
        padding: 20px 15px;
    }
}

@media (max-width: 480px) {
    .reels-full-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }
}

/* 
   ========================================
   FLOATING REEL WIDGET (Product Page)
   ========================================
*/
.reel-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 120px;
    height: 213px;
    /* 9:16 aspect ratio */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    z-index: 999;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: slideUp 0.5s ease-out;
    background: #000;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.reel-widget:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.reel-widget-video {
    width: 100%;
    height: 100%;
}

.reel-widget-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reel-widget-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.reel-widget-close {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s;
}

.reel-widget:hover .reel-widget-close {
    opacity: 1;
}

.reel-widget-close:hover {
    background: rgba(255, 0, 0, 0.7);
}

/* Reels Modal */
.reels-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    /* High z-index */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reels-modal.active {
    display: flex;
    opacity: 1;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    z-index: 1001;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-content {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Video Container */
.video-container {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100%;
    touch-action: pan-y;
    margin: 0 auto;
}

.video-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    transform-origin: center center;
}

.video-slide.active {
    opacity: 1;
    transform: translateY(0) scale(1) !important;
    z-index: 2;
}

.video-slide.prev {
    transform: translateY(-100%) scale(0.9) !important;
    opacity: 0.5;
    filter: brightness(0.7);
}

.video-slide.next {
    transform: translateY(100%) scale(0.9) !important;
    opacity: 0.5;
    filter: brightness(0.7);
}

.video-slide video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.video-slide.active video {
    transform: scale(1);
    animation: videoEnter 0.5s ease-out;
}

@keyframes videoEnter {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide transition animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Product details animation */
.product-details {
    animation: slideIn 0.5s ease-out;
}

/* Navigation Arrows */
.nav-arrow {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.nav-arrow:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateX(-50%) scale(1.1);
}

.nav-arrow:active {
    transform: translateX(-50%) scale(0.95);
}

.nav-arrow.clicked {
    animation: arrowPulse 0.4s ease-out;
}

@keyframes arrowPulse {
    0% {
        transform: translateX(-50%) scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }

    50% {
        transform: translateX(-50%) scale(1.15);
    }

    100% {
        transform: translateX(-50%) scale(1);
        box-shadow: 0 0 0 15px rgba(255, 255, 255, 0);
    }
}

.prev-arrow {
    top: 20px;
}

.next-arrow {
    bottom: 20px;
}

/* Position Indicator */
.position-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10;
    backdrop-filter: blur(10px);
}

/* Video Controls */
.video-controls {
    position: absolute;
    bottom: 100px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 10;
}

.control-btn {
    width: 45px;
    height: 45px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* Product Details */
.product-details {
    position: absolute;
    background: var(--white);
    z-index: 9;
    right: 0;
    top: 0;
    height: 100vh;
    width: 400px;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    background-color: #fff;
}

.product-content {
    overflow-y: auto;
    height: 100%;
    padding: 30px;
}

/* Mobile Drag Handle */
.mobile-drag-handle {
    display: none;
    width: 40px;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    margin: 0 auto 15px;
}

/* Action Buttons */
.product-actions {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.btn {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: opacity 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--text-dark);
    color: var(--text-dark);
}

/* Mobile Specific Styles */
@media (max-width: 768px) {
    .reels-modal-content {
        flex-direction: column;
    }

    .video-container {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
    }

    .product-details {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        height: auto;
        z-index: 2;
        background: transparent;
        box-shadow: none;
    }

    .product-content {
        position: relative;
        width: 100%;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.7) 60%, transparent 100%);
        color: white;
        padding: 15px 20px 20px;
        border-radius: 0;
        overflow: hidden;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateY(0);
        max-height: auto;
    }

    /* Collapsed state - only show product header card (2-3 lines) */
    .product-content:not(.expanded) {
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

    .product-content:not(.expanded) .product-header-card {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 0;
    }

    .product-content:not(.expanded) .product-header-card .card-thumb {
        width: 50px;
        height: 50px;
        border-radius: 8px;
        object-fit: cover;
        flex-shrink: 0;
    }

    .product-content:not(.expanded) .product-header-card .card-info {
        flex: 1;
        min-width: 0;
    }

    .product-content:not(.expanded) .product-header-card .product-title {
        font-size: 0.95rem;
        font-weight: 600;
        margin: 0 0 4px 0;
        color: white;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        line-height: 1.3;
    }

    .product-content:not(.expanded) .product-header-card .product-price {
        font-size: 0.9rem;
        color: white;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    }

    .product-content:not(.expanded) .product-header-card .card-cta {
        display: none;
    }

    /* Hide all other content in collapsed state */
    .product-content:not(.expanded) .mobile-drag-handle {
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.5);
        border-radius: 2px;
        margin: 0 auto 10px;
        cursor: grab;
    }

    .product-content:not(.expanded) .product-body-details {
        display: none;
    }

    /* EXPANDED STATE */
    .product-content.expanded {
        background: var(--white);
        color: var(--text-dark);
        padding: 20px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        max-height: 75vh;
        overflow-y: auto;
        transform: translateY(0);
        border-radius: 20px 20px 0 0;
    }

    .product-content.expanded .mobile-drag-handle {
        display: block;
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        margin: 0 auto 15px;
        cursor: grab;
    }

    .product-content.expanded .product-header-card {
        display: flex;
        align-items: center;
        gap: 15px;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid #eee;
    }

    .product-content.expanded .product-header-card .card-thumb {
        width: 80px;
        height: 80px;
    }

    .product-content.expanded .product-header-card .product-title {
        color: var(--text-dark);
        font-size: 1.2rem;
        margin-bottom: 8px;
        text-shadow: none;
        -webkit-line-clamp: unset;
        display: block;
    }

    .product-content.expanded .product-header-card .product-price {
        color: var(--primary-color);
        text-shadow: none;
    }
}

/* Desktop styles for product header card */
.product-header-card {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.product-header-card .card-thumb {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.product-header-card .card-info {
    flex: 1;
    min-width: 0;
}

.product-header-card .product-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-dark);
}

.product-header-card .product-price {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
}

.product-header-card .card-cta {
    flex-shrink: 0;
    padding: 10px 20px;
    white-space: nowrap;
    display: none;
}

.product-description {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 25px;
}

.product-features {
    margin-bottom: 30px;
}

.product-features h4 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.product-features ul {
    list-style: none;
}

.product-features li {
    padding: 8px 0;
    color: var(--text-light);
    display: flex;
    align-items: start;
}

.product-features li::before {
    content: "✓";
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 10px;
}

.product-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #000;
    color: var(--bg-light);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 157, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* Desktop Styles */
@media (min-width: 768px) {
    .close-btn {
        top: 20px;
        right: 420px;
        z-index: 1002;
    }

    .video-container {
        margin-right: 400px;
    }

    .video-wrapper {
        max-width: 450px;
    }
}

/* Mobile Styles */
@media (max-width: 767px) {
    header h1 {
        font-size: 1.8rem;
    }

    .reels-grid-container {
        padding: 0 40px;
    }

    .reels-grid {
        gap: 15px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .reel-card {
        flex: 0 0 200px;
        width: 200px;
    }

    .slider-nav {
        width: 40px;
        height: 40px;
    }

    .slider-nav svg {
        width: 20px;
        height: 20px;
    }

    .video-container {
        max-width: 100%;
        flex: 1;
    }

    .video-wrapper {
        max-width: 100%;
    }

    .nav-arrow {
        width: 40px;
        height: 40px;
    }

    .prev-arrow {
        top: 60px;
    }

    .next-arrow {
        bottom: 150px;
    }

    .close-btn {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
    }

    /* Mobile product details styles are now in the main mobile section above */

    .product-header {
        margin-bottom: 15px;
        padding-top: 15px;
    }

    .product-title {
        font-size: 1.2rem;
    }

    .current-price {
        font-size: 1.4rem;
    }

    .original-price {
        font-size: 1rem;
    }

    .product-actions {
        position: sticky;
        bottom: 0;
        background: var(--white);
        padding: 15px 0 0;
        margin: 0 -20px;
        padding: 15px 20px;
        border-top: 1px solid #eee;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    /* Adjust widget for mobile */
    .reel-widget {
        bottom: 80px;
        /* Above bottom nav if exists */
        left: 15px;
        width: 100px;
        height: 177px;
    }
}

/* Tablet Styles */
@media (min-width: 768px) and (max-width: 1024px) {
    .product-details {
        width: 350px;
    }

    .video-container {
        margin-right: 350px;
    }
}