:root {
    --bg-main: #0a0e17;
    --bg-card: #131b2e;
    --bg-hover: #1e293b;
    --accent: #2563eb;
    --accent-hover: #3b82f6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --sidebar-width: 350px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* ==========================================
   ডেক্সটপ সাইডবার ও হেডার লেআউট
   ========================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 20;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.channel-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: normal;
}

.playlist-input-container {
    display: flex;
    gap: 8px;
}

.playlist-input-container input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    outline: none;
}

.playlist-input-container input:focus {
    border-color: var(--accent);
}

.playlist-input-container button {
    padding: 8px 12px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.playlist-input-container button:hover {
    background: var(--accent-hover);
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    background: var(--bg-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.category-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-main);
    outline: none;
    font-size: 0.85rem;
    cursor: pointer;
}

/* ==========================================
   চ্যানেল আইটেম ও লিস্ট ডিজাইন
   ========================================== */
.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 6px;
    position: relative;
}

.channel-item:hover {
    background: var(--bg-hover);
}

.channel-item.active {
    background: var(--accent);
}

.channel-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px;
    flex-shrink: 0;
}

.channel-details {
    flex: 1;
    overflow: hidden;
}

.channel-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-group {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.channel-item.active .channel-group {
    color: rgba(255, 255, 255, 0.8);
}

.fav-btn {
    color: var(--text-muted);
    font-size: 1rem;
    padding: 4px;
    transition: color 0.2s;
}

.fav-btn.active, .fav-btn:hover {
    color: #f59e0b;
}

/* ==========================================
   ভিডিও প্লেয়ার ও কন্ট্রোল লেআউট
   ========================================== */
.main-content {
    flex: 1;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.9) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.video-wrapper.user-active .controls-overlay {
    opacity: 1;
    pointer-events: auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.current-channel-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-channel-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.btn-toggle-sidebar {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    font-weight: 500;
}

.bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.controls-left, .controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.control-btn:hover {
    color: var(--accent-hover);
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider {
    width: 70px;
    accent-color: var(--accent);
    cursor: pointer;
}

.quality-select {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 10px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    font-size: 0.85rem;
}

/* স্পিনার লোডার */
.loader {
    position: absolute;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    display: none;
    z-index: 5;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================
   মোবাইল নেটিভ অ্যাপ লেআউট (Sticky Video + Cards)
   ========================================== */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: 100vh;
        overflow-y: auto;
        background-color: var(--bg-main);
        -webkit-overflow-scrolling: touch;
    }

    /* উপরে স্টিকি ভিডিও প্লেয়ার (Aspect Ratio 16:9) */
    .main-content {
        position: sticky;
        top: 0;
        z-index: 100;
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        flex: none;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
        background: #000;
    }

    .video-wrapper {
        width: 100%;
        height: 100%;
    }

    /* ভিডিওর নিচে স্ক্রোলযোগ্য চ্যানেল লিস্ট */
    .sidebar {
        position: relative;
        width: 100%;
        max-width: 100%;
        height: auto;
        flex: 1;
        transform: none !important;
        border-right: none;
        background: var(--bg-main);
    }

    .sidebar-header {
        position: sticky;
        top: 0;
        z-index: 10;
        background: rgba(19, 27, 46, 0.95);
        backdrop-filter: blur(12px);
        padding: 12px 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .channel-list {
        padding: 12px 16px 24px 16px;
        overflow-y: visible;
    }

    /* মডার্ন কার্ড ভিত্তিক লিস্ট ডিজাইন */
    .channel-item {
        background: var(--bg-card);
        border: 1px solid rgba(255, 255, 255, 0.05);
        margin-bottom: 8px;
        padding: 12px;
        border-radius: 12px;
        transition: transform 0.15s ease, background 0.15s ease;
    }

    .channel-item:active {
        transform: scale(0.98);
    }

    .channel-item.active {
        background: linear-gradient(135deg, var(--accent) 0%, #1d4ed8 100%);
        border-color: transparent;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    }

    .btn-toggle-sidebar {
        display: none;
    }

    .volume-slider {
        display: none;
    }

    .controls-overlay {
        padding: 12px;
    }
}
