/* ===========================================
   EPG Guide V2 - Desktop CSS
   All selectors scoped under #epgModalV2
   =========================================== */

/* ===========================================
   MODAL BACKDROP & CONTAINER
   =========================================== */
#epgModalV2Backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#epgModalV2Backdrop.active {
    opacity: 1;
    visibility: visible;
}

#epgModalV2 {
    position: fixed;
    background: #0d0d12;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
}

#epgModalV2.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

#epgModalV2 * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Desktop Modal - Floating Popup */
@media (min-width: 769px) {
    #epgModalV2 {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.95);
        width: 90vw;
        max-width: 1400px;
        height: 90vh;
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
        overflow: hidden;
    }

    #epgModalV2.active {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ===========================================
   BASE CONTAINER
   =========================================== */
#epgModalV2 .epg-wrapper {
    display: flex;
    height: 100%;
    min-height: 100%;
    background: #0d0d12;
    color: #fff;
}

/* ===========================================
   SIDEBAR
   =========================================== */
#epgModalV2 .sidebar {
    width: 400px;
    background: linear-gradient(180deg, #141419, #0d0d12);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
}

#epgModalV2 .sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#epgModalV2 .back-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#epgModalV2 .back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

#epgModalV2 .sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

/* Mobile Search Button - Hidden on desktop */
#epgModalV2 .mobile-search-btn {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #888;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#epgModalV2 .mobile-search-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ===========================================
   CATEGORY DROPDOWN - DESKTOP
   =========================================== */
#epgModalV2 .category-dropdown-wrapper {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#epgModalV2 .category-dropdown {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.2s ease;
}

#epgModalV2 .category-dropdown:hover {
    border-color: rgba(139, 92, 246, 0.4);
    background-color: rgba(139, 92, 246, 0.08);
}

#epgModalV2 .category-dropdown:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.6);
}

#epgModalV2 .category-dropdown option {
    background: #1a1a24;
    color: #fff;
    padding: 12px;
    font-family: 'Inter', sans-serif;
}

/* Category Chips - Hidden on desktop */
#epgModalV2 .category-chips-wrapper {
    display: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#epgModalV2 .category-chips {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

#epgModalV2 .category-chips::-webkit-scrollbar {
    display: none;
}

#epgModalV2 .category-chip {
    padding: 8px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #888;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#epgModalV2 .category-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

#epgModalV2 .category-chip.active {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    color: #fff;
    border-color: transparent;
}

/* ===========================================
   SEARCH BOX
   =========================================== */
#epgModalV2 .search-box {
    padding: 12px 16px;
    position: relative;
}

#epgModalV2 .search-box input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 13px;
    transition: all 0.2s ease;
}

#epgModalV2 .search-box input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.08);
}

#epgModalV2 .search-box input::placeholder {
    color: #555;
}

#epgModalV2 .search-box svg {
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    color: #555;
    width: 14px;
    height: 14px;
}

/* ===========================================
   CHANNEL LIST
   =========================================== */
#epgModalV2 .channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

#epgModalV2 .channel-list::-webkit-scrollbar {
    width: 3px;
}

#epgModalV2 .channel-list::-webkit-scrollbar-track {
    background: transparent;
}

#epgModalV2 .channel-list::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 2px;
}

#epgModalV2 .channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    margin-bottom: 2px;
    border: 1px solid transparent;
}

#epgModalV2 .channel-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

#epgModalV2 .channel-item.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(167, 139, 250, 0.08));
    border-color: rgba(139, 92, 246, 0.25);
}

/* Circular Logo */
#epgModalV2 .channel-item-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 10px;
    flex-shrink: 0;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#epgModalV2 .channel-item-info {
    flex: 1;
    min-width: 0;
}

#epgModalV2 .channel-item-name {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#epgModalV2 .channel-item-current {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#epgModalV2 .channel-item-current .now-label {
    color: #888;
    font-weight: 400;
}

#epgModalV2 .channel-item-current .now-program {
    font-weight: 600;
    color: #a78bfa;
}

#epgModalV2 .channel-indicators {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* Align right */
    gap: 6px;
    flex-shrink: 0;
    width: 40px;
    /* Fixed width to prevent indentation */
}

#epgModalV2 .channel-flag {
    width: 14px;
    height: 10px;
    border-radius: 2px;
    object-fit: cover;
}

#epgModalV2 .channel-live-indicator {
    width: 6px;
    height: 6px;
    background: #ef4444;
    border-radius: 50%;
    animation: epgV2Blink 1.5s infinite;
    flex-shrink: 0;
}

@keyframes epgV2Blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ===========================================
   MAIN CONTENT
   =========================================== */
#epgModalV2 .main-content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    overflow: hidden;
}

#epgModalV2 .main-content-header {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#epgModalV2 .main-content-scrollable {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
}

#epgModalV2 .main-content-scrollable::-webkit-scrollbar {
    width: 4px;
}

#epgModalV2 .main-content-scrollable::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

#epgModalV2 .main-content-scrollable::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.4);
    border-radius: 2px;
}

/* ===========================================
   NOW PLAYING COMPACT
   =========================================== */
#epgModalV2 .now-playing-compact {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(167, 139, 250, 0.06));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 16px;
}

#epgModalV2 .now-playing-channel {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

#epgModalV2 .now-channel-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    color: #fff;
}

#epgModalV2 .now-channel-info h3 {
    font-size: 14px;
    font-weight: 600;
}

/* Channel name with flag row */
#epgModalV2 .now-channel-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

#epgModalV2 .now-channel-flag {
    width: 18px;
    height: 13px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}

#epgModalV2 .now-channel-info p {
    font-size: 11px;
    color: #888;
}

#epgModalV2 .now-divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
}

#epgModalV2 .now-program-info {
    flex: 1;
    min-width: 0;
}

/* Live Dot - Red blinking indicator */
#epgModalV2 .live-dot {
    display: none;
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    animation: epgV2Blink 1.5s infinite;
    flex-shrink: 0;
    margin-right: -5px
}

#epgModalV2 .now-program-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

/* Live Dot - Aligned center with title */
#epgModalV2 .now-program-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    /* Bold for title */
    color: #fff;
    /* White */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0;
    flex: 1;
}

#epgModalV2 .now-prefix {
    font-weight: 400;
    color: #b3b3b3;
    margin-right: 0px;
}

/* PLAY Button - Visible and styled */
#epgModalV2 .watch-btn {
    display: none;
    padding: 8px 20px;
    background: linear-gradient(135deg, #b91c1c, #7f1d1d);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex-shrink: 0;
}

#epgModalV2 .watch-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, #dc2626, #991b1b);
}

#epgModalV2 .now-program-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: #888;
}

#epgModalV2 .now-program-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Progress Mini */
#epgModalV2 .progress-mini {
    margin-top: 6px;
    display: none;
    align-items: center;
    gap: 8px;
}

#epgModalV2 .progress-mini-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

#epgModalV2 .progress-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 2px;
    transition: width 0.5s ease;
}

#epgModalV2 .progress-mini-time {
    font-size: 10px;
    color: #666;
}

/* ===========================================
   SCHEDULE SECTION
   =========================================== */
#epgModalV2 .schedule-section {
    flex: 1;
    min-height: 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Schedule tabs - FIXED at top using flex-shrink:0 */
#epgModalV2 .schedule-tabs {
    display: flex;
    padding: 6px;
    gap: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: #121218;
    flex-shrink: 0;
    z-index: 10;
    border-radius: 16px 16px 0 0;
}

#epgModalV2 .schedule-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
}

#epgModalV2 .schedule-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

#epgModalV2 .schedule-tab.active {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    color: #fff;
}

/* Schedule content - scrollable area */
#epgModalV2 .schedule-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 0 16px 16px;
}

#epgModalV2 .schedule-content::-webkit-scrollbar {
    width: 3px;
}

#epgModalV2 .schedule-content::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.4);
    border-radius: 2px;
}

#epgModalV2 .schedule-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
}

#epgModalV2 .schedule-item:hover {
    background: rgba(139, 92, 246, 0.06);
}

#epgModalV2 .schedule-item.past {
    opacity: 0.4;
}

#epgModalV2 .schedule-item.current {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(248, 113, 113, 0.04));
    border-left: 3px solid #ef4444;
}

#epgModalV2 .schedule-time {
    min-width: 50px;
    font-size: 14px;
    font-weight: 600;
    color: #a78bfa;
}

#epgModalV2 .schedule-item.past .schedule-time {
    color: #555;
}

#epgModalV2 .schedule-details {
    flex: 1;
    min-width: 0;
}

#epgModalV2 .schedule-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#epgModalV2 .schedule-duration {
    font-size: 11px;
    color: #666;
}

#epgModalV2 .schedule-status {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

#epgModalV2 .schedule-status.live {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

#epgModalV2 .schedule-status.next {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

/* ===========================================
   LOADING SKELETON
   =========================================== */
#epgModalV2 .channel-skeleton {
    display: flex;
    gap: 10px;
    padding: 10px;
    align-items: center;
}

#epgModalV2 .skeleton-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    animation: epgV2Pulse 1.5s infinite;
}

#epgModalV2 .skeleton-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#epgModalV2 .skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    animation: epgV2Pulse 1.5s infinite;
}

#epgModalV2 .skeleton-line.w-60 {
    width: 60%;
}

#epgModalV2 .skeleton-line.w-40 {
    width: 40%;
}

@keyframes epgV2Pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ===========================================
   EMPTY & ERROR STATES
   =========================================== */
#epgModalV2 .empty-state,
#epgModalV2 .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    text-align: center;
    padding: 20px;
}

#epgModalV2 .empty-state svg,
#epgModalV2 .error-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

#epgModalV2 .empty-state p,
#epgModalV2 .error-state p {
    font-size: 13px;
}

#epgModalV2 .error-state button {
    margin-top: 12px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

#epgModalV2 .error-state button:hover {
    transform: scale(1.05);
}

/* ===========================================
   LOADING STATE
   =========================================== */
#epgModalV2 .loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #888;
}

#epgModalV2 .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: epgV2Spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes epgV2Spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===========================================
   TAILWIND-LIKE BACKGROUND COLORS
   =========================================== */
#epgModalV2 .bg-red-600 {
    background: #dc2626;
}

#epgModalV2 .bg-red-800 {
    background: #991b1b;
}

#epgModalV2 .bg-blue-600 {
    background: #2563eb;
}

#epgModalV2 .bg-blue-700 {
    background: #1d4ed8;
}

#epgModalV2 .bg-blue-800 {
    background: #1e40af;
}

#epgModalV2 .bg-green-600 {
    background: #16a34a;
}

#epgModalV2 .bg-green-700 {
    background: #15803d;
}

#epgModalV2 .bg-green-950 {
    background: #052e16;
}

#epgModalV2 .bg-yellow-600 {
    background: #ca8a04;
}

#epgModalV2 .bg-orange-500 {
    background: #f97316;
}

#epgModalV2 .bg-purple-600 {
    background: #9333ea;
}

#epgModalV2 .bg-violet-700 {
    background: #6d28d9;
}

#epgModalV2 .bg-gray-700 {
    background: #374151;
}

#epgModalV2 .bg-slate-400 {
    background: #94a3b8;
}

#epgModalV2 .bg-slate-500 {
    background: #64748b;
}

#epgModalV2 .bg-slate-100 {
    background: #f1f5f9;
    color: #333;
}

#epgModalV2 .bg-gray-200 {
    background: #e5e7eb;
    color: #333;
}

#epgModalV2 .bg-teal-600 {
    background: #0d9488;
}

#epgModalV2 .bg-pink-600 {
    background: #db2777;
}

#epgModalV2 .bg-indigo-600 {
    background: #4f46e5;
}