/* ========================================
   PROFESSIONAL REEL PLAYER STYLES
   Modern, Stylish & Performance Optimized
   Optimized for Mobile WebView & High Traffic
   ======================================== */

/* ============ CSS VARIABLES ============ */
:root {
    /* Brand Colors */
    --gold-primary: #FFD700;
    --gold-secondary: #FFA500;
    --gold-dark: #DAA520;
    
    /* Gradients */
    --cta-gradient: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    
    /* Glass Morphism */
    --glass-blur: blur(12px);
    
    /* Shadows - Optimized for GPU */
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-Index Scale */
    --z-video: 1;
    --z-thumbnail: 2;
    --z-ui-layer: 20;
    --z-cta: 30;
}

/* ============ BASE RESET ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: #000;
    color: #fff;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100vh;
    overscroll-behavior: none;
    user-select: none; 
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* ============ REELS CONTAINER ============ */
.reels-list {
    height: 100vh;
    width: 100%;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none; 
    -ms-overflow-style: none; 
    will-change: scroll-position;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.reels-list::-webkit-scrollbar {
    display: none; 
}

/* ============ REEL CARD ============ */
.reel-card {
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    overflow: hidden;
    isolation: isolate;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    contain: strict;
    transform: translateZ(0); 
}

/* Special Decorative Frame Container */
.reel-card::before {
    content: '';
    position: absolute;
    inset: 20px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 24px;
    background: linear-gradient(#0a0a0a, #0a0a0a) padding-box,
                linear-gradient(135deg, 
                    var(--gold-primary) 0%,
                    #FF6B6B 25%,
                    #4ECDC4 50%,
                    #A78BFA 75%,
                    var(--gold-primary) 100%) border-box;
    z-index: 1;
    pointer-events: none;
    box-shadow: inset 0 0 40px rgba(255, 215, 0, 0.1), 0 0 60px rgba(255, 215, 0, 0.15);
    animation: frame-glow-opacity 4s ease-in-out infinite;
    will-change: opacity;
}

.reel-card::after {
    content: '';
    position: absolute;
    inset: 20px;
    border-radius: 24px;
    background: transparent;
    z-index: 2;
    pointer-events: none;
    box-shadow: 
        inset 0 0 80px rgba(255, 215, 0, 0.05),
        inset 20px 20px 40px rgba(255, 107, 107, 0.02),
        inset -20px -20px 40px rgba(78, 205, 196, 0.02);
}

@keyframes frame-glow-opacity {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* ============ VIDEO AREA ============ */
.video-wrapper {
    position: absolute;
    inset: 30px;
    width: calc(100% - 60px);
    height: calc(100% - 60px);
    z-index: var(--z-video);
    background: #000;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

.video-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: auto;
    border-radius: 20px;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform;
}

/* Thumbnail Facade */
.thumb-facade {
    position: absolute;
    inset: 30px;
    width: calc(100% - 60px);
    height: calc(100% - 60px);
    object-fit: cover;
    z-index: var(--z-thumbnail);
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    transition: opacity var(--transition-smooth);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: translateZ(0);
    will-change: opacity;
}

.thumb-facade.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* ============ UI LAYER ============ */
.ui-layer {
    position: absolute;
    inset: 0;
    z-index: var(--z-ui-layer);
    pointer-events: none;
    transform: translateZ(0);
}

.ui-layer * {
    pointer-events: auto;
}

/* ============ HEADER BRANDING ============ */
.header-pill {
    position: absolute;
    top: 35px;
    left: 35px;
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95) 0%, rgba(20, 20, 20, 0.9) 100%);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 12px 22px;
    border-radius: 50px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform var(--transition-fast), border-color var(--transition-fast);
    cursor: pointer;
    z-index: 25;
}

.header-pill:active {
    transform: scale(0.95);
}

.logo {
    height: 32px;
    width: auto;
    border-radius: 8px;
    filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.3));
}

.brand-text {
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, var(--gold-primary) 0%, #FFA500 50%, #FFD700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

/* ============ ACTION BUTTONS SIDEBAR ============ */
.matrix-bar {
    position: absolute;
    bottom: 200px;
    right: 35px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
    z-index: 25;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #fff;
    cursor: pointer;
    transition: transform var(--transition-fast);
    position: relative;
    padding: 5px; 
}

.action-btn:active {
    transform: scale(0.9);
}

.icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(40, 40, 40, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.stats-text {
    font-size: 12px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.3px;
}

/* ============ LOCKED TO BOTTOM OF VIDEO LAYOUT ============ */
.bottom-center-overlay {
    position: absolute;
    /* Exactly match the inset of the video wrapper so it sits perfectly inside the video's bottom edge */
    bottom: 30px; 
    left: 30px;
    width: calc(100% - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    /* Extra top padding pushes text strictly to the bottom; dark gradient protects readability */
    padding: 40px 10px 15px; 
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    z-index: var(--z-cta);
    pointer-events: none; 
}

/* Enable touches for interactive children */
.bottom-center-overlay > * {
    pointer-events: auto;
}

/* Plain Text Details */
.product-details {
    text-align: center;
    margin-bottom: 12px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.9);
}

.product-name {
    font-size: 13px;
    font-weight: 400; /* Plain text */
    color: #fff;
    line-height: 1.4;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-date {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

/* Shop Now Button */
.shop-now-btn {
    text-decoration: none; 
    position: relative;
    background: var(--cta-gradient);
    color: #000;
    padding: 12px 38px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(255, 165, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.3);
    border: 2px solid #fff;
    cursor: pointer;
    overflow: hidden;
    transition: transform var(--transition-fast);
}

.shop-now-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    opacity: 0;
    animation: pulse-ring 2.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.shop-now-btn:active {
    transform: scale(0.95);
}

.shop-now-btn .btn-icon {
    font-size: 18px;
    animation: bounce-icon-transform 2s ease-in-out infinite;
    will-change: transform;
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.3); opacity: 0; }
}

@keyframes bounce-icon-transform {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

/* ============ UTILITY CLASSES ============ */
.hidden {
    display: none !important;
    visibility: hidden !important;
}

.fade-out {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity var(--transition-smooth) !important;
}

/* ============ RESPONSIVE DESIGN (MOBILE FOCUSED) ============ */
@media (max-width: 768px) {
    .reel-card { padding: 15px; }
    .reel-card::before, .reel-card::after { inset: 15px; border-radius: 20px; }
    .video-wrapper, .thumb-facade {
        inset: 25px;
        width: calc(100% - 50px);
        height: calc(100% - 50px);
        border-radius: 16px;
    }
    
    .header-pill { top: 30px; left: 30px; padding: 10px 18px; gap: 12px; }
    .logo { height: 28px; }
    .brand-text { font-size: 11px; letter-spacing: 1.2px; }
    
    .matrix-bar { bottom: 180px; right: 25px; gap: 20px; }
    .icon-circle { width: 48px; height: 48px; font-size: 20px; }
    .stats-text { font-size: 11px; }
    
    /* Lock to bottom inner edge of video on tablet */
    .bottom-center-overlay { 
        bottom: 25px; 
        left: 25px; 
        width: calc(100% - 50px); 
        padding: 30px 10px 15px; 
        border-bottom-left-radius: 16px; 
        border-bottom-right-radius: 16px; 
    }
    .product-name { font-size: 12px; }
    .post-date { font-size: 10px; }
    .shop-now-btn { padding: 11px 32px; font-size: 14px; letter-spacing: 1.5px; }
    .shop-now-btn .btn-icon { font-size: 16px; }
}

@media (max-width: 480px) {
    .reel-card { padding: 12px; }
    .reel-card::before, .reel-card::after { inset: 12px; border-radius: 16px; }
    .video-wrapper, .thumb-facade {
        inset: 22px;
        width: calc(100% - 44px);
        height: calc(100% - 44px);
        border-radius: 14px;
    }
    
    .header-pill { top: 27px; left: 27px; padding: 8px 16px; gap: 10px; }
    .logo { height: 26px; }
    .brand-text { font-size: 10px; letter-spacing: 1px; }
    
    .matrix-bar { gap: 18px; right: 20px; bottom: 160px; }
    .icon-circle { width: 44px; height: 44px; font-size: 18px; }
    
    /* Lock to bottom inner edge of video on mobile */
    .bottom-center-overlay { 
        bottom: 22px; 
        left: 22px; 
        width: calc(100% - 44px); 
        padding: 30px 10px 12px; 
        border-bottom-left-radius: 14px; 
        border-bottom-right-radius: 14px; 
    }
    .product-name { font-size: 11px; }
    .post-date { font-size: 9px; }
    .shop-now-btn { padding: 10px 28px; font-size: 13px; letter-spacing: 1px; }
    .shop-now-btn .btn-icon { font-size: 15px; }
}

/* ============ ACCESSIBILITY ============ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============ DECORATIVE CORNER ELEMENTS (GPU OPTIMIZED) ============ */
.reel-card .corner-tl, .reel-card .corner-tr, .reel-card .corner-bl, .reel-card .corner-br {
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: 3;
    pointer-events: none;
    will-change: opacity, transform;
}

.reel-card .corner-tl {
    top: 20px; left: 20px;
    border-top: 3px solid var(--gold-primary); border-left: 3px solid var(--gold-primary);
    border-top-left-radius: 24px;
    animation: corner-pulse-gpu 3s ease-in-out infinite;
}

.reel-card .corner-tr {
    top: 20px; right: 20px;
    border-top: 3px solid #FF6B6B; border-right: 3px solid #FF6B6B;
    border-top-right-radius: 24px;
    animation: corner-pulse-gpu 3s ease-in-out infinite 0.75s;
}

.reel-card .corner-bl {
    bottom: 20px; left: 20px;
    border-bottom: 3px solid #4ECDC4; border-left: 3px solid #4ECDC4;
    border-bottom-left-radius: 24px;
    animation: corner-pulse-gpu 3s ease-in-out infinite 1.5s;
}

.reel-card .corner-br {
    bottom: 20px; right: 20px;
    border-bottom: 3px solid #A78BFA; border-right: 3px solid #A78BFA;
    border-bottom-right-radius: 24px;
    animation: corner-pulse-gpu 3s ease-in-out infinite 2.25s;
}

@keyframes corner-pulse-gpu {
    0%, 100% { opacity: 0.4; transform: scale(0.98); }
    50% { opacity: 1; transform: scale(1); }
}
