/* ============================================
   AUTOPLAY LIVE STREAMING - RECEIVER
   Enterprise-grade viewer experience
   ============================================ */

/* Mo.js animation elements - ensure they're visible above everything */
[id^="mo-"]:not([class]),
.mo-js-svg,
body > svg:not([class]) {
    z-index: 99999 !important;
    pointer-events: none !important;
}

:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --primary-light: #a78bfa;
    --accent: #f472b6;
    --accent-dark: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --live-red: #ef4444;
    
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(26, 26, 37, 0.8);
    --bg-glass: rgba(18, 18, 26, 0.85);
    
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    
    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    --sidebar-width: 380px;
    --mobile-nav-height: 70px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.3);
    
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

/* ============================================
   BASE STYLES
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    background: var(--bg-primary);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    background: transparent;
    color: inherit;
}

input, textarea {
    font-family: inherit;
    border: none;
    outline: none;
    background: transparent;
}

/* ============================================
   APP CONTAINER
   ============================================ */

.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-primary);
}

/* ============================================
   VIDEO SECTION
   ============================================ */

.video-section {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

.video-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 1;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#vidContainer {
    visibility: hidden;
    z-index: 2;
}

/* PIP Background Video - Fills main video area when content is in PIP window */
#pipVidContainer {
    visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    background: var(--bg-primary);
    transition: opacity 0.3s ease;
}

#pipVidContainer video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.85;
}

/* Optional: Add a subtle overlay/effect when PIP is active */
#pipVidContainer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, 0.3) 100%
    );
    pointer-events: none;
}

/* Unmute Prompt - Centered over video */
.unmute-prompt {
    display: none;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 100;
    cursor: pointer;
    /* Use flexbox to center the content */
    align-items: center;
    justify-content: center;
    /* Don't block clicks when hidden */
    pointer-events: none;
    /* Ensure it's properly positioned in video section */
    margin: 0 !important;
    padding: 0 !important;
}

.unmute-prompt.visible {
    display: flex !important;
    /* Only capture clicks when visible */
    pointer-events: auto;
}

.unmute-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    animation: pulse-unmute 2s ease-in-out infinite;
    /* Ensure content doesn't stretch */
    flex-shrink: 0;
}

.unmute-content i {
    font-size: 24px;
    color: var(--primary-light);
}

.unmute-content span {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

@keyframes pulse-unmute {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

/* Unmute Prompt - Mobile Responsive */
@media (max-width: 768px) {
    .unmute-prompt {
        /* Ensure full coverage on mobile */
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    .unmute-content {
        padding: 10px 20px;
        gap: 8px;
    }

    .unmute-content i {
        font-size: 16px;
    }

    .unmute-content span {
        font-size: 12px;
        font-weight: 500;
    }
}

@media (max-width: 480px) {
    .unmute-prompt {
        /* Ensure full coverage on small mobile */
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    .unmute-content {
        padding: 8px 16px;
        gap: 6px;
    }

    .unmute-content i {
        font-size: 14px;
    }

    .unmute-content span {
        font-size: 11px;
    }
}

/* Video Overlay */
.video-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.video-overlay > * {
    pointer-events: auto;
}

/* Overlay Top */
.overlay-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
}

.live-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(20, 20, 30, 0.9));
    backdrop-filter: blur(20px);
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.live-indicator.visible {
    display: flex;
    animation: fadeSlideIn 0.4s ease-out;
}

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

.live-dot {
    width: 10px;
    height: 10px;
    background: var(--live-red);
    border-radius: 50%;
    animation: livePulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px var(--live-red), 0 0 24px rgba(239, 68, 68, 0.4);
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 12px var(--live-red); }
    50% { opacity: 0.7; transform: scale(1.3); box-shadow: 0 0 20px var(--live-red), 0 0 40px rgba(239, 68, 68, 0.5); }
}

.live-text {
    font-size: 12px;
    font-weight: 800;
    color: var(--live-red);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.viewer-count {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.viewer-count i {
    font-size: 12px;
    color: var(--primary-light);
}

.viewer-count span {
    min-width: 20px;
    text-align: center;
}

.show-timer {
    display: none;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    position: absolute;
    top: 16px;
    right: 16px; /* Top RIGHT corner of video */
    z-index: 100;
    pointer-events: none;
}

.show-timer.visible {
    display: flex;
    align-items: center;
    gap: 0;
}

@media (max-width: 768px) {
    .show-timer {
        top: 12px;
        right: 12px;
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* Show timer in fullscreen mode */
body.fullscreen-active .show-timer {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 100001 !important;
}

/* Overlay Bottom */
.overlay-bottom {
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    position: relative;
    z-index: 100;
    pointer-events: auto;
}

.progress-container {
    display: none;
    position: relative;
        width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-bottom: 12px;
    cursor: pointer;
}

.progress-container.visible {
    display: block;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    width: 0%;
    transition: width 100ms linear;
}

.scrubber {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: var(--text-primary);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.progress-container:hover .scrubber {
    opacity: 1;
}

.time-display {
    display: none;
    font-size: 13px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.time-display.visible {
    display: block;
}

.time-separator {
    margin: 0 4px;
    color: var(--text-muted);
}

/* Control Buttons */
.control-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    position: relative;
    z-index: 100;
}

.control-btn {
    pointer-events: auto !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    backdrop-filter: blur(20px);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.control-btn i {
    font-size: 16px;
}

.control-btn .btn-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.control-btn.muted {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(239, 68, 68, 0.15));
    color: #ff6b6b;
    border-color: rgba(239, 68, 68, 0.3);
}

.control-btn.muted:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.35), rgba(239, 68, 68, 0.2));
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.2);
}

/* Hide PIP button - auto PIP activates when user interacts with products */
#pipBtn {
    display: none !important;
}

.reaction-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px 20px;
    border: 1px solid var(--glass-border);
}

.reaction-btn:hover {
    transform: scale(1.05);
    background: var(--glass-bg-hover);
}

.reaction-btn i {
    color: white;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Reactions Container */
.reactions-container {
    position: absolute;
    bottom: 100px;
    right: calc(var(--sidebar-width) + 40px);
    width: 60px;
    height: 200px;
    pointer-events: none;
    z-index: 50;
    overflow: visible;
}

.floating-reaction {
    position: absolute;
    bottom: 0;
    font-size: 28px;
    animation: floatUp 3s ease-out forwards;
    pointer-events: none;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }
    10% {
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateY(-300px) scale(0.5);
        opacity: 0;
    }
}

/* Video Loader */
.video-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 20;
    transition: opacity 0.3s ease;
}

.video-loader lottie-player {
    width: 120px;
    height: 120px;
}

.video-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   SKELETON LOADERS - Progressive Loading UX
   ============================================ */

@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.8;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

.skeleton-pulse {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* Video Section Skeleton */
.video-skeleton {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    z-index: 50; /* Above all video elements and overlays */
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.video-skeleton.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.video-skeleton-content {
    text-align: center;
}

.video-skeleton-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: skeleton-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
}

.video-skeleton-icon i {
    font-size: 32px;
    color: white;
}

.video-skeleton-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.video-skeleton-bar {
    width: 200px;
    height: 4px;
    margin: 16px auto 0;
    border-radius: 2px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.video-skeleton-bar-fill {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    animation: loading-bar 1.5s ease-in-out infinite;
}

@keyframes loading-bar {
    0% {
        width: 0%;
        margin-left: 0%;
    }
    50% {
        width: 60%;
        margin-left: 20%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* Products Skeleton */
.products-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px;
}

.products-skeleton.hidden {
    display: none;
}

.product-skeleton-card {
    display: flex;
    background: linear-gradient(135deg, rgba(30, 30, 45, 0.95), rgba(20, 20, 35, 0.98));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 80px;
}

.product-skeleton-image {
    width: 80px;
    min-width: 80px;
    height: 80px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.product-skeleton-info {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.product-skeleton-title {
    height: 12px;
    width: 85%;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.product-skeleton-site {
    height: 8px;
    width: 30%;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.product-skeleton-desc {
    height: 8px;
    width: 70%;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    animation-delay: 0.1s;
}

.product-skeleton-price {
    height: 10px;
    width: 40%;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        rgba(16, 185, 129, 0.1) 0%,
        rgba(16, 185, 129, 0.2) 50%,
        rgba(16, 185, 129, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    animation-delay: 0.2s;
}

/* Chat Skeleton */
.chat-skeleton {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

.chat-skeleton.hidden {
    display: none;
}

.chat-skeleton-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.chat-skeleton-message.right {
    flex-direction: row-reverse;
}

.chat-skeleton-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.chat-skeleton-bubble {
    flex: 1;
    max-width: 70%;
}

.chat-skeleton-name {
    height: 12px;
    width: 80px;
    margin-bottom: 8px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.chat-skeleton-text {
    height: 16px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
    padding: 12px;
}

.chat-skeleton-text.short {
    width: 60%;
}

.chat-skeleton-text.medium {
    width: 80%;
}

.chat-skeleton-text.long {
    width: 100%;
}

/* Chat loading indicator */
.chat-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.chat-loading-indicator.hidden {
    display: none;
}

.chat-loading-dots {
    display: flex;
    gap: 4px;
}

.chat-loading-dots span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: chat-dot-bounce 1.4s ease-in-out infinite;
}

.chat-loading-dots span:nth-child(1) { animation-delay: 0s; }
.chat-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chat-dot-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(15, 15, 22, 0.98) 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform var(--transition-normal);
    z-index: 100;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.3);
}

.sidebar.collapsed {
    transform: translateX(100%);
    margin-left: calc(-1 * var(--sidebar-width));
}

/* When sidebar is collapsed, video section expands */
.app-container:has(.sidebar.collapsed) .video-section {
    flex: 1;
}

.app-container:has(.sidebar.collapsed) .reactions-container {
    right: 40px;
}

.sidebar-toggle {
    position: absolute;
    left: -44px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 80px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
    border-right: none;
}

.sidebar-toggle:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    padding: 16px;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid transparent;
}

.tab-btn i {
    font-size: 16px;
    transition: transform 0.2s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.08);
}

.tab-btn:hover i {
    transform: scale(1.1);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-primary);
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
}

.tab-btn i {
    font-size: 16px;
}

.chat-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    background: var(--accent);
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
}

.chat-badge.visible {
    display: flex;
}

/* Sidebar Panels */
.sidebar-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.sidebar-panel.active {
    display: flex;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), transparent);
}

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.panel-header h3 i {
    color: var(--primary-light);
    font-size: 14px;
}

.product-count {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
}

.chat-viewer-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 4px 10px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: var(--radius-full);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.chat-viewer-count i {
    animation: liveGlow 2s ease-in-out infinite;
}

@keyframes liveGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Products Grid - Compact list layout */
.products-grid {
    flex: 1;
    padding: 16px;
    padding-bottom: 40px; /* Extra padding to ensure last card isn't clipped */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    -webkit-overflow-scrolling: touch;
    min-height: 0; /* Allow proper flex shrinking */
}

/* iFramely Embed Container - Consistent card heights */
/* Safari/Chrome compatible - 185px minimum to show full card with price */
.iframely-embed {
    display: block !important;
    width: 100% !important;
    min-height: 185px !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    -webkit-overflow-scrolling: touch;
    cursor: pointer;
}

.iframely-responsive {
    display: block !important;
    width: 100% !important;
    min-height: 185px !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    padding-bottom: 0 !important;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Ensure iframely internal elements don't clip */
.iframely-embed *,
.iframely-responsive * {
    max-height: none !important;
}

/* Safari-specific fix for iframely cards */
@supports (-webkit-touch-callout: none) {
    .iframely-embed,
    .iframely-responsive {
        min-height: 185px !important;
        height: auto !important;
        overflow: visible !important;
    }
}

/* ============================================
   iFramely Enterprise Product Cards (Compact)
   Matching broadcaster style
   ============================================ */

.iframely-product-card,
.product-card {
    position: relative;
    background: linear-gradient(135deg, rgba(30, 30, 45, 0.95), rgba(20, 20, 35, 0.98));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-lg);
    overflow: visible;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    /* Fixed height to prevent clipping */
    min-height: 100px;
    height: auto;
    flex-shrink: 0;
}

.iframely-product-card:hover,
.product-card:hover {
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.15);
}

/* Card Link */
.product-card-link {
    display: flex;
    text-decoration: none;
    color: inherit;
}

/* Card Image - Compact */
.product-card-image {
    width: 80px;
    min-width: 80px;
    height: 80px;
    min-height: 80px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.iframely-product-card:hover .product-card-image img,
.product-card:hover .product-card-image img {
    transform: scale(1.05);
}

.product-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 24px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(139, 92, 246, 0.05));
}

/* Card Content - Compact */
.product-card-content {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

/* Site Info */
.product-card-site {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 4px;
}

.product-card-favicon {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.product-card-site span {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Title */
.product-card-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Description */
.product-card-description {
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

/* Footer */
.product-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.product-card-price {
    font-size: 12px;
    font-weight: 700;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.product-card-brand {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Skeleton Loading */
.iframely-product-card.skeleton,
.product-card.skeleton {
    pointer-events: none;
}

.skeleton-shimmer {
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.03) 25%, 
        rgba(255,255,255,0.08) 50%, 
        rgba(255,255,255,0.03) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-line {
    height: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    margin-bottom: 6px;
}

.skeleton-line.short {
    width: 40%;
}

.skeleton-line.medium {
    width: 70%;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Legacy card info styling (fallback) */
.product-card-info {
    padding: 10px;
}

/* Product card loading state */
.product-card-image.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card-skeleton {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-card) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.products-empty {
    grid-column: 1 / -1;
    display: none; /* Hidden by default - shown only after confirming no products */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.products-empty.visible {
    display: flex;
}

.products-empty .empty-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.products-empty .empty-icon i {
    font-size: 28px;
    color: var(--primary);
    opacity: 0.7;
}

.products-empty h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.products-empty p {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 200px;
    line-height: 1.4;
}

/* ============================================
   MODERN CHAT PANEL
   ============================================ */

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

/* Chat Message - Matching Broadcaster Style */
.chat-message {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 8px;
    position: relative;
    transition: all 0.3s ease;
    animation: messageSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-message:hover {
    background: var(--bg-elevated);
}

.chat-message.own {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
}

@keyframes messageSlideIn {
    from { 
        opacity: 0; 
        transform: translateY(15px) scale(0.95);
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1);
    }
}

/* Avatar */
.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

.chat-avatar.host-avatar {
    background: linear-gradient(135deg, #8b5cf6, #ec4899) !important;
}

.chat-avatar i {
    font-size: 14px;
}

/* Message Content */
.chat-content {
    flex: 1;
    min-width: 0;
}

/* Legacy bubble style - keep for compatibility */
.chat-bubble {
    flex: 1;
    min-width: 0;
}

/* Message Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.chat-username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-message.own .chat-username {
    color: var(--primary-light);
}

.chat-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}

/* Message Text */
.chat-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
    margin: 0;
}

/* Empty State */
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    flex: 1;
}

.chat-empty-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.chat-empty-icon i {
    font-size: 28px;
    color: var(--primary);
    opacity: 0.7;
}

.chat-empty h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.chat-empty p {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 200px;
    line-height: 1.4;
}

/* Emoji Bar */
.emoji-bar {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
}

.emoji-bar::-webkit-scrollbar {
    display: none;
}

.emoji-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.emoji-btn:hover {
    transform: scale(1.15);
    background: var(--bg-secondary);
}

/* Chat Input */
.chat-input-area {
    padding: 12px 16px 16px;
    background: linear-gradient(to top, var(--bg-secondary), transparent);
    border-top: 1px solid var(--border-color);
}

/* Username Entry */
.username-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 24px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.username-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.username-input-wrapper::before {
    content: '👤';
    font-size: 16px;
    opacity: 0.6;
}

/* Message Input */
.message-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    position: relative; /* For emoji picker positioning */
}

.message-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.user-indicator {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.user-indicator:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
}

.user-indicator:hover .user-edit-icon {
    opacity: 1;
    color: var(--primary);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.user-name {
    display: none; /* Hide username text to save space - avatar and edit icon are enough */
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-edit-icon {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0;
    transition: all var(--transition-fast);
}

/* Username Edit Wrapper */
.username-edit-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.username-edit-wrapper input {
    flex: 1;
    min-width: 0;
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-primary);
    background: transparent;
}

.username-edit-wrapper input::placeholder {
    color: var(--text-muted);
}

.cancel-edit-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.cancel-edit-btn:hover {
    background: var(--error);
    color: white;
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: calc(100% + 8px);
    left: -8px;
    right: -8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 1000;
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.emoji-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.emoji-picker-close {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all var(--transition-fast);
}

.emoji-picker-close:hover {
    background: var(--error);
    color: white;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 10px;
    max-height: 180px;
    overflow-y: auto;
}

.emoji-pick {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    background: transparent;
}

.emoji-pick:hover {
    background: var(--bg-elevated);
    transform: scale(1.15);
}

.emoji-pick:active {
    transform: scale(0.95);
}

.emoji-toggle.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.chat-input-area input {
    flex: 1;
    min-width: 0;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-primary);
    background: transparent;
}

.chat-input-area input::placeholder {
    color: var(--text-muted);
}

.emoji-toggle {
    padding: 8px;
    color: var(--text-muted);
    font-size: 18px;
    transition: color var(--transition-fast);
}

.emoji-toggle:hover {
    color: var(--text-primary);
}

.send-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    color: white;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.chat-settings-btn {
    padding: 8px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.chat-settings-btn:hover {
    color: var(--text-primary);
}

/* Chat Viewer Count */
.chat-viewer-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 10px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 12px;
}

.chat-viewer-count i {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Shake animation for validation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-4px); }
}

/* ============================================
   PRODUCT MODAL
   ============================================ */

.product-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.product-modal.visible {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1;
    cursor: pointer;
}

.modal-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: modalSlideIn 0.3s ease-out;
    pointer-events: auto;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 18px;
    z-index: 100;
    transition: all var(--transition-fast);
    cursor: pointer;
    pointer-events: auto !important;
    touch-action: manipulation;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    transform: scale(1.05);
}

.modal-close:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 1);
}

.modal-body {
    display: flex;
    gap: 24px;
    padding: 24px;
    overflow-y: auto;
}

.product-image-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    max-width: 360px;
}

.product-image-section .product-actions {
    margin-top: 0;
}

.product-image-wrapper {
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-badge {
    display: inline-block;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.product-details h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.product-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.product-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-light);
}

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

.btn-primary,
.btn-secondary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--border-hover);
}

/* ============================================
   WATCH & POP OVERLAY
   ============================================ */

.watch-pop-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
}

.watch-pop-overlay.active {
    display: block;
}

.watch-pop-video {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 300px;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-color);
    pointer-events: auto;
}

.watch-pop-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.watch-pop-close,
.watch-pop-expand {
    position: absolute;
    top: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    color: white;
    font-size: 12px;
}

.watch-pop-close {
    right: 8px;
}

.watch-pop-expand {
    right: 44px;
}

/* ============================================
   ERROR STATE
   ============================================ */

.error-state {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 10001;
}

.error-content {
    text-align: center;
    padding: 40px;
}

.error-content i {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.error-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.error-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.error-content .btn-primary {
    display: inline-flex;
}

/* ============================================
   LOADING COVER
   ============================================ */

.load-cover {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 100000;
}

.load-cover lottie-player {
    width: 150px;
    height: 150px;
}

.load-cover.hidden {
    display: none;
}

/* ============================================
   MOBILE NAVIGATION - Compact Tab Bar
   ============================================ */

/* Panel expand button - hidden on desktop */
.panel-expand-btn {
    display: none;
}

.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: linear-gradient(to top, var(--bg-secondary), rgba(15, 15, 20, 0.98));
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    position: relative;
}

.mobile-nav-btn.active {
    color: var(--primary-light);
}

.mobile-nav-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
}

.mobile-nav-btn i {
    font-size: 20px;
    transition: transform var(--transition-fast);
}

.mobile-nav-btn.active i {
    transform: scale(1.1);
}

.mobile-nav-btn span {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Mobile Reaction FAB */
.mobile-reaction-fab {
    position: fixed;
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 16px);
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    color: white;
    font-size: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.5);
    z-index: 999;
    transition: all var(--transition-fast);
}

.mobile-reaction-fab:active {
    transform: scale(0.92);
}

.mobile-reaction-fab.pulse {
    animation: fabPulse 0.3s ease;
}

@keyframes fabPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 320px;
    }
    
    .reactions-container {
        right: calc(var(--sidebar-width) + 20px);
    }
}

/* ============================================
   MOBILE RESPONSIVE - Watch + Chat + Shop
   ============================================ */

@media (max-width: 768px) {
    :root {
        --mobile-video-height: 280px;
        --mobile-video-height-expanded: 100px;
    }
    
    /* Main Layout - Flexbox Column */
    .app-container {
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }
    
    /* Video Section - Fixed height at top */
    .video-section {
        position: relative;
        flex-shrink: 0;
        width: 100%;
        height: var(--mobile-video-height);
        min-height: var(--mobile-video-height);
        max-height: var(--mobile-video-height);
        z-index: 10;
        border-radius: 0;
        transition: height 0.3s ease, min-height 0.3s ease, max-height 0.3s ease;
    }
    
    /* Expanded mode - shrink video and ensure sidebar is on top */
    body.panel-expanded .video-section {
        height: var(--mobile-video-height-expanded) !important;
        min-height: var(--mobile-video-height-expanded) !important;
        max-height: var(--mobile-video-height-expanded) !important;
        z-index: 1 !important; /* Lower z-index so sidebar can be on top */
    }
    
    body.panel-expanded .sidebar {
        z-index: 100 !important; /* Higher z-index to be on top of video */
        position: relative !important;
    }
    
    .video-wrapper {
        height: 100%;
    }
    
    .video-wrapper video {
        border-radius: 0;
        object-fit: cover;
    }
    
    /* Video Overlay - Compact on Mobile */
    .overlay-top {
        padding: 10px 12px;
    }
    
    .live-indicator {
        padding: 5px 10px;
        font-size: 10px;
    }
    
    .overlay-bottom {
        padding: 10px 12px;
        padding-bottom: 12px;
    }
    
    /* Hide overlay in expanded mode */
    body.panel-expanded .overlay-bottom {
        display: none;
    }
    
    .control-buttons {
        gap: 12px;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding-left: 0 !important;
        margin-left: 0 !important;
    }
    
    /* Hide PIP button on mobile - auto PIP when shopping */
    #pipBtn {
        display: none !important;
    }
    
    .control-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        max-width: 44px !important;
        max-height: 44px !important;
        padding: 0 !important;
        font-size: 16px;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        border-radius: 50% !important;
        aspect-ratio: 1 / 1 !important;
        gap: 0 !important;
        box-sizing: border-box !important;
    }
    
    .control-btn i {
        margin: 0 !important;
        line-height: 1;
        width: auto;
        height: auto;
    }
    
    .control-btn .btn-label {
        display: none !important;
    }
    
    .control-btn .btn-label {
        display: none;
    }
    
    /* Reaction container - inline with other buttons */
    .reaction-container {
        position: relative;
        display: flex;
        align-items: center;
    }
    
    .control-btn.reaction-btn {
        display: flex !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        max-width: 44px !important;
        max-height: 44px !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        border-radius: 50% !important;
        aspect-ratio: 1 / 1 !important;
        gap: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Sidebar - Panel below video, fills remaining space */
    .sidebar {
        position: relative !important;
        flex: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0;
        transform: none !important;
        border-left: none;
        border-top: none;
        border-radius: 0;
        background: var(--bg-primary);
        z-index: 5;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    /* Ensure video section is also full width */
    .video-section {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Ensure app container fills viewport */
    .app-container {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .sidebar.collapsed,
    .sidebar.open {
        transform: none !important;
    }
    
    .sidebar-toggle {
        display: none !important;
    }
    
    /* Tab Navigation - Mobile Optimized */
    .sidebar-tabs {
        padding: 8px 12px;
        gap: 6px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        position: relative;
        flex-shrink: 0;
    }
    
    .tab-btn {
        padding: 10px 16px;
        font-size: 13px;
        flex: 1;
        justify-content: center;
    }
    
    .tab-btn i {
        font-size: 14px;
    }
    
    /* Expand button for mobile panel */
    .panel-expand-btn {
        display: flex !important;
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        cursor: pointer;
        transition: all var(--transition-fast);
        z-index: 10;
    }
    
    .panel-expand-btn:hover {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }
    
    .panel-expand-btn i {
        transition: transform 0.2s ease;
    }
    
    /* Icon change is handled by JavaScript - no CSS rotation needed */
    
    /* Panels - Scrollable Content */
    .sidebar-panel {
        flex: 1;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    
    .sidebar-panel.active {
        display: flex;
    }
    
    /* Hide panel headers on mobile to maximize content space */
    .panel-header {
        display: none !important;
    }
    
    /* Chat - Mobile Optimized */
    .chat-messages {
        padding: 12px;
        gap: 10px;
        flex: 1;
        min-height: 0; /* Important for flex overflow */
    }
    
    .chat-message {
        max-width: 92%;
    }
    
    .chat-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
    
    .chat-bubble {
        padding: 8px 12px;
        border-radius: 16px;
    }
    
    .chat-text {
        font-size: 13px;
    }
    
    .chat-username {
        font-size: 10px;
    }
    
    .chat-time {
        font-size: 9px;
    }
    
    /* Chat Input - Compact */
    .emoji-bar {
        padding: 8px 12px;
        gap: 2px;
        flex-shrink: 0;
    }
    
    .emoji-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .chat-input-area {
        padding: 10px 12px 12px;
        flex-shrink: 0;
        background: var(--bg-secondary);
    }
    
    .username-input-wrapper,
    .message-input-wrapper {
        padding: 8px 12px;
    }
    
    .chat-input-area input {
        font-size: 14px;
    }
    
    .send-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    /* Panel visibility - Only show active panel */
    #chatPanel,
    #productsPanel {
        display: none !important;
        flex-direction: column;
    }
    
    #chatPanel.active,
    #productsPanel.active {
        display: flex !important;
    }
    
    /* Products - Mobile Grid */
    .products-grid {
        padding: 12px;
        padding-bottom: 60px; /* Extra space at bottom for last card */
        gap: 10px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }
    
    /* Product cards - FIXED HEIGHT to prevent clipping */
    .iframely-product-card,
    .product-card {
        min-height: 100px !important;
        height: auto !important;
        overflow: visible !important;
        flex-shrink: 0 !important;
    }
    
    .product-card-link {
        min-height: 80px;
    }
    
    .product-card-content {
        min-height: 80px;
        padding: 8px 10px !important;
    }
    
    .product-card-footer {
        margin-top: auto;
        padding-top: 4px;
    }
    
    /* iFramely legacy cards - 185px minimum to show full card with price */
    .iframely-embed,
    .iframely-responsive {
        min-height: 185px !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .iframely-embed *,
    .iframely-responsive * {
        max-height: none !important;
        overflow: visible !important;
    }
    
    /* Mobile Nav */
    /* Hide redundant mobile nav - tabs are in sidebar */
    .mobile-nav {
        display: none !important;
    }
    
    /* Hide mobile reaction FAB - reaction is in control bar */
    .mobile-reaction-fab {
        display: none !important;
    }
    
    /* Reactions - Position for Mobile */
    .reactions-container,
    #reactionsContainer {
        right: 16px !important;
        bottom: calc(var(--mobile-video-height) + 80px) !important;
        height: 50vh !important;
    }
    
    /* Product Modal - Mobile Fullscreen */
    .product-modal {
        align-items: flex-end;
    }
    
    .modal-content {
        max-height: 85vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        margin: 0;
    }
    
    /* Modal close button - Mobile: Larger touch target */
    .modal-close {
        top: 12px;
        right: 12px;
        width: 48px;
        height: 48px;
        font-size: 20px;
        z-index: 200;
    }
    
    .modal-body {
        flex-direction: column;
        padding: 16px;
    }
    
    .product-image-section {
        max-width: 100%;
    }
    
    .product-image-wrapper {
        max-width: 100%;
        max-height: 200px;
    }
    
    .product-info {
        padding: 0;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Empty State - Compact */
    .chat-empty {
        padding: 24px 16px;
    }
    
    .chat-empty-icon {
        width: 56px;
        height: 56px;
    }
    
    .chat-empty-icon i {
        font-size: 22px;
    }
    
    .chat-empty h4 {
        font-size: 14px;
    }
    
    .chat-empty p {
        font-size: 12px;
    }
    
    /* Hide desktop-only reaction button */
    /* Keep reaction button visible on mobile */
    .control-btn.reaction-btn {
        display: flex !important;
    }
    
    /* Reaction picker positioning for mobile */
    /* Reaction picker - position above control buttons */
    .reaction-picker {
        position: absolute !important;
        bottom: calc(100% + 8px) !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 9999 !important;
    }
    
    .reaction-picker.visible {
        display: flex !important;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    :root {
        --mobile-video-height: 240px;
        --mobile-video-height-expanded: 80px;
    }
    
    .control-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
        padding: 0 !important;
        font-size: 14px;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        border-radius: 50% !important;
        aspect-ratio: 1 / 1 !important;
        gap: 0 !important;
        box-sizing: border-box !important;
    }
    
    .products-grid {
        gap: 8px;
    }
    
    .emoji-bar {
        justify-content: space-between;
    }
    
    .emoji-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .mobile-reaction-fab {
        width: 46px;
        height: 46px;
        font-size: 18px;
    }
}

/* Landscape Mobile - Side by side layout */
@media (max-width: 896px) and (orientation: landscape) {
    .app-container {
        flex-direction: row !important;
        height: 100vh !important;
        height: 100dvh !important;
    }
    
    .video-section {
        position: relative !important;
        width: 55% !important;
        height: 100vh !important;
        height: 100dvh !important;
        min-height: 100vh !important;
        max-height: none !important;
        flex-shrink: 0 !important;
    }
    
    .sidebar {
        position: relative !important;
        width: 45% !important;
        height: 100vh !important;
        height: 100dvh !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        border-left: 1px solid var(--border-color);
        border-top: none !important;
    }
    
    .sidebar.expanded {
        height: 100vh !important;
        height: 100dvh !important;
    }
    
    /* Hide expand button in landscape - not needed */
    .panel-expand-btn {
        display: none !important;
    }
    
    /* CRITICAL: Hide panel header on landscape mobile (same as portrait) */
    .panel-header {
        display: none !important;
    }
    
    /* Control buttons positioning */
    .control-buttons {
        justify-content: flex-start !important;
        padding-left: 0 !important;
        margin-left: 0 !important;
    }
    
    /* Products grid scrollable - account for hidden header */
    .products-grid {
        max-height: calc(100vh - 100px) !important;
        overflow-y: auto !important;
    }
    
    .chat-messages {
        max-height: calc(100vh - 150px) !important;
        overflow-y: auto !important;
    }
    
    /* Tabs row */
    .sidebar-tabs {
        flex-shrink: 0;
    }
    
    /* Prevent body.panel-expanded from breaking landscape layout */
    body.panel-expanded .video-section {
        width: 55% !important;
        height: 100vh !important;
        height: 100dvh !important;
        min-height: 100vh !important;
        max-height: none !important;
    }
    
    body.panel-expanded .sidebar {
        width: 45% !important;
        height: 100vh !important;
        height: 100dvh !important;
    }
}

/* Very Small Height (keyboard open, etc) */
@media (max-height: 500px) {
    :root {
        --mobile-video-height: 35vh;
    }
    
    .video-section {
        max-height: 180px;
        min-height: 150px;
    }
    
    .overlay-bottom {
        display: none;
    }
    
    .overlay-top {
        padding: 8px 12px;
    }
}

/* ============================================
   LEGACY ELEMENT IDS (for JS compatibility)
   ============================================ */

#trailerVidContainer,
#vidContainer,
#pipVidContainer,
#trailerVidWin,
#vidWin,
#pipVidWin,
#unmutePrompt,
#volumeBtn,
#volumeIcon,
#volumeLabel,
#chatStream,
#chatInput,
#usernameInput,
#productStream,
#loadCover,
#videoSpinner,
#viewerCount,
#userCount,
#showTimer,
#hours,
#minutes,
#seconds,
#progressBar,
#currentTime,
#totalTime {
    /* These IDs are kept for JavaScript compatibility */
}

/* Hidden utility class */
.hidden {
    display: none !important;
}

/* Visibility utility */
.invisible {
    visibility: hidden !important;
}

/* Air indicator states (for JS compatibility) */
#airIndicatorView {
    display: none;
}

#viewerCountBadge {
    display: none;
}

/* Video time container (for JS compatibility) */
#videoTimeContainer,
#videoCurrentTime,
#videoTotalTime,
#videoScrubControlsContainer {
    display: none;
}

/* Legacy element hiding */
#mobileTabBar,
#shopShowBtnContainer,
#chatShowBtnContainer,
#sendReactionBtnContainer,
#pipBtnContainer,
#sideBarToggleContainer,
#ctrlUI,
#vidCtrlView,
#productWindowContainer,
#chatContainer,
#watchShopPermissionContainer,
#reactionsOriginTarget,
#controlDisplay,
#playBtnVisual {
    display: none !important;
}

/* ============================================
   AMAZING REACTION ANIMATIONS
   ============================================ */

/* ============================================ */
/* FACEBOOK LIVE STYLE REACTIONS               */
/* ============================================ */

/* Reactions Container - Fixed position to avoid overflow:hidden clipping */
.reactions-container,
#reactionsContainer,
.fb-reactions-container {
    position: fixed;
    bottom: 120px;
    right: 20px;
    width: 150px;
    height: 70vh;
    pointer-events: none;
    z-index: 9999;
    overflow: visible;
}

/* Facebook Live Style Floating Reaction */
.fb-floating-reaction {
    position: absolute;
    bottom: 0;
    pointer-events: none;
    animation: fbFloatUp var(--duration, 3s) ease-out var(--delay, 0s) forwards;
    transform-origin: center bottom;
    text-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(255, 255, 255, 0.2);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    will-change: transform, opacity;
    z-index: 201;
}

/* Facebook Live Float Animation - Realistic upward drift */
@keyframes fbFloatUp {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(0.5) rotate(0deg);
    }
    10% {
        opacity: 1;
        transform: translateY(-20px) translateX(calc(var(--drift, 0px) * 0.1)) scale(1.2) rotate(-5deg);
    }
    30% {
        opacity: 1;
        transform: translateY(-100px) translateX(calc(var(--drift, 0px) * 0.5)) scale(1.1) rotate(8deg);
    }
    50% {
        opacity: 0.9;
        transform: translateY(-200px) translateX(var(--drift, 0px)) scale(1) rotate(-3deg);
    }
    70% {
        opacity: 0.7;
        transform: translateY(-300px) translateX(calc(var(--drift, 0px) * 0.8)) scale(0.9) rotate(5deg);
    }
    85% {
        opacity: 0.4;
        transform: translateY(-380px) translateX(calc(var(--drift, 0px) * 0.6)) scale(0.8) rotate(-2deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-450px) translateX(calc(var(--drift, 0px) * 0.5)) scale(0.6) rotate(0deg);
    }
}

/* Reaction Button Pulse Animation */
.reaction-pulse {
    animation: reactionPulse 0.4s ease-out;
}

@keyframes reactionPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

/* Legacy Floating Reaction (keeping for compatibility) */
.floating-reaction {
    position: absolute;
    bottom: 0;
    font-size: 2rem;
    animation: floatUp var(--float-duration, 3s) ease-out forwards;
    transform-origin: center;
    pointer-events: none;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(var(--float-scale, 1)) rotate(0deg);
    }
    25% {
        transform: translateY(-100px) scale(calc(var(--float-scale, 1) * 1.2)) rotate(var(--sway-amount, 10deg));
    }
    50% {
        transform: translateY(-200px) scale(var(--float-scale, 1)) rotate(calc(var(--sway-amount, 10deg) * -0.5));
    }
    75% {
        opacity: 0.7;
        transform: translateY(-300px) scale(calc(var(--float-scale, 1) * 0.9)) rotate(var(--sway-amount, 10deg));
    }
    100% {
        opacity: 0;
        transform: translateY(-400px) scale(0.5) rotate(0deg);
    }
}

/* Pulse Animation for Buttons */
.pulse-animation {
    animation: pulse 0.3s ease-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Heart Button Special Styling */
/* Reaction Container */
.reaction-container {
    position: relative;
}

.reaction-btn {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border) !important;
}

.reaction-btn:hover {
    transform: scale(1.1);
    background: var(--glass-bg-hover) !important;
}

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

.reaction-btn i {
    color: white;
}

/* Reaction Picker */
.reaction-picker {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 1000;
    animation: reactionPickerIn 0.2s ease;
}

@keyframes reactionPickerIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

.reaction-option {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.15s ease;
    cursor: pointer;
}

.reaction-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.25);
}

.reaction-option:active {
    transform: scale(1.1);
}

/* Emoji Bar Animation */
.emoji-btn {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.emoji-btn:hover {
    transform: scale(1.2);
}

.emoji-btn:active,
.emoji-btn.pulse-animation {
    transform: scale(1.4);
}

/* PIP Button Active State */
.control-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

/* Volume Button States */
.control-btn#volumeBtn.muted {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

.control-btn#volumeBtn.muted i {
    color: #ef4444;
}

.control-btn#volumeBtn:not(.muted) {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
}

.control-btn#volumeBtn:not(.muted) i {
    color: #22c55e;
}

/* Burst Animation for Multiple Reactions */
@keyframes burst {
    0% {
        opacity: 0;
        transform: scale(0) translateY(0);
    }
    20% {
        opacity: 1;
        transform: scale(1.5) translateY(-20px);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-400px);
    }
}

/* Toast Notification */
#toast-notification {
    font-family: var(--font-family);
    font-weight: 500;
}

/* ============================================
   HOST CHAT MESSAGE STYLING
   ============================================ */

/* Host Message Card - Matching Broadcaster */
.chat-message.host {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.05));
    border-left: 3px solid #8b5cf6;
}

/* ============================================
   PINNED MESSAGES - Audience View
   ============================================ */

.pinned-messages-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.pinned-message {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(234, 179, 8, 0.05));
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    animation: pinnedSlideIn 0.3s ease-out;
}

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

.pinned-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #eab308;
}

.pinned-header i {
    font-size: 10px;
}

.pinned-content {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.pinned-content .chat-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
    flex-shrink: 0;
}

.pinned-body {
    flex: 1;
    min-width: 0;
}

.pinned-username {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 6px;
}

.pinned-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 4px;
    word-wrap: break-word;
}

/* Host Tag Badge - Matching Broadcaster */
.chat-host-tag {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: white;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Host Username */
.chat-message.host .chat-username {
    color: #a78bfa;
}

/* Host Message Text */
.chat-message.host .chat-text {
    color: var(--text-primary);
}

/* ============================================
   FLOATING AUDIENCE COUNTER
   ============================================ */

.audience-counter {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 999999;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

.audience-counter.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* Live/Offline Status Badge */
.audience-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(10, 10, 18, 0.9);
    backdrop-filter: blur(16px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.audience-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s ease;
}

.audience-status.live .status-dot {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444, 0 0 16px rgba(239, 68, 68, 0.5);
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.15); }
}

.audience-status .status-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.audience-status.live .status-text {
    color: #ef4444;
}

/* Viewer Count Badge */
.audience-viewers {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(10, 10, 18, 0.9);
    backdrop-filter: blur(16px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.audience-viewers i {
    font-size: 12px;
    color: var(--text-muted);
}

.audience-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Mobile positioning */
@media (max-width: 768px) {
    .audience-counter {
        top: 12px;
        left: 12px;
        gap: 6px;
    }
    
    .audience-status,
    .audience-viewers {
        padding: 5px 10px;
    }
    
    .audience-status .status-text {
        font-size: 10px;
    }
    
    .audience-count {
        font-size: 12px;
    }
}

/* ============================================
   IFRAME MODE STYLES
   For seamless embedding in partner sites
   Same design as regular mode - only prevent overflow
   ============================================ */

body.iframe-mode {
    /* Prevent scroll bleed to parent */
    overflow: hidden !important;
    overscroll-behavior: none;
}


/* ============================================
   ENHANCED DESKTOP LAYOUT (>1024px)
   ============================================ */

@media (min-width: 1025px) {
    .app-container {
        flex-direction: row;
    }
    
    .video-section {
        flex: 1;
        height: 100vh;
    }
    
    .sidebar {
        width: var(--sidebar-width);
        height: 100vh;
        flex-shrink: 0;
    }
    
    /* Large desktop - wider sidebar */
    @media (min-width: 1440px) {
        :root {
            --sidebar-width: 420px;
        }
        
        .products-grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }
    
    /* Ultrawide screens */
    @media (min-width: 1920px) {
        :root {
            --sidebar-width: 480px;
        }
    }
    
    /* Hide mobile elements */
    .mobile-nav,
    .mobile-reaction-fab {
        display: none !important;
    }
}

/* ============================================
   TABLET LAYOUT (768-1024px)
   ============================================ */

@media (min-width: 768px) and (max-width: 1024px) {
    :root {
        --sidebar-width: 320px;
    }
    
    .app-container {
        flex-direction: row;
    }
    
    .video-section {
        flex: 1;
        height: 100vh;
    }
    
    .sidebar {
        width: var(--sidebar-width);
        height: 100vh;
    }
    
    /* Larger touch targets for tablet */
    .control-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .tab-btn {
        min-height: 48px;
        padding: 12px 16px;
    }
    
    .send-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Products adapt to tablet */
    .products-grid {
        grid-template-columns: 1fr;
        padding: 12px;
    }
    
    .iframely-product-card {
        padding: 14px;
    }
    
    /* Hide mobile elements on tablet */
    .mobile-nav,
    .mobile-reaction-fab {
        display: none !important;
    }
    
    /* Tablet landscape */
    @media (orientation: landscape) {
        :root {
            --sidebar-width: 280px;
        }
    }
}

/* ============================================
   MOBILE LAYOUT REFINEMENTS (<768px)
   ============================================ */

@media (max-width: 767px) {
    /* Hide mobile navigation - tabs are in sidebar */
    .mobile-nav {
        display: none !important;
    }
    
    .mobile-reaction-fab {
        display: none !important;
    }
    
    /* Sidebar panel fills available space */
    .sidebar-panel {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }
    
    /* Touch-friendly controls */
    .control-btn {
        min-height: 44px;
    }
    
    /* Chat messages scrollable */
    .chat-messages {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Chat input sticky at bottom of panel */
    .chat-input-area {
        position: sticky;
        bottom: 0;
        background: var(--bg-secondary);
        padding: 12px;
        border-top: 1px solid var(--border-color);
    }
    
    /* Products scrollable */
    .products-grid {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px;
        padding-bottom: 80px; /* Space for mobile nav */
    }
    
    /* Single column products on mobile */
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* Extra small mobile (iPhone SE, etc) */
@media (max-width: 375px) {
    :root {
        --mobile-video-height: 35vh;
    }
    
    .audience-counter {
        transform: scale(0.8);
        transform-origin: top left;
    }
    
    .control-btn .btn-label {
        display: none;
    }
    
    .tab-btn span {
        font-size: 11px;
    }
    
    .panel-header h3 {
        font-size: 13px;
    }
}

/* iPhone with notch / Dynamic Island safe areas */
@supports (padding-top: env(safe-area-inset-top)) {
    body.iframe-mode .video-section {
        padding-top: env(safe-area-inset-top);
    }
    
    body.iframe-mode .mobile-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================
   KEYBOARD HANDLING (Mobile)
   ============================================ */

@media (max-width: 768px) {
    /* When virtual keyboard is open */
    body.keyboard-open .video-section {
        height: 30vh;
    }
    
    body.keyboard-open .sidebar {
        height: 70vh;
    }
    
    body.keyboard-open .mobile-nav {
        display: none;
    }
}

/* ============================================
   PRINT / REDUCED MOTION
   ============================================ */

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

@media print {
    .video-section,
    .mobile-nav,
    .video-overlay {
        display: none;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
}

/* ============================================
   FULLSCREEN MODE
   ============================================ */

/* Fullscreen container styles - native fullscreen API */
.video-section:fullscreen,
.video-section:-webkit-full-screen,
.video-section:-moz-full-screen,
.video-section:-ms-fullscreen,
.app-container:fullscreen,
.app-container:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    background: #000 !important;
}

/* Hide sidebar when body has fullscreen-active class */
body.fullscreen-active .sidebar {
    display: none !important;
    visibility: hidden !important;
}

body.fullscreen-active .mobile-nav {
    display: none !important;
}

/* Video section takes full screen */
body.fullscreen-active .video-section {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background: #000 !important;
}

/* Video fills the fullscreen container */
body.fullscreen-active .video-wrapper,
body.fullscreen-active #videoContainer,
body.fullscreen-active #trailerVideoWindow,
body.fullscreen-active #agoraVideoWindow {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

/* Control buttons in fullscreen - position at bottom center */
body.fullscreen-active .control-buttons {
    position: fixed !important;
    bottom: 40px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 100001 !important;
    padding: 16px 24px !important;
    background: rgba(0, 0, 0, 0.6) !important;
    border-radius: 40px !important;
    pointer-events: auto !important;
}

body.fullscreen-active .control-buttons .control-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Video overlay must not block clicks in fullscreen */
body.fullscreen-active .video-overlay {
    pointer-events: none !important;
}

body.fullscreen-active .overlay-bottom {
    pointer-events: auto !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100000 !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

/* Status indicators in fullscreen */
body.fullscreen-active .live-status,
body.fullscreen-active .audience-counter {
    position: fixed !important;
    top: 20px !important;
    z-index: 100000 !important;
}

body.fullscreen-active .live-status {
    left: 20px !important;
}

body.fullscreen-active .audience-counter {
    left: 120px !important;
}

/* Hide unnecessary elements in fullscreen */
body.fullscreen-active .sidebar-tabs,
body.fullscreen-active .panel-expand-btn {
    display: none !important;
}

/* Fullscreen FAB - DISABLED (not working on mobile) */
.fullscreen-fab,
#fullscreenBtn {
    display: none !important;
}

/* Desktop: Bottom right of video area */
@media (min-width: 769px) {
    .fullscreen-fab,
    #fullscreenBtn {
        bottom: 100px;
        right: calc(var(--sidebar-width) + 30px);
        width: 48px;
        height: 48px;
    }
    
    .fullscreen-fab:hover,
    #fullscreenBtn:hover {
        background: rgba(0, 0, 0, 0.9);
        transform: scale(1.1);
        border-color: var(--primary);
    }
}

/* Mobile: Inside video area - positioned relative to video height */
@media (max-width: 768px) {
    .fullscreen-fab,
    #fullscreenBtn {
        /* Position 60px from bottom of video area (works for any video height) */
        top: calc(var(--mobile-video-height) - 60px);
        bottom: auto;
        right: 12px;
        width: 52px;
        height: 52px;
        font-size: 20px;
        background: rgba(0, 0, 0, 0.9);
        border: 2px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(139, 92, 246, 0.3);
        /* Ensure maximum clickability */
        -webkit-tap-highlight-color: rgba(139, 92, 246, 0.5);
        touch-action: manipulation;
        user-select: none;
        -webkit-user-select: none;
    }
    
    .fullscreen-fab:active,
    #fullscreenBtn:active {
        transform: scale(0.9);
        background: var(--primary);
        box-shadow: 0 2px 12px rgba(139, 92, 246, 0.8);
    }
    
    /* Hide in panel-expanded mode */
    body.panel-expanded .fullscreen-fab,
    body.panel-expanded #fullscreenBtn {
        display: none !important;
    }
}

/* Fullscreen active state */
.fullscreen-fab.active,
#fullscreenBtn.active {
    background: var(--primary) !important;
}

/* Hide during fullscreen mode (use native controls) */
body.fullscreen-active .fullscreen-fab,
body.fullscreen-active #fullscreenBtn {
    bottom: 20px !important;
    right: 20px !important;
    top: auto !important;
    z-index: 100001 !important;
}

/* CRITICAL: Reset styles when NOT in fullscreen */
body:not(.fullscreen-active) .sidebar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body:not(.fullscreen-active) .video-section {
    position: relative !important;
}

/* Landscape orientation in fullscreen on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    body.fullscreen-active .control-buttons {
        bottom: 20px !important;
        padding: 12px 20px !important;
    }
    
    body.fullscreen-active .live-status,
    body.fullscreen-active .audience-counter {
        top: 10px !important;
    }
}

/* Mobile: Ensure sidebar ALWAYS visible when not fullscreen */
@media (max-width: 768px) {
    body:not(.fullscreen-active) .sidebar {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        flex: 1 !important;
        min-height: 0 !important;
    }
    
    body:not(.fullscreen-active) .app-container {
        display: flex !important;
        flex-direction: column !important;
    }
    
    body:not(.fullscreen-active) .video-section {
        position: relative !important;
        height: var(--mobile-video-height) !important;
        flex-shrink: 0 !important;
    }
}

