/* ══════════════════════════════════════════════
   Web IPTV Player — Custom Styles
   Works alongside Tailwind CSS (via CDN)
   ══════════════════════════════════════════════ */

/* ── Custom Scrollbar ──────────────────────── */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* ── Tab Buttons ───────────────────────────── */
.tab-btn {
    color: #64748b;
    position: relative;
    transition: color 0.2s;
}

.tab-btn:hover {
    color: #94a3b8;
}

.tab-btn.active {
    color: #e2e8f0;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 1px;
}

/* ── Category Items ────────────────────────── */
.cat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.625rem;
    font-size: 0.8125rem;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.15s ease;
    user-select: none;
}

.cat-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: #c7d2fe;
}

.cat-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    font-weight: 500;
}

/* ── Stream Cards ──────────────────────────── */
.stream-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s ease;
}

.stream-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.1);
}

.stream-card .thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.stream-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stream-card .thumb .play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s;
}

.stream-card:hover .thumb .play-overlay {
    opacity: 1;
}

.stream-card .info {
    padding: 0.75rem;
}

.stream-card .info h4 {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #e2e8f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-card .info p {
    font-size: 0.6875rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* ── Video Player Overrides ────────────────── */
.video-js {
    border-radius: 0;
    position: relative;
    z-index: 1;
}

.video-js .vjs-control-bar {
    z-index: 10 !important;
    position: absolute !important;
}

.video-js .vjs-big-play-button {
    background: rgba(99, 102, 241, 0.8) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 64px !important;
    height: 64px !important;
    line-height: 64px !important;
    font-size: 28px !important;
    margin-top: -32px !important;
    margin-left: -32px !important;
    transition: transform 0.2s, background 0.2s !important;
    z-index: 10 !important;
}

.video-js .vjs-big-play-button:hover {
    background: rgba(99, 102, 241, 1) !important;
    transform: scale(1.1);
}

.video-js .vjs-control-bar {
    background: rgba(15, 23, 42, 0.9) !important;
}

.video-js .vjs-play-progress,
.video-js .vjs-volume-level {
    background: #6366f1 !important;
}

/* ── Glassmorphism Card ────────────────────── */
.glass-card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(51, 65, 85, 0.4);
}

/* ── Loading Spinner ───────────────────────── */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ══════════════════════════════════════════════
   Light Mode Overrides
   When <html> does NOT have class="dark"
   ══════════════════════════════════════════════ */
html:not(.dark) body {
    background: #f5f7fa;
    color: #1e293b;
}

html:not(.dark) header {
    background: rgba(255, 255, 255, 0.9);
    border-color: #e2e8f0;
}

html:not(.dark) #sidebar {
    background: #ffffff;
    border-color: #e2e8f0;
}

html:not(.dark) .tab-btn {
    color: #94a3b8;
}

html:not(.dark) .tab-btn.active {
    color: #1e293b;
}

html:not(.dark) .cat-item {
    color: #475569;
}

html:not(.dark) .cat-item:hover {
    background: rgba(99, 102, 241, 0.06);
    color: #4338ca;
}

html:not(.dark) .cat-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
}

html:not(.dark) .stream-card {
    background: #ffffff;
    border-color: #e2e8f0;
}

html:not(.dark) .stream-card:hover {
    border-color: #a5b4fc;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.08);
}

html:not(.dark) .stream-card .info h4 {
    color: #1e293b;
}

html:not(.dark) .stream-card .thumb {
    background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
}

html:not(.dark) #streamGrid {
    background: #f5f7fa;
}

html:not(.dark) #nowPlaying {
    background: #ffffff;
    border-color: #e2e8f0;
}

html:not(.dark) #nowPlaying p {
    color: #1e293b;
}

html:not(.dark) input[type="text"],
html:not(.dark) input[type="password"],
html:not(.dark) input[type="search"] {
    background: #ffffff;
    border-color: #d1d5db;
    color: #1e293b;
}

html:not(.dark) input:focus {
    border-color: #6366f1;
}

html:not(.dark) .custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
}

/* ── Responsive Sidebar ────────────────────── */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: -16rem;
        top: 0;
        bottom: 0;
        z-index: 40;
        transition: left 0.3s ease;
        background: #0f172a;
    }

    #sidebar.open {
        left: 0;
    }

    #sidebarOverlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 35;
    }

    /* Larger touch targets for mobile tabs */
    .tab-btn {
        padding-top: 1rem;
        padding-bottom: 1rem;
        font-size: 0.875rem;
    }

    .tab-btn span {
        font-size: 1.5rem;
    }

    /* Larger category items */
    .cat-item {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }
}

html:not(.dark) #sidebar.open {
    background: #ffffff;
}

/* Mobile Tab Indicator */
#mobileTabIndicator {
    display: none;
}

@media (max-width: 768px) {
    #mobileTabIndicator {
        display: flex;
    }
}

html:not(.dark) #mobileTabIndicator {
    background: rgba(255, 255, 255, 0.9);
    border-color: #e2e8f0;
}

html:not(.dark) #mobileTabDropdownBtn {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b;
}

html:not(.dark) #mobileTabDropdown {
    background: #ffffff;
    border-color: #e2e8f0;
}

html:not(.dark) .mobile-tab-option {
    color: #1e293b;
}

html:not(.dark) .mobile-tab-option:hover {
    background: #f1f5f9;
}

html:not(.dark) .mobile-tab-option.border-t {
    border-color: #e2e8f0;
}

/* Active option in dropdown */
.mobile-tab-option.bg-gray-700 {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

html:not(.dark) .mobile-tab-option.bg-gray-700 {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}