/* Total TV Solution - Bootstrap Enhanced Styles */

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

body {
    background: radial-gradient(circle at top, #141428 0, #050509 40%, #020206 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); }
}

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

.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;
}

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

.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.2), rgba(16, 185, 129, 0.2));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 50rem;
    font-size: 12px;
    font-weight: 600;
    color: #86efac;
}

.status-badge.offline {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
    border-color: rgba(239, 68, 68, 0.3);
    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;
}

.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.8);
    color: #6c757d;
    z-index: 2;
    transition: opacity 0.3s;
    cursor: pointer;
}

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

.player-overlay:hover i {
    opacity: 0.8;
    transform: scale(1.1);
}

.player-overlay i {
    transition: all 0.2s ease;
}

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

/* Category Tabs */
.category-tabs {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

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

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

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

/* 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;
}

.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.1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.channel-card:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.channel-card.playing {
    border: 2px solid var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.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;
}

/* Channel Thumb */
.channel-thumb {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

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

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

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

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

    .channel-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 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;
    }

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

/* 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);
}

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