/* =========================================
   1. VARIABLES & BASICS
   ========================================= */
:root {
    --reel-primary: #ff3b30; /* Buy Now Red */
    --reel-accent: #007aff;  /* Add to Cart Blue */
    --reel-glass: rgba(20, 20, 20, 0.6);
    --reel-glass-border: rgba(255, 255, 255, 0.1);
    --reel-text: #ffffff;
    --reel-radius: 16px;
}

/* Spinner Animation */
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes slideUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* =========================================
   2. CAROUSEL GRID (The Storefront)
   ========================================= */
.reel-collection-carousel {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.rc-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 20px 5px; /* Space for shadows */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}
.rc-track::-webkit-scrollbar { display: none; } /* Chrome/Safari */

/* THE CARD */
.rc-slide {
    flex: 0 0 280px;
    aspect-ratio: 9 / 16;
    border-radius: var(--reel-radius);
    overflow: hidden;
    background: #000;
    cursor: pointer;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform: translateZ(0); /* Hardware accel */
}

.rc-slide:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

.rc-media {
    width: 100%; height: 100%;
    position: relative;
    pointer-events: auto !important;
}
.rc-media video {
    width: 100%; height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* GRADIENT OVERLAY (Readability) */
.rc-media::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    pointer-events: none;
    z-index: 2;
}

.rc-click-overlay { pointer-events: auto; }

/* =========================================
   3. ACTION BUTTONS (Floating Glass)
   ========================================= */
.rc-actions {
    position: absolute;
    bottom: 75px; right: 12px;
    display: flex;
    flex-direction: column; /* Stack vertically like TikTok */
    gap: 10px;
    z-index: 20;
    pointer-events: auto !important;
}

.rc-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1px solid var(--reel-glass-border);
    background: var(--reel-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    display: flex;
    align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.rc-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.1); }
.rc-btn svg { width: 20px; height: 20px; fill: white; }

/* Buy Now is Special */
.rc-btn.rc-buy {
    background: var(--reel-primary);
    border: none;
}

/* Loading State */
.rc-btn.loading svg { display: none; }
.rc-btn.loading::after {
    content: '';
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* PRODUCT INFO */
.rc-bottom {
    position: absolute;
    bottom: 15px; left: 15px; right: 60px; /* Space for buttons */
    z-index: 10;
    pointer-events: none;
    text-align: left;
}
.rc-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.rc-price {
    font-size: 13px;
    color: #eee;
    font-weight: 500;
}

/* =========================================
   4. MODAL (App-Like Experience)
   ========================================= */
.reel-popup {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 999999;
    animation: fadeIn 0.2s ease-out;
}

.reel-popup-inner {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100%; height: 100%;
    max-width: 420px; /* Mobile width constraint */
    max-height: 850px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    overflow: hidden;
}

/* Desktop: Make it look like a phone */
@media (min-width: 768px) {
    .reel-popup-inner {
        height: 85vh;
        border-radius: 20px;
    }
}

.shopping-reel {
    width: 100%; height: 100%;
    position: relative;
    background: #000;
    margin: 0;
    max-width: none;
    border-radius: 0;
    aspect-ratio: auto; /* Reset aspect ratio for full fill */
}

/* Modal Close Button */
.reel-close {
    position: absolute;
    top: 20px; right: 20px;
    background: rgba(255,255,255,0.1);
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 1000000;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.reel-close:hover { background: rgba(255,255,255,0.3); }

/* Modal Floating Products */
.reel-floating-controls {
    bottom: 40px; right: 15px;
    align-items: flex-end;
}
.reel-btn {
    width: 50px; height: 50px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    font-size: 20px; /* Icon size */
}
.reel-btn.buy-now {
    width: auto;
    border-radius: 30px;
    padding: 0 24px;
    background: var(--reel-primary);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =========================================
   5. TOAST NOTIFICATION (Sleek)
   ========================================= */
.reel-toast {
    position: fixed;
    bottom: 30px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 30, 30, 0.95);
    color: white;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1000000;
    display: flex; align-items: center; gap: 10px;
}
.reel-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}
.reel-toast svg { width: 18px; fill: #4cd964; }

/* Mobile Optimizations */
@media (max-width: 768px) {
    .rc-slide { flex: 0 0 45%; } /* Show 2.x items */
    .rc-btn { width: 38px; height: 38px; }
}

/* =========================================
   FIX: NAVIGATION ARROWS (Theme-Proof)
   ========================================= */
.reel-collection-carousel .rc-prev, 
.reel-collection-carousel .rc-next {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.9) !important; /* White circle */
    color: #000 !important; /* Black arrow */
    font-size: 24px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    z-index: 100 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    transition: transform 0.2s ease, background 0.2s ease !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Hover Effect */
.reel-collection-carousel .rc-prev:hover, 
.reel-collection-carousel .rc-next:hover {
    background: #fff !important;
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.4) !important;
}

/* Positioning */
.reel-collection-carousel .rc-prev {
    left: 10px !important;
}
.reel-collection-carousel .rc-next {
    right: 10px !important;
}

/* Hide arrows on mobile if you prefer swipe only */
@media (max-width: 768px) {
    .reel-collection-carousel .rc-prev, 
    .reel-collection-carousel .rc-next {
        display: none !important;
    }
}