/* ==========================================================================
   SAGMART - Trending Reels & YouTube Video Sections
   Modern, responsive, touch-friendly video card layouts and lightbox modal.
   ========================================================================== */

/* --------------------------------------------------------------------------
   SHARED HEADERS & BADGES
   -------------------------------------------------------------------------- */
.reels-header,
.yt-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2.25rem;
}

.reels-badge,
.yt-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 0.65rem;
}

.reels-badge {
    background: rgba(85, 119, 92, 0.12);
    color: var(--color-accent, #55775c);
}

.yt-badge {
    background: rgba(255, 0, 0, 0.08);
    color: #cc0000;
}

.section-subtitle {
    color: var(--color-secondary, #555555);
    font-size: 0.95rem;
    margin-top: 0.35rem;
    margin-bottom: 0;
    max-width: 620px;
}

/* Header Buttons & Arrows (Hidden as user requested auto-playing reels with no buttons) */
.reels-nav-arrows {
    display: none !important;
}

/* Live Reels Autoplay Indicator Pill */
.reels-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    padding: 7px 16px;
    border-radius: 9999px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.reels-live-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: liveReelPulse 1.6s infinite;
}

@keyframes liveReelPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.reels-live-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: #ffffff;
}

.yt-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ff0000;
    color: #ffffff !important;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(255, 0, 0, 0.25);
}

.yt-subscribe-btn:hover {
    background: #cc0000;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255, 0, 0, 0.35);
}

/* --------------------------------------------------------------------------
   1. TRENDING REELS CARDS (9:16 Aspect Ratio)
   -------------------------------------------------------------------------- */
.trending-reels-section {
    background: #ffffff;
    overflow: hidden;
}

.reels-grid-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden; /* Clips cards entering and leaving the circular queue */
}

.reels-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 1.25rem;
    overflow: visible;
    padding: 0.5rem 0.25rem 1rem;
    will-change: transform;
}

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

.reel-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    background: #111111;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.35s ease;
    flex: 0 0 calc((100% - (4 * 1.25rem)) / 5);
    width: calc((100% - (4 * 1.25rem)) / 5);
    min-width: calc((100% - (4 * 1.25rem)) / 5);
    max-width: calc((100% - (4 * 1.25rem)) / 5);
    box-sizing: border-box;
}

.reel-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
}

.reel-poster-wrap {
    position: relative;
    width: 100%;
    padding-top: 177.77%; /* Exact 9:16 Vertical Ratio */
    background: #0f172a;
    overflow: hidden;
}

/* Instagram/Reel Top Story Progress Bar (4.5s loop) */
.reel-story-progress-bar {
    position: absolute;
    top: 8px;
    left: 10px;
    right: 10px;
    height: 3px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 9999px;
    overflow: hidden;
    z-index: 6;
}

.reel-story-progress-fill {
    height: 100%;
    width: 0%;
    background: #ffffff;
    border-radius: 9999px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

.reel-fill--1 { animation: reelProgressCycle 4.5s linear infinite; }
.reel-fill--2 { animation: reelProgressCycle 4.9s linear infinite 0.5s; }
.reel-fill--3 { animation: reelProgressCycle 4.4s linear infinite 1.0s; }
.reel-fill--4 { animation: reelProgressCycle 5.1s linear infinite 1.5s; }
.reel-fill--5 { animation: reelProgressCycle 4.7s linear infinite 2.0s; }

@keyframes reelProgressCycle {
    0% { width: 0%; opacity: 1; }
    94% { width: 100%; opacity: 1; }
    98% { width: 100%; opacity: 0; }
    100% { width: 0%; opacity: 0; }
}

/* Reel Media Viewport — Full Card Coverage without Zoom In / Zoom Out */
.reel-media-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    background: #000;
}

/* Instagram iframe embedded inside reel card — 100% card fit */
.reel-instagram-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none; /* Card click redirects directly to reel */
    background: #000;
}

/* HTML5 Video element inside reel card */
.reel-video-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    background: #000;
}

/* Static clean poster without zoom effects */
.reel-clean-poster,
.reel-motion-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: none !important;
    animation: none !important;
}

/* Product Tag Only Container */
.reel-info--product-only {
    padding: 12px;
}

/* Subtle Light Sweep to simulate live dynamic camera lens flare */
.reel-light-sweep {
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    transform: skewX(-25deg);
    animation: reelLightPass 4.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}

@keyframes reelLightPass {
    0% { left: -120%; }
    30% { left: 160%; }
    100% { left: 160%; }
}

/* Top Reel Overlay Pills */
.reel-top-bar {
    position: absolute;
    top: 18px;
    left: 14px;
    right: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 4;
}

.reel-icon-pill,
.reel-views-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 9999px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.reel-icon-pill {
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Animated Audio Equalizer */
.reel-audio-equalizer {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 11px;
    margin-right: 3px;
}

.reel-audio-equalizer .eq-bar {
    width: 2px;
    background: #ffffff;
    border-radius: 2px;
    display: inline-block;
}

.eq-1 { animation: eqJump 0.8s ease-in-out infinite alternate; }
.eq-2 { animation: eqJump 1.1s ease-in-out infinite 0.2s alternate; }
.eq-3 { animation: eqJump 0.9s ease-in-out infinite 0.4s alternate; }
.eq-4 { animation: eqJump 1.2s ease-in-out infinite 0.1s alternate; }

@keyframes eqJump {
    0% { height: 2px; }
    100% { height: 11px; }
}

.reel-views-pill {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.reel-card:hover .reel-video-bg {
    transform: scale(1.05);
}

.reel-play-btn {
    display: none !important;
}

/* Top overlay pills removed per user request */
.reel-top-bar,
.reel-creator,
.reel-title {
    display: none !important;
}

/* Gradient Overlay at bottom for product pill contrast */
.reel-gradient-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 2;
    pointer-events: none;
}

/* Bottom Reel Content */
.reel-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reel-creator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.reel-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #ffffff;
}

.reel-creator-name {
    color: #f0f0f0;
    font-size: 0.75rem;
    font-weight: 600;
}

.reel-verified-badge {
    background: #2086fe;
    color: #ffffff;
    font-size: 9px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.reel-title {
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Product Tag Pill */
.reel-product-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 6px 10px;
    border-radius: 12px;
    text-decoration: none;
    color: #ffffff;
    transition: all 0.25s ease;
    margin-top: 4px;
}

.reel-product-pill:hover {
    background: #ffffff;
    color: var(--color-primary, #111111);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.product-tag-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.product-tag-title {
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-tag-price {
    font-size: 0.75rem;
    font-weight: 800;
    color: #7aff9b;
}

.reel-product-pill:hover .product-tag-price {
    color: var(--color-accent, #55775c);
}


/* --------------------------------------------------------------------------
   2. YOUTUBE VIDEO CARDS (16:9 Aspect Ratio)
   -------------------------------------------------------------------------- */
.youtube-videos-section {
    background: var(--color-bg-alt, #f9f9f9);
    border-top: 1px solid var(--color-border, #eaeaea);
    border-bottom: 1px solid var(--color-border, #eaeaea);
}

.yt-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
}

.yt-card {
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--color-border, #eaeaea);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.yt-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.1);
}

/* 16:9 Thumbnail */
.yt-thumbnail-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Ratio */
    background: #000000;
    overflow: hidden;
}

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

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

/* Card Pill */
.yt-card-pill {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 6px;
    z-index: 2;
}

/* Red Center YouTube Play Button */
.yt-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 3;
    transition: all 0.3s ease;
}

.yt-play-icon {
    width: 58px;
    height: 40px;
    background: #ff0000;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s ease, background 0.25s ease;
}

.yt-card:hover .yt-play-button {
    transform: translate(-50%, -50%) scale(1.12);
}

.yt-card:hover .yt-play-icon {
    background: #cc0000;
}

/* Duration Pill */
.yt-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 4px;
    z-index: 2;
}

/* Meta Details Below Thumbnail */
.yt-meta-wrap {
    padding: 1.25rem;
    display: flex;
    gap: 12px;
    flex: 1;
}

.yt-channel-avatar-wrap {
    flex-shrink: 0;
}

.yt-channel-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.yt-content-info {
    flex: 1;
    min-width: 0;
}

.yt-video-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--color-primary, #111111);
    line-height: 1.4;
    margin: 0 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.yt-card:hover .yt-video-title {
    color: var(--color-accent, #55775c);
}

.yt-channel-line {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    color: var(--color-secondary, #555555);
    font-weight: 600;
    margin-bottom: 2px;
}

.yt-verified {
    font-size: 10px;
    color: #888888;
}

.yt-stats-line {
    font-size: 0.78rem;
    color: var(--color-muted, #888888);
    display: flex;
    gap: 6px;
    align-items: center;
}

.yt-dot {
    font-size: 0.6rem;
}


/* --------------------------------------------------------------------------
   3. UNIVERSAL VIDEO LIGHTBOX MODAL
   -------------------------------------------------------------------------- */
.sagmart-video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.sagmart-video-modal.active {
    display: flex;
    animation: modalFadeIn 0.3s ease;
}

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

.sagmart-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.sagmart-modal-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 860px;
    background: #000000;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    animation: modalZoomIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes modalZoomIn {
    to { transform: scale(1); }
}

.sagmart-modal-container.is-reel-modal {
    max-width: 420px;
    height: 82vh;
    border-radius: 24px;
}

.sagmart-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
}

.sagmart-modal-close:hover {
    background: #ffffff;
    color: #000000;
    transform: rotate(90deg);
}

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

.sagmart-modal-media iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    display: block;
}

.sagmart-modal-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


/* --------------------------------------------------------------------------
   RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .reel-card {
        flex: 0 0 calc((100% - (3 * 1.25rem)) / 4);
        width: calc((100% - (3 * 1.25rem)) / 4);
        min-width: calc((100% - (3 * 1.25rem)) / 4);
        max-width: calc((100% - (3 * 1.25rem)) / 4);
    }
}

@media (max-width: 992px) {
    .yt-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .reel-card {
        flex: 0 0 calc((100% - (2 * 1rem)) / 3);
        width: calc((100% - (2 * 1rem)) / 3);
        min-width: calc((100% - (2 * 1rem)) / 3);
        max-width: calc((100% - (2 * 1rem)) / 3);
    }
}

@media (max-width: 768px) {
    .reels-header,
    .yt-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .reels-grid {
        gap: 1rem;
    }

    .reel-card {
        flex: 0 0 240px;
        min-width: 240px;
        max-width: 240px;
    }

    .yt-cards-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .sagmart-modal-container.is-reel-modal {
        width: 100%;
        height: 75vh;
    }
}

/* ================================================
   KEN-BURNS ANIMATION + REEL EFFECTS (v1.1.5)
   ================================================ */

/* Ken-Burns animation for reel images */
@keyframes kenBurns1 {
    0%   { transform: scale(1.0) translate(0, 0); }
    25%  { transform: scale(1.08) translate(-1%, 1%); }
    50%  { transform: scale(1.12) translate(1%, -1%); }
    75%  { transform: scale(1.06) translate(-0.5%, 0.5%); }
    100% { transform: scale(1.0) translate(0, 0); }
}
@keyframes kenBurns2 {
    0%   { transform: scale(1.05) translate(0.5%, 0.5%); }
    33%  { transform: scale(1.12) translate(-1%, -0.5%); }
    66%  { transform: scale(1.08) translate(0.5%, 1%); }
    100% { transform: scale(1.05) translate(0.5%, 0.5%); }
}
@keyframes kenBurns3 {
    0%   { transform: scale(1.1) translate(-1%, 0); }
    50%  { transform: scale(1.0) translate(1%, -1%); }
    100% { transform: scale(1.1) translate(-1%, 0); }
}
@keyframes reelScanline {
    0%   { background-position: 0 0; }
    100% { background-position: 0 100%; }
}

.reel-poster {
    animation: kenBurns1 8s ease-in-out infinite;
    transform-origin: center center;
    will-change: transform;
}
.reel-card:nth-child(2) .reel-poster { animation-name: kenBurns2; animation-duration: 9s; }
.reel-card:nth-child(3) .reel-poster { animation-name: kenBurns3; animation-duration: 7s; }
.reel-card:nth-child(4) .reel-poster { animation-name: kenBurns1; animation-duration: 10s; animation-delay: -3s; }
.reel-card:nth-child(5) .reel-poster { animation-name: kenBurns2; animation-duration: 8s; animation-delay: -5s; }

/* Scanline/film grain overlay to make it look like video */
.reel-poster-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0,0,0,0.015) 2px,
        rgba(0,0,0,0.015) 4px
    );
    border-radius: inherit;
}

/* Pulsing play button to indicate it's a playing reel */
@keyframes reelPlayPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.5), 0 4px 20px rgba(0,0,0,0.3); transform: translate(-50%, -50%) scale(1); }
    50% { box-shadow: 0 0 0 12px rgba(255,255,255,0), 0 4px 20px rgba(0,0,0,0.3); transform: translate(-50%, -50%) scale(1.08); }
}
.reel-play-btn {
    animation: reelPlayPulse 2s ease-in-out infinite;
}

/* ================================================
   VIEW MORE BUTTONS (Instagram / YouTube)
   ================================================ */
.section-view-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.25s ease;
    letter-spacing: 0.02em;
}
.section-view-more-btn--insta {
    background: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
    color: #ffffff !important;
    box-shadow: 0 4px 16px rgba(253, 29, 29, 0.25);
}
.section-view-more-btn--insta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(253, 29, 29, 0.4);
}
.section-view-more-btn--yt {
    background: #ff0000;
    color: #ffffff !important;
    box-shadow: 0 4px 16px rgba(255, 0, 0, 0.25);
}
.section-view-more-btn--yt:hover {
    background: #cc0000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 0, 0.4);
}
