@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg-color: #f4f5f9; 
    --text-main: #1d1d1f;
    --text-sub: #86868b;
    --border-color: rgba(0, 0, 0, 0.05);
    --accent-color: #007aff;
    --card-bg: #ffffff;
    --header-bg: rgba(244, 245, 249, 0.85);
    --icon-btn-bg: #ffffff;
    --modal-bg: #f4f5f9;
    --setting-item-bg: #ffffff;
    --drag-line: #ccc;
}

body.dark-theme {
    --bg-color: #000000; 
    --text-main: #f5f5f7;
    --text-sub: #a1a1a6;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-bg: #1c1c1e;
    --header-bg: rgba(0, 0, 0, 0.85);
    --icon-btn-bg: #2c2c2e;
    --modal-bg: #1c1c1e;
    --setting-item-bg: #2c2c2e;
    --drag-line: #444;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-family: 'Inter', sans-serif; }

body { 
    background-color: var(--bg-color); 
    color: var(--text-main); 
    margin: 0; 
    padding: 0; 
    padding-bottom: 50px;
    transition: background-color 0.4s ease, color 0.4s ease;
}

header {
    padding: 20px;
    background: var(--header-bg);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    position: sticky; top: 0; z-index: 90;
    display: flex; justify-content: space-between; align-items: center;
    transition: background-color 0.4s ease;
}

.brand { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: -0.5px; background: linear-gradient(135deg, var(--text-main) 0%, #007aff 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.header-icons { display: flex; gap: 12px; }

.icon-btn {
    width: 45px; height: 45px;
    background: var(--icon-btn-bg);
    color: var(--text-main);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 20px; cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}
.icon-btn:active { transform: scale(0.9); }

.container { padding: 0 20px; width: 100%; max-width: 1400px; margin: 0 auto; }

/* ================= بەشی کارتەکان ================= */
.main-categories-view { display: flex; flex-direction: column; gap: 20px; animation: fadeIn 0.5s ease; margin-top: 10px; }

.modern-cat-card {
    border-radius: 30px; 
    padding: 25px 22px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    border: none; 
    cursor: pointer; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    position: relative; 
    overflow: hidden;
    color: white;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.cat-news { background: linear-gradient(135deg, #0052D4 0%, #4364F7 50%, #6FB1FC 100%); }
.cat-sports { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.cat-movies { background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%); }
.cat-series { background: linear-gradient(135deg, #8E2DE2 0%, #4A00E0 100%); }
.cat-kids { background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%); }

.modern-cat-card::after {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(45deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 100%);
    transform: rotate(30deg) translateY(-100%);
    transition: transform 0.6s ease; pointer-events: none;
}

.modern-cat-card:hover { transform: translateY(-8px) scale(1.02); box-shadow: 0 22px 40px rgba(0,0,0,0.25); }
.modern-cat-card:hover::after { transform: rotate(30deg) translateY(100%); }
.modern-cat-card:active { transform: scale(0.96); }

.cat-info { display: flex; align-items: center; gap: 20px; position: relative; z-index: 2; }

.cat-icon { 
    width: 75px; 
    height: 75px; 
    border-radius: 22px; 
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15); 
    display: flex; justify-content: center; align-items: center;
    flex-shrink: 0; padding: 6px;
    transition: all 0.4s ease;
}

.cat-logo-img { 
    width: 100%; height: 100%; 
    object-fit: cover; 
    border-radius: 16px;
    display: block;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

.modern-cat-card:hover .cat-icon { transform: rotate(-5deg); background: rgba(255, 255, 255, 0.35); }
.modern-cat-card:hover .cat-logo-img { transform: scale(1.15); }

.cat-text { display: flex; flex-direction: column; justify-content: center; }
.cat-text h3 { margin: 0 0 6px 0; font-size: 24px; font-weight: 800; color: white; letter-spacing: -0.5px; text-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.cat-text p { margin: 0; font-size: 15px; color: rgba(255, 255, 255, 0.9); font-weight: 500; }

.go-icon { 
    background: rgba(255, 255, 255, 0.2); 
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    width: 48px; height: 48px; 
    border-radius: 50%; 
    display: flex; justify-content: center; align-items: center; 
    color: white; font-size: 20px; 
    transition: all 0.4s ease; 
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.modern-cat-card:hover .go-icon { 
    background: white; color: var(--text-main); 
    transform: translateX(6px); 
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* ================= بەشی لیستی کەناڵەکان ================= */
.channels-list-view { display: none; animation: slideIn 0.4s ease forwards; }

.header-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.back-btn { background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-main); font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 18px; border-radius: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.03); transition: all 0.2s; }
.back-btn:active { transform: scale(0.95); }
.category-title-display { font-size: 22px; font-weight: 800; margin: 0; color: var(--text-main); }

.player-section { width: 100%; max-width: 900px; margin: 0 auto 30px auto; position: relative; }
.modal-box-wrapper { position: relative; border-radius: 24px; padding: 4px; background: rgba(0, 0, 0, 0.5); z-index: 10; }
.modal-box-wrapper::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 24px; background: linear-gradient(45deg, #ff00cc, #3333ff, #00d2ff, #ff00cc, #3333ff); background-size: 400%; z-index: -1; animation: glowingBorder 12s linear infinite; filter: blur(4px); }
@keyframes glowingBorder { 0% { background-position: 0 0; } 50% { background-position: 400% 0; } 100% { background-position: 0 0; } }
.modal-content { background: #000; border-radius: 20px; overflow: hidden; width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
video { width: 100%; aspect-ratio: 16/9; display: block; object-fit: contain; background: #000; outline: none; }

.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 22px; 
    padding-bottom: 30px; 
}

@media (min-width: 1024px) {
    .main-categories-view { display: grid; grid-template-columns: repeat(3, 1fr); }
    .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 30px; }
}

.channel-card { background: transparent; display: flex; flex-direction: column; transition: all 0.4s ease; cursor: pointer; position: relative; }
.channel-card:hover { transform: translateY(-8px) scale(1.02); }
.channel-card:active { transform: scale(0.95); }

.icon-wrapper { position: relative; width: 100%; aspect-ratio: 16/10; margin-bottom: 12px; border-radius: 22px; background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg-color) 100%); box-shadow: 0 12px 25px rgba(0,0,0,0.06); display: flex; justify-content: center; align-items: center; overflow: hidden; border: 1px solid var(--border-color); }
.app-icon { width: 55%; height: 55%; object-fit: contain; filter: drop-shadow(0 5px 8px rgba(0,0,0,0.1)); transition: all 0.4s ease; }
.channel-card:hover .app-icon { transform: scale(1.15); }

.play-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 122, 255, 0.1); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: center; opacity: 0; transition: all 0.3s ease; }
.channel-card:hover .play-overlay { opacity: 1; }
.play-icon-circle { width: 45px; height: 45px; background: var(--accent-color); border-radius: 50%; display: flex; justify-content: center; align-items: center; color: white; font-size: 18px; padding-left: 3px; box-shadow: 0 5px 20px rgba(0, 122, 255, 0.5); transform: translateY(15px); transition: transform 0.4s ease; }
.channel-card:hover .play-icon-circle { transform: translateY(0); }

.live-badge { position: absolute; top: 10px; right: 10px; background: linear-gradient(135deg, #ff3b30 0%, #ff2d55 100%); color: white; font-size: 10px; font-weight: 800; padding: 4px 8px; border-radius: 8px; box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4); z-index: 2; display: flex; align-items: center; gap: 5px; }
.live-dot { width: 6px; height: 6px; background: #fff; border-radius: 50%; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }

.info-container { width: 100%; display: flex; flex-direction: column; align-items: flex-start; padding: 0 6px; }
.name { font-size: 15px; font-weight: 700; color: var(--text-main); margin-bottom: 2px; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-category { font-size: 13px; font-weight: 500; color: var(--text-sub); }

/* ================= بەشی Settings ================= */
.settings-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    z-index: 999; opacity: 0; visibility: hidden; transition: opacity 0.3s ease;
    display: flex; justify-content: center; align-items: flex-end;
}
.settings-overlay.active { opacity: 1; visibility: visible; }

.settings-modal {
    background: var(--modal-bg);
    width: 100%; max-width: 600px;
    border-radius: 30px 30px 0 0;
    padding: 12px 25px 35px 25px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.1, 0.8, 0.25, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    max-height: 95vh; overflow-y: auto;
    position: relative;
    touch-action: none;
}
.settings-overlay.active .settings-modal { transform: translateY(0); }

.drag-zone { width: 100%; padding: 10px 0; display: flex; justify-content: center; align-items: center; cursor: grab; }
.drag-zone:active { cursor: grabbing; }
.drag-handle { width: 40px; height: 5px; background-color: var(--drag-line); border-radius: 3px; transition: background-color 0.3s; }

.settings-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.settings-header h2 { margin: 0; font-size: 24px; font-weight: 800; color: var(--text-main); }

.close-settings-btn {
    width: 35px; height: 35px;
    background: var(--icon-btn-bg);
    border: 1px solid var(--border-color);
    color: var(--text-sub);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: all 0.2s;
}
.close-settings-btn:active { transform: scale(0.9); }

.app-profile { text-align: center; margin-bottom: 30px; }

.app-logo-img { 
    width: 90px; height: 90px; 
    border-radius: 22px; 
    margin: 0 auto 15px; 
    display: block; 
    object-fit: cover; 
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); 
}

.app-profile h3 { margin: 0; font-size: 22px; color: var(--text-main); font-weight: 800; }
.app-profile p { margin: 5px 0 0; font-size: 14px; color: var(--text-sub); font-weight: 500; }

.settings-list { background: var(--setting-item-bg); border-radius: 20px; padding: 10px 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.02); margin-bottom: 25px; border: 1px solid var(--border-color); }
.setting-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border-color); }
.setting-item:last-child { border-bottom: none; }
.setting-item-left { display: flex; align-items: center; gap: 15px; color: var(--text-main); font-size: 16px; font-weight: 600; }
.setting-item-left i { font-size: 20px; color: var(--text-sub); width: 25px; text-align: center; }

.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #e5e5ea; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: #34c759; }
input:checked + .slider:before { transform: translateX(22px); }
body.dark-theme .slider { background-color: #3a3a3c; }
body.dark-theme input:checked + .slider { background-color: #30d158; }

.refresh-btn { background: rgba(0, 122, 255, 0.1); color: var(--accent-color); border: none; padding: 8px 15px; border-radius: 12px; font-weight: 700; cursor: pointer; font-size: 14px; transition: 0.2s; }
.refresh-btn:active { transform: scale(0.9); }

.social-section { margin-top: 10px; }
.social-title { font-size: 14px; color: var(--text-sub); font-weight: 700; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px; padding-left: 5px; }
.social-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.social-btn { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 18px; border-radius: 20px; font-size: 16px; font-weight: 700; color: white; text-decoration: none; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.social-btn i { font-size: 24px; }
.social-btn:hover { transform: translateY(-5px); box-shadow: 0 12px 25px rgba(0,0,0,0.15); }
.social-btn:active { transform: scale(0.95); }

.btn-tg { background: linear-gradient(135deg, #0088cc 0%, #24a1de 100%); }
.btn-ig { background: linear-gradient(135deg, #f9ce34 0%, #ee2a7b 50%, #6228d7 100%); }
.btn-tt { background: linear-gradient(135deg, #000000 0%, #25f4ee 50%, #fe2c55 100%); color: #fff; }
.btn-snap { background: linear-gradient(135deg, #fffc00 0%, #f1eb00 100%); color: #000 !important; }

@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
