/* Total TV Solution - Bootstrap Enhanced Styles */

:root {
    --accent: #e50914;
    --accent-glow: rgba(229, 9, 20, 0.4);
    --accent-soft: rgba(229, 9, 20, 0.12);
}

body {
    background: radial-gradient(ellipse at top center, #141428 0%, #0a0a12 40%, #050508 100%) !important;
    min-height: 100vh;
}

/* Animations */
@keyframes pulse {
    50% { opacity: 0.5; }
}

@keyframes cardPulse {
    0% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50% { box-shadow: 0 0 25px 8px var(--accent-glow); }
    100% { box-shadow: 0 0 20px var(--accent-glow); }
}

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

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

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

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

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

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

/* Skeleton Loading */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 100px));
    justify-content: center;
    gap: 4px;
    padding: 8px;
}

.skeleton-card {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    background: linear-gradient(110deg, rgba(255,255,255,0.03) 30%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
    border: 1px solid rgba(255,255,255,0.05);
}

.skeleton-tab {
    width: 70px;
    height: 30px;
    border-radius: 50rem;
    background: linear-gradient(110deg, rgba(255,255,255,0.03) 30%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
    flex-shrink: 0;
}

/* Staggered card entrance + scroll reveal */
.channel-card {
    animation: cardEnter 0.3s ease both;
}

.channel-card.scroll-reveal {
    opacity: 0;
    transform: translateY(15px) scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.channel-card.scroll-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Category tab entrance */
.tab-btn {
    animation: tabSlideIn 0.2s ease both;
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 15px var(--accent-glow); }
    50% { box-shadow: 0 0 30px var(--accent-glow), 0 0 60px rgba(229, 9, 20, 0.15); }
}

/* Logo */
.logo-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.logo-avatar:hover { transform: rotate(-5deg) scale(1.1); }

.logo-avatar img {
    max-width: 100%;
    max-height: 100%;
}

.logo-title {
    font-size: 18px;
    background: linear-gradient(120deg, #fff, #ff4b5c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Header */
header {
    animation: slideDown 0.4s ease;
}

/* Viewer Badge */
.viewer-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 50rem;
    font-size: 12px;
    font-weight: 600;
    color: #a5b4fc;
    transition: all 0.3s ease;
}

.viewer-badge:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.25));
    transform: translateY(-1px);
}

.viewer-badge i {
    color: #818cf8;
    font-size: 14px;
}

/* Status Badge */
.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(16, 185, 129, 0.15));
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 50rem;
    font-size: 12px;
    font-weight: 600;
    color: #86efac;
    transition: all 0.3s ease;
}

.status-badge:hover { transform: translateY(-1px); }

.status-badge.offline {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.15));
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.status-badge.offline .status-dot {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

/* Status Dot */
.status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: pulse 2s infinite;
}

/* Player Section */
.player-shell {
    max-width: 98%;
}

.player-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.player-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 1;
}

.player-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    color: #6c757d;
    z-index: 2;
    transition: all 0.4s ease;
    cursor: pointer;
}

.player-overlay:hover {
    background: rgba(0, 0, 0, 0.7);
}

.player-overlay:hover i {
    opacity: 0.9;
    transform: scale(1.15);
    color: var(--accent);
}

.player-overlay i {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.player-overlay.hidden,
.player-overlay.d-none {
    opacity: 0;
    pointer-events: none;
}

/* Now Playing Card */
.card.bg-dark {
    transition: all 0.3s ease;
    animation: slideUp 0.4s ease;
}

/* Category Scroll Wrapper */
.category-scroll-wrap {
    position: relative;
}

.cat-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    background: rgba(20, 20, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.cat-scroll-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.cat-scroll-left { left: 4px; }
.cat-scroll-right { right: 4px; }

/* Category Tabs */
.category-tabs {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    animation: fadeIn 0.3s ease;
    padding-left: 32px !important;
    padding-right: 32px !important;
}

.category-tabs::-webkit-scrollbar {
    height: 3px;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.category-tabs::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.category-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 14px;
    border-radius: 50rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    color: #adb5bd;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateY(-1px);
}

.tab-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 4px 15px var(--accent-glow);
    transform: translateY(-1px);
}

/* Channel Grid */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 100px));
    justify-content: center;
    gap: 4px;
    padding: 8px;
    max-height: 60vh;
    overflow-y: auto;
    scroll-behavior: smooth;
    animation: fadeIn 0.4s ease;
}

.channel-grid::-webkit-scrollbar {
    width: 6px;
}

.channel-grid::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 6px;
}

.channel-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

/* Channel Card */
.channel-card {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.channel-card:hover {
    transform: translateY(-3px) scale(1.04);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
    z-index: 2;
}

.channel-card.playing {
    border: 2px solid var(--accent);
    animation: glowPulse 2s ease-in-out infinite;
}

.channel-card.just-selected {
    animation: cardPulse 0.4s ease-out;
}

/* HD Badge */
.hd-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 2px 6px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-radius: 50rem;
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    z-index: 5;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

/* Channel Thumb */
.channel-thumb {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    background: #ffffff4f;
    border: 8px solid #1a1a1a;
    border-radius: 14px;
    transition: background 0.3s ease;
}

.channel-card:hover .channel-thumb {
    background: rgba(255, 255, 255, 0.38);
}

.channel-thumb img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.channel-card:hover .channel-thumb img {
    transform: scale(1.08);
}

/* Favorite Button */
#favBtn {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

#favBtn:hover {
    color: #e50914 !important;
    transform: scale(1.25);
}

#favBtn:active {
    transform: scale(0.9);
}

/* Channel Initials Placeholder */
.ch-initial {
    font-size: 1.4rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
    user-select: none;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Loading Spinner */
.loading-spinner {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6c757d;
    animation: fadeIn 0.3s ease;
}

/* Check Button States */
#checkBtn.checking, #checkBtnAll.checking {
    background: #fd7e14 !important;
    border-color: #fd7e14 !important;
}

/* Footer */
footer {
    animation: fadeIn 0.5s ease 0.3s both;
}

footer a {
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--accent) !important;
}

/* Responsive */
@media (max-width: 768px) {
    .channel-card {
        width: 85px;
        height: 85px;
    }

    .channel-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 85px));
    }

    .skeleton-grid { grid-template-columns: repeat(auto-fill, minmax(85px, 85px)); }
    .skeleton-card { width: 85px; height: 85px; }

    .logo-title {
        font-size: 16px;
    }
}

@media (max-width: 576px) {
    .channel-card {
        width: 75px;
        height: 75px;
    }

    .channel-grid {
        grid-template-columns: repeat(auto-fill, minmax(75px, 75px));
        gap: 3px;
        padding: 4px;
    }

    .skeleton-grid { grid-template-columns: repeat(auto-fill, minmax(75px, 75px)); gap: 3px; padding: 4px; }
    .skeleton-card { width: 75px; height: 75px; }

    .logo-avatar {
        width: 32px;
        height: 32px;
    }
}

/* Category switch transition */
.channel-grid.switching {
    opacity: 0;
    transform: scale(0.98);
    transition: all 0.15s ease;
}

.channel-grid.switched {
    opacity: 1;
    transform: scale(1);
    transition: all 0.2s ease;
}

/* TV/Keyboard Focus Styles */
.channel-card:focus,
.channel-card.tv-focus {
    border: 3px solid #00ff00;
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.6);
    transform: scale(1.05);
    outline: none;
    z-index: 10;
}

.tab-btn:focus,
.tab-btn.tv-focus {
    border: 2px solid #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
    outline: none;
}

/* Error State */
.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--accent);
    animation: scaleIn 0.3s ease;
}

/* Google AdSense Containers */
.ad-container {
    text-align: center;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    min-height: 90px;
}

.ad-below-player { margin: 8px 0; }
.ad-in-channels { margin: 0 8px 8px; }
.ad-footer { margin-top: 16px; }

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

/* VPN Warning Banner */
.vpn-warning {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    animation: vpnPulse 2s ease-in-out infinite;
}

.vpn-warning .vpn-icon { font-size: 18px; }

@keyframes vpnPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Form Controls */
.form-control:focus, .form-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px var(--accent-soft) !important;
}

/* Smooth page transitions */
.card {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Button hover effects */
.btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

/* Toast/Alert animations */
.alert {
    animation: slideDown 0.3s ease;
}

/* Scrollbar global */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::-webkit-scrollbar-track { background: transparent; }
