/* ==========================================================================
   TV.ONETVUZ.COM - ZAMONAVIY WEB APP CSS (FULL RESPONSIVE)
   ========================================================================== */

/* --- GOOGLE FONTS (Tez va Klassik: Inter) --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- 1. RANG O'ZGARUVCHILARI (DARK THEME) --- */
:root {
    --bg-main: #0b0d12;
    --bg-sidebar: #13161f;
    --bg-card: #1c202b;
    --bg-card-hover: #252a38;
    --accent: #009cf0;
    --accent-glow: rgba(0, 156, 240, 0.4); 
    --text-main: #ffffff;
    --text-muted: #8b95a5;
    --border-color: #232836;  
    --live-color: #ff3333;    
}

/* --- 2. ASOSIY SOZLAMALAR --- */
* { box-sizing: border-box; outline: none; }
body.tv-app-body {
    margin: 0; padding: 0;
    background-color: var(--bg-main); color: var(--text-main);
    font-family: 'Inter', sans-serif; 
    overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: #3a4156; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* --- 3. APP WRAPPER VA SIDEBAR --- */
.app-wrapper { display: flex; min-height: 100vh; flex-direction: column; }
.app-sidebar {
    width: 260px; background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed; height: 100vh; left: 0; top: 0;
    display: flex; flex-direction: column; z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-logo { padding: 25px 20px; text-align: center; }
.sidebar-logo img { max-width: 160px; transition: 0.3s; }
.sidebar-logo:hover img { transform: scale(1.05); }

.sidebar-search { padding: 0 20px 20px; }
.search-wrap {
    display: flex; background: var(--bg-main);
    border-radius: 10px; border: 1px solid var(--border-color); transition: 0.3s;
}
.search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.search-wrap input { background: transparent; border: none; color: var(--text-main); padding: 12px 15px; width: 100%; font-family: 'Inter', sans-serif; }
.search-wrap button { background: transparent; border: none; color: var(--text-muted); padding: 0 15px; cursor: pointer; transition: 0.3s; }
.search-wrap button:hover { color: var(--accent); }

.sidebar-nav { flex-grow: 1; overflow-y: auto; padding: 0 15px; }
.nav-item {
    display: flex; align-items: center; padding: 12px 20px;
    color: var(--text-muted); text-decoration: none;
    border-radius: 10px; margin-bottom: 8px; transition: 0.2s;
    font-weight: 500; font-size: 15px;
}
.nav-item i { width: 30px; font-size: 18px; text-align: left; }
.nav-item:hover, .nav-item:focus { background: var(--bg-card); color: var(--text-main); transform: translateX(5px); }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 4px 15px var(--accent-glow); }
.menu-divider { height: 1px; background: var(--border-color); margin: 15px 10px; }

.sidebar-auth { padding: 20px 15px; border-top: 1px solid var(--border-color); }
.auth-btn {
    display: flex; align-items: center; color: var(--text-muted);
    text-decoration: none; padding: 12px 20px; cursor: pointer; transition: 0.2s;
    border-radius: 10px; font-weight: 500;
}
.auth-btn i { width: 30px; font-size: 18px; }
.auth-btn:hover { background: var(--bg-card); color: var(--text-main); }

/* --- 4. ASOSIY KONTENT --- */
.app-main { flex-grow: 1; margin-left: 260px; display: flex; flex-direction: column; min-height: 100vh; }
.content-wrapper { flex-grow: 1; padding: 30px; }

/* --- 5. PWA TUGMASI --- */
.pwa-install-banner {
    display: none; background: linear-gradient(90deg, #1c202b, #004d7a);
    border: 1px solid var(--accent); color: #fff; padding: 15px 20px;
    border-radius: 12px; margin-bottom: 25px; align-items: center; justify-content: space-between;
    box-shadow: 0 5px 20px rgba(0, 156, 240, 0.2); animation: slideDownFade 0.6s ease-out;
}
@keyframes slideDownFade { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.pwa-text { display: flex; align-items: center; gap: 15px; font-weight: 500; font-size: 15px; }
.pwa-text i { font-size: 24px; color: var(--accent); }
.pwa-btn {
    background: #fff; color: var(--accent); border: none;
    padding: 10px 20px; border-radius: 25px; font-weight: bold; cursor: pointer;
    font-family: 'Inter', sans-serif; animation: pulse-btn 2s infinite;
}
@keyframes pulse-btn { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.7); } 70% { box-shadow: 0 0 0 10px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }

/* --- 6. KANALLAR SETKASI (GRID) VA KARTALAR --- */
.channels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.tv-channel-card {
    background: var(--bg-card); border-radius: 12px; overflow: hidden; position: relative;
    border: 2px solid transparent; transition: 0.3s; cursor: pointer; display: flex; flex-direction: column; text-decoration: none; height: 100%;
}
.tv-channel-card:hover, .tv-channel-card:focus {
    transform: translateY(-5px); border-color: var(--accent);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5); background: var(--bg-card-hover); z-index: 10;
}
.channel-logo-wrap {
    height: 130px; min-height: 130px; width: 100%; padding: 15px;
    display: flex; align-items: center; justify-content: center; background: #050608; position: relative; overflow: hidden;
}
.channel-logo-wrap img, .channel-logo-wrap a img {
    max-width: 100% !important; max-height: 100% !important; width: auto !important; height: auto !important;
    object-fit: contain; transition: 0.3s;
}
.tv-channel-card:hover .channel-logo-wrap img { transform: scale(1.08); }
.channel-info { padding: 15px; text-align: center; }
.channel-title { color: var(--text-main); font-size: 15px; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-badge {
    position: absolute; top: 10px; right: 10px; background: var(--live-color); color: #fff; font-size: 10px; font-weight: bold;
    padding: 3px 6px; border-radius: 4px; box-shadow: 0 0 10px rgba(255, 51, 51, 0.6); animation: pulse-red 2s infinite; z-index: 5;
}
.quality-badge {
    position: absolute; bottom: 10px; left: 10px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 800;
    padding: 3px 6px; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.5); z-index: 5;
}

/* --- 7. KATTA PLEYER QISMI (FULLSTORY) MUHIM! --- */
.main-player-wrapper {
    position: relative; 
    width: 100%;
    aspect-ratio: 16 / 9; /* MUHIM: Har doim to'liq ekran (16:9) formatini saqlaydi */
    background: #000; 
    border-radius: 12px; 
    overflow: hidden;
    margin-bottom: 20px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    border: 2px solid transparent; 
    transition: 0.3s;
}
/* Eskiroq brauzerlar uchun zaxira */
@supports not (aspect-ratio: 16 / 9) {
    .main-player-wrapper { height: 0; padding-bottom: 56.25%; }
}
.main-player-wrapper:focus { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow); }
.main-player-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

.player-info-bar {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px;
    background: var(--bg-card); padding: 20px; border-radius: 12px; margin-bottom: 25px;
}
.main-title { margin: 0 0 5px 0; font-size: 22px; font-weight: 700; color: var(--text-main); }
.tags-box { font-size: 13px; color: var(--text-muted); }
.tags-box a { color: var(--accent); text-decoration: none; }
.player-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.action-btn {
    background: var(--bg-main); color: var(--text-main); border: 1px solid var(--border-color);
    padding: 10px 15px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500;
    text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s; font-family: 'Inter', sans-serif;
}
.action-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.tg-btn { background: #2AABEE; color: #fff; border-color: #2AABEE; }
.all-channels-section { margin-top: 30px; border-top: 1px solid var(--border-color); padding-top: 20px; }
.section-title { color: var(--text-main); font-size: 18px; margin-bottom: 20px; font-weight: 600; display: flex; align-items: center; gap: 10px; }

/* TV Dastur Popup */
.tv-schedule-popup {
    position: absolute; z-index: 100; background: rgba(28, 32, 43, 0.95); backdrop-filter: blur(10px);
    border: 1px solid var(--border-color); padding: 15px; border-radius: 12px; width: 300px; max-height: 400px;
    overflow-y: auto; right: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}
.prog-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; padding-bottom: 10px; margin-bottom: 10px;}
.prog-header button { background: none; border: none; color: #fff; cursor: pointer; font-size: 16px; }
.prog-list { list-style: none; padding: 0; margin: 0; }
.prog-item { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05); color: #ccc; font-size: 14px; }
.prog-item.current { color: #fff; font-weight: bold; background: rgba(0, 156, 240, 0.1); padding-left: 10px; border-left: 3px solid var(--accent); }
.prog-item b { color: var(--accent); margin-right: 10px; }

/* --- 8. FOOTER (MUKAMMAL MARKAZLASHGAN) --- */
.app-footer {
    margin-top: auto; padding: 30px 20px; background-color: var(--bg-sidebar); border-top: 1px solid var(--border-color);
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 15px; width: 100%; position: relative; z-index: 10;
}
.test-banner { background: rgba(255, 204, 0, 0.1); color: #ffcc00; padding: 8px 25px; border-radius: 8px; font-size: 13px; font-weight: 600; border: 1px solid rgba(255, 204, 0, 0.3); display: inline-block; margin-bottom: 5px; }
.footer-info { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.footer-info p { margin: 0; color: var(--text-main); font-size: 15px; font-weight: 500; opacity: 0.9; }
.footer-links { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 14px; transition: 0.3s; padding: 6px 12px; border-radius: 6px; }
.footer-links a:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.05); }

/* --- 9. MOBIL VA PLANSHET MOSLASHUV --- */
.mobile-header { display: none; }

@media (max-width: 992px) {
    .app-main { margin-left: 0; padding-top: 60px; }
    .mobile-header {
        display: flex; justify-content: space-between; align-items: center;
        background: rgba(19, 22, 31, 0.95); backdrop-filter: blur(10px);
        height: 60px; padding: 0 20px; position: fixed; top: 0; left: 0; right: 0;
        z-index: 999; border-bottom: 1px solid var(--border-color);
    }
    .menu-toggle, .mobile-login { background: none; border: none; color: var(--text-main); font-size: 24px; cursor: pointer; padding: 0;}
    .app-sidebar { transform: translateX(-100%); box-shadow: 5px 0 25px rgba(0,0,0,0.5); }
    .app-sidebar.active { transform: translateX(0); }
    .content-wrapper { padding: 15px; }
    
    /* Mobil Grid - 2 ta qator */
    .channels-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .channel-logo-wrap { height: 90px; min-height: 90px; padding: 10px; }
    .channel-title { font-size: 13px; }
    
    /* Pleyer sahnasi mobilda */
    .player-info-bar { flex-direction: column; align-items: flex-start; padding: 15px; }
    .player-actions { width: 100%; justify-content: space-between; margin-top: 10px; }
    .action-btn { flex: 1; font-size: 13px; padding: 8px 10px; }
    .tv-schedule-popup { right: 0; left: 0; width: 100%; border-radius: 0; }
    
    .app-footer { padding: 20px 15px; }
    .footer-info p { font-size: 13px; }
    .footer-links { gap: 5px; }
    .footer-links a { font-size: 13px; padding: 4px 8px; }
}

@media (max-width: 480px) {
    /* Juda kichik telefonlar */
    .channels-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .channel-logo-wrap { height: 80px; min-height: 80px; }
    .channel-title { font-size: 12px; }
    .main-title { font-size: 18px; }
}
/* =========================================================
   ZAMONAVIY TV DASTUR PANELI (OFFCANVAS UI)
   ========================================================= */
.tv-guide-offcanvas {
    position: fixed;
    top: 0; right: -350px; /* Dastlab ekrandan tashqarida yashirinadi */
    width: 350px; height: 100vh;
    background: var(--bg-card);
    box-shadow: -5px 0 25px rgba(0,0,0,0.8);
    z-index: 2000;
    transition: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex; flex-direction: column;
}
.tv-guide-offcanvas.active { right: 0; /* Tugma bosilganda chiqib keladi */ }

/* Orqa fonni qoraytiruvchi parda */
.guide-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(3px);
    z-index: 1999; opacity: 0; visibility: hidden; transition: 0.3s;
}
.guide-overlay.active { opacity: 1; visibility: visible; }

.prog-header {
    padding: 20px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-sidebar);
}
.prog-header h3 { margin: 0; font-size: 16px; color: var(--text-main); display: flex; align-items: center; gap: 10px; }
.close-guide {
    background: rgba(255,255,255,0.1); border: none; color: #fff;
    width: 35px; height: 35px; border-radius: 50%; cursor: pointer; transition: 0.2s;
}
.close-guide:hover { background: var(--live-color); transform: rotate(90deg); }

.prog-content-scroll { padding: 20px; overflow-y: auto; flex-grow: 1; }
.prog-list { list-style: none; padding: 0; margin: 0; }
.prog-item {
    display: flex; align-items: center; padding: 12px;
    border-radius: 8px; margin-bottom: 8px; transition: 0.2s;
    background: rgba(255,255,255,0.02); border: 1px solid transparent;
}
.prog-item.passed { opacity: 0.5; }
.prog-item.current {
    background: rgba(0, 156, 240, 0.1); border-color: rgba(0, 156, 240, 0.3);
    border-left: 4px solid var(--accent); color: #fff;
}
.prog-item.upcoming { color: var(--text-muted); }

.p-time { font-weight: 700; width: 55px; color: var(--text-main); }
.p-title { flex-grow: 1; font-size: 14px; font-weight: 500; }
.live-dot {
    background: var(--live-color); color: #fff; font-size: 9px; padding: 2px 5px;
    border-radius: 4px; font-weight: 800; animation: pulse-red 2s infinite;
}
.prog-loader, .prog-error { text-align: center; color: var(--text-muted); padding: 30px; }

/* Mobil uchun offcanvas moslashuvi */
@media (max-width: 480px) {
    .tv-guide-offcanvas { width: 100%; right: -100%; }
}
.ads-box { text-align: center; margin: 20px auto; width: 100%; overflow: hidden; }