/* ===========================================
   EPG Guide V2 - Mobile CSS
   All selectors scoped under #epgModalV2
   =========================================== */

/* ===========================================
   MOBILE MODAL - FULLSCREEN
   =========================================== */
@media (max-width: 768px) {
    #epgModalV2 {
        inset: 0;
        border-radius: 0;
        transform: scale(0.95);
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
    }

    #epgModalV2.active {
        transform: scale(1);
    }

    #epgModalV2 .epg-wrapper {
        flex-direction: column;
        height: 100%;
        min-height: 100%;
        overflow: hidden;
    }

    #epgModalV2 .sidebar {
        position: relative;
        width: 100%;
        max-height: none;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        flex-shrink: 0;
        overflow: visible;
    }

    #epgModalV2 .sidebar-header {
        padding: 8px 12px;
        flex-wrap: nowrap;
    }

    #epgModalV2 .sidebar-header h1 {
        flex: 1;
        font-size: 14px;
    }

    #epgModalV2 .back-btn {
        width: 28px;
        height: 28px;
    }

    /* Mobile: Show search button in header */
    #epgModalV2 .mobile-search-btn {
        display: flex;
        width: 28px;
        height: 28px;
    }

    /* Hide desktop search box */
    #epgModalV2 .search-box {
        display: none;
    }

    /* Hide dropdown on mobile, show chips */
    #epgModalV2 .category-dropdown-wrapper {
        display: none;
    }

    #epgModalV2 .category-chips-wrapper {
        display: block;
    }

    #epgModalV2 .category-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 5px 12px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    #epgModalV2 .category-chips::-webkit-scrollbar {
        display: none;
    }

    #epgModalV2 .category-chip {
        padding: 4px 10px;
        font-size: 11px;
        flex-shrink: 0;
    }

    /* ===========================================
       CHANNEL LIST - HORIZONTAL SCROLL
       =========================================== */
    #epgModalV2 .channel-list {
        display: flex;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 12px;
        flex: none;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    #epgModalV2 .channel-list::-webkit-scrollbar {
        display: none;
    }

    /* ===========================================
       MOBILE CHANNEL CARD - SINGLE LOGO LAYOUT
       Left: [Logo centered vertically]
       Right: Row 1: [Flag] [Channel Name]
              Row 2: [Red Dot] [Current Program]
       =========================================== */
    #epgModalV2 .channel-item {
        flex-direction: row;
        align-items: center;
        min-width: 150px;
        max-width: 170px;
        padding: 10px 12px;
        text-align: left;
        margin-bottom: 0;
        position: relative;
        flex-shrink: 0;
        gap: 10px;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.06);
    }

    #epgModalV2 .channel-item:active {
        background: rgba(139, 92, 246, 0.15);
    }

    #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.3);
    }

    /* Single logo - centered vertically on left */
    #epgModalV2 .channel-item-logo {
        width: 36px;
        height: 36px;
        font-size: 9px;
        margin: 0;
        border-radius: 50%;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #epgModalV2 .channel-item.active .channel-item-logo {
        box-shadow: 0 0 0 2px #8b5cf6;
    }

    /* Text content container - stacked on right */
    #epgModalV2 .channel-item .channel-text-content {
        display: flex;
        flex-direction: column;
        gap: 2px;
        flex: 1;
        min-width: 0;
    }

    /* Row 1: Flag + Channel Name */
    #epgModalV2 .channel-item .channel-row-1 {
        display: flex;
        align-items: center;
        gap: 5px;
        width: 100%;
    }

    /* Smaller Flag */
    #epgModalV2 .channel-item .channel-flag-row1 {
        width: 14px;
        height: 10px;
        border-radius: 1px;
        object-fit: cover;
        flex-shrink: 0;
    }

    /* Channel name in Row 1 */
    #epgModalV2 .channel-item .channel-name-row1 {
        font-size: 11px;
        font-weight: 600;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }

    /* Row 2: Red Dot + Current Program */
    #epgModalV2 .channel-item .channel-row-2 {
        display: flex;
        align-items: center;
        gap: 5px;
        width: 100%;
    }

    /* Red blinking dot in Row 2 */
    #epgModalV2 .channel-item .channel-row-2 .live-dot-row2 {
        width: 6px;
        height: 6px;
        background: #ef4444;
        border-radius: 50%;
        animation: epgV2Blink 1.5s infinite;
        flex-shrink: 0;
    }

    /* Current program in Row 2 */
    #epgModalV2 .channel-item .channel-row-2 .program-name-row2 {
        font-size: 8px;
        color: #a78bfa;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
        font-weight: 500;
    }

    /* Hide default info container on mobile */
    #epgModalV2 .channel-item-info {
        display: none;
    }

    /* Hide old elements that are no longer needed */
    #epgModalV2 .channel-item-name {
        display: none;
    }

    #epgModalV2 .channel-item-current {
        display: none;
    }

    #epgModalV2 .channel-live-indicator {
        display: none;
    }

    #epgModalV2 .channel-indicators {
        display: none !important;
    }

    #epgModalV2 .channel-flag {
        display: none;
    }

    /* ===========================================
       MAIN CONTENT AREA
       =========================================== */
    #epgModalV2 .main-content {
        margin-left: 0;
        padding: 14px;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    #epgModalV2 .main-content-header {
        flex-shrink: 0;
    }

    #epgModalV2 .main-content-scrollable {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* ===========================================
       NOW PLAYING SECTION - COMPACT
       =========================================== */
    #epgModalV2 .now-playing-compact {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px;
        gap: 10px;
        align-items: flex-start;
    }

    #epgModalV2 .now-playing-channel {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    #epgModalV2 .now-channel-logo {
        width: 36px;
        height: 36px;
        font-size: 10px;
        flex-shrink: 0;
        border-radius: 50%;
    }

    #epgModalV2 .now-channel-info {
        flex: 1;
        text-align: left;
        min-width: 0;
    }

    #epgModalV2 .now-channel-info h3 {
        font-size: 13px;
        font-weight: 600;
    }

    /* Channel name with flag row - Mobile */
    #epgModalV2 .now-channel-name-row {
        display: flex;
        align-items: center;
        gap: 5px;
    }

    #epgModalV2 .now-channel-flag {
        width: 16px;
        height: 12px;
        border-radius: 1px;
        object-fit: cover;
        flex-shrink: 0;
    }

    #epgModalV2 .now-channel-info p {
        font-size: 10px;
        color: #888;
    }

    /* Live Dot - Red blinking indicator for mobile */
    #epgModalV2 .live-dot {
        display: none;
        width: 6px;
        height: 6px;
        background-color: #ef4444;
        border-radius: 50%;
        animation: epgV2Blink 1.5s infinite;
        flex-shrink: 0;
        margin-right: -2px;
    }

    #epgModalV2 .now-divider {
        display: none;
    }

    #epgModalV2 .now-program-info {
        width: 100%;
    }

    #epgModalV2 .now-program-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 2px;
    }

    /* Container for dot + title */
    #epgModalV2 .now-program-row .now-program-title-wrapper {
        display: flex;
        align-items: center;
        gap: 4px;
        flex: 1;
        min-width: 0;
    }

    #epgModalV2 .now-program-title {
        white-space: normal;
        overflow: visible;
        line-height: 1.3;
        font-size: 11px;
        font-weight: 600;
        color: #fff;
        flex: 1;
    }

    #epgModalV2 .now-prefix {
        font-weight: 400;
        color: #b3b3b3;
        margin-right: -2px;
    }

    /* PLAY Button Mobile - Aligned right */
    #epgModalV2 .watch-btn {
        display: none;
        padding: 5px 12px;
        background: linear-gradient(135deg, #b91c1c, #7f1d1d);
        color: white;
        border: none;
        border-radius: 6px;
        font-size: 9px;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.2s ease;
        white-space: nowrap;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
        align-self: center;
    }

    #epgModalV2 .now-program-meta {
        font-size: 10px;
        margin-top: 2px;
    }

    #epgModalV2 .progress-mini {
        display: flex;
        margin-top: 6px;
    }

    /* ===========================================
       SCHEDULE SECTION
       =========================================== */
    #epgModalV2 .schedule-section {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* Schedule tabs - FIXED at top, not scrolling */
    #epgModalV2 .schedule-tabs {
        padding: 4px;
        gap: 4px;
        flex-shrink: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        background: #121218;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    #epgModalV2 .schedule-tabs::-webkit-scrollbar {
        display: none;
    }

    #epgModalV2 .schedule-tab {
        padding: 6px 12px;
        font-size: 11px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Schedule content - scrollable area */
    #epgModalV2 .schedule-content {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    #epgModalV2 .schedule-item {
        padding: 14px 16px;
        gap: 14px;
    }

    #epgModalV2 .schedule-time {
        font-size: 13px;
        min-width: 48px;
        font-weight: 600;
    }

    #epgModalV2 .schedule-title {
        white-space: normal;
        line-height: 1.4;
        font-size: 14px;
    }

    #epgModalV2 .schedule-duration {
        font-size: 11px;
        margin-top: 2px;
    }

    #epgModalV2 .schedule-status {
        font-size: 10px;
        padding: 4px 10px;
    }

    /* ===========================================
       LOADING SKELETON - Updated for two-row layout
       =========================================== */
    #epgModalV2 .channel-skeleton {
        flex-direction: column;
        align-items: stretch;
        min-width: 160px;
        max-width: 180px;
        text-align: left;
        flex-shrink: 0;
        padding: 10px 12px;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 12px;
        gap: 6px;
    }

    #epgModalV2 .skeleton-logo {
        width: 28px;
        height: 28px;
        margin: 0;
        border-radius: 50%;
    }

    #epgModalV2 .skeleton-text {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    #epgModalV2 .skeleton-line.w-60 {
        width: 80px;
        height: 10px;
    }

    #epgModalV2 .skeleton-line.w-40 {
        display: block;
        width: 60px;
        height: 10px;
    }

    /* ===========================================
       EMPTY & ERROR STATES
       =========================================== */
    #epgModalV2 .empty-state,
    #epgModalV2 .error-state {
        height: 150px;
        padding: 16px;
    }

    #epgModalV2 .empty-state svg,
    #epgModalV2 .error-state svg {
        width: 40px;
        height: 40px;
    }

    #epgModalV2 .empty-state p,
    #epgModalV2 .error-state p {
        font-size: 12px;
    }
}

/* ===========================================
   MOBILE SEARCH MODAL
   =========================================== */
#epgModalV2 .mobile-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f0f13;
    z-index: 10000;
    display: none;
    flex-direction: column;
    padding: 16px;
}

#epgModalV2 .mobile-search-modal.active {
    display: flex;
}

#epgModalV2 .mobile-search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

#epgModalV2 .search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 12px 16px;
}

#epgModalV2 .search-input-wrapper svg {
    width: 20px;
    height: 20px;
    color: #888;
    flex-shrink: 0;
}

#epgModalV2 .search-input-wrapper input {
    background: transparent;
    border: none;
    color: #fff;
    width: 100%;
    font-size: 15px;
    outline: none;
}

#epgModalV2 .search-input-wrapper input::placeholder {
    color: #666;
}

#epgModalV2 .close-search-btn {
    background: none;
    border: none;
    color: #a78bfa;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
}

/* ===========================================
   MOBILE SEARCH RESULTS - HORIZONTAL LAYOUT
   =========================================== */
#epgModalV2 .mobile-search-results {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 100px;
    width: 100%;
}

/* Search result item - horizontal card layout */
#epgModalV2 .mobile-search-results .channel-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100%;
    min-width: 0;
    max-width: none !important;
    background: rgba(255, 255, 255, 0.04);
    padding: 12px 14px;
    border-radius: 14px;
    text-align: left;
    gap: 12px;
}

#epgModalV2 .mobile-search-results .channel-item:active {
    background: rgba(139, 92, 246, 0.15);
}

/* Logo in search results */
#epgModalV2 .mobile-search-results .channel-item-logo {
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    flex-shrink: 0;
    border-radius: 50%;
    font-size: 11px !important;
}

/* Info section in search results */
#epgModalV2 .mobile-search-results .channel-item-info {
    text-align: left !important;
    flex: 1;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start !important;
    min-width: 0;
    gap: 2px;
}

/* Channel name with live indicator */
#epgModalV2 .mobile-search-results .channel-item-name {
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    gap: 6px;
    text-align: left !important;
    font-size: 14px !important;
    font-weight: 500;
    max-width: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff !important;
}

/* Current program in search results */
#epgModalV2 .mobile-search-results .channel-item-current {
    display: block !important;
    text-align: left;
    font-size: 12px;
    color: #888 !important;
    margin-top: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#epgModalV2 .mobile-search-results .channel-item-current .now-label {
    color: #666 !important;
}

#epgModalV2 .mobile-search-results .channel-item-current .now-program {
    color: #a78bfa !important;
    font-weight: 500;
}

/* Live indicator in search results - next to name */
#epgModalV2 .mobile-search-results .channel-live-indicator {
    position: static !important;
    margin: 0 !important;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    flex-shrink: 0;
    animation: epgV2Blink 1.5s infinite;
}

/* Flag in search results - on right side */
#epgModalV2 .mobile-search-results .channel-indicators {
    display: flex !important;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

#epgModalV2 .mobile-search-results .channel-flag {
    width: 22px;
    height: 15px;
    border-radius: 2px;
}

/* ===========================================
   PREVENT AUTO-ZOOM ON MOBILE INPUTS
   =========================================== */
@media screen and (max-width: 768px) {
    #epgModalV2 .search-input-wrapper input {
        font-size: 16px !important;
    }
}

/* ===========================================
   SCHEDULE LIST TEXT SIZES (MOBILE)
   Ubah font-size di bawah ini sesuai keinginan
   =========================================== */
@media screen and (max-width: 768px) {

    /* Waktu (Contoh: 10:30) */
    #epgModalV2 .schedule-time {
        font-size: 13px;
        /* Default desktop 14px */
    }

    /* Judul Program (Contoh: Lintas iNews Siang) */
    #epgModalV2 .schedule-title {
        font-size: 11px;
        /* Default desktop 14px */
    }

    /* Durasi (Contoh: 45m • 10:30 - 11:15) */
    #epgModalV2 .schedule-duration {
        font-size: 11px;
        /* Default desktop 11px */
    }
}