/* TV Indonesia - Gvision Style */
:root {
    --bg: #0d0d11;
    --bg2: #151520;
    --bg3: #1c1c2b;
    --card-bg: #1a1a28;
    --card-hover: #252538;
    --accent: #f59e0b;
    --accent2: #fb923c;
    --text: #e5e5e5;
    --text2: #9ca3af;
    --text3: #6b7280;
    --border: rgba(255, 255, 255, 0.06);
    --radius: 10px;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden
}

::-webkit-scrollbar {
    width: 4px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .1);
    border-radius: 2px
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transition: transform .3s
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border)
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px
}

.logo-icon {
    font-size: 1.5rem
}

.logo h1 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent)
}

.logo-sub {
    font-size: .6rem;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: .08em
}

.sidebar-actions {
    padding: 8px 12px
}

.btn-action {
    width: 100%;
    padding: 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: .2s
}

.btn-action:hover {
    background: var(--card-hover);
    border-color: var(--accent)
}

.search-wrap {
    padding: 0 12px 8px
}

.search-wrap input {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: .78rem;
    font-family: inherit;
    outline: none;
    transition: .2s
}

.search-wrap input:focus {
    border-color: var(--accent)
}

.search-wrap input::placeholder {
    color: var(--text3)
}

/* Category List */
.category-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0
}

.cat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    font-size: .78rem;
    font-weight: 500;
    color: var(--text2);
    transition: .15s;
    border-left: 3px solid transparent
}

.cat-item:hover {
    background: rgba(255, 255, 255, .03);
    color: var(--text)
}

.cat-item.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: rgba(245, 158, 11, .05);
    font-weight: 700
}

.cat-count {
    font-size: .65rem;
    background: rgba(255, 255, 255, .06);
    padding: 2px 7px;
    border-radius: 10px;
    color: var(--text3)
}

.cat-item.active .cat-count {
    color: var(--accent);
    background: rgba(245, 158, 11, .1)
}

/* Main */
.main {
    margin-left: 220px;
    flex: 1;
    min-height: 100vh;
    padding: 16px
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px
}

.menu-toggle {
    display: none;
    padding: 8px 14px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit
}

.clock {
    font-size: .8rem;
    color: var(--text2);
    font-variant-numeric: tabular-nums
}

/* Channel Grid */
.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px
}

.channel-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 8px;
    text-align: center;
    cursor: pointer;
    transition: .2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px
}

.channel-card:hover {
    background: var(--card-hover);
    border-color: rgba(255, 255, 255, .12);
    transform: translateY(-2px)
}

.channel-card .ch-logo {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255, 255, 255, .04);
    padding: 4px
}

.channel-card .ch-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    font-weight: 700;
    color: #fff
}

.channel-card .ch-name {
    font-size: .7rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
    word-break: break-word
}

.no-results {
    text-align: center;
    padding: 60px;
    color: var(--text3);
    font-size: .9rem
}

/* Player Overlay */
.player-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 200;
    display: none;
    flex-direction: column
}

.player-overlay.active {
    display: flex
}

.player-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(0, 0, 0, .8);
    z-index: 10
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px
}

.live-badge {
    color: #ef4444;
    font-size: .75rem;
    font-weight: 700;
    animation: pulse 1.5s infinite
}

#playerChannelName {
    font-size: .9rem;
    font-weight: 600
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: .2s
}

.close-btn:hover {
    background: rgba(255, 255, 255, .1)
}

.player-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000
}

.player-container video {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    object-fit: contain
}

.player-loading,
.player-error {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, .85);
    z-index: 5
}

.player-loading.active,
.player-error.active {
    display: flex
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, .1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite
}

.player-loading p,
.player-error p {
    color: var(--text2);
    font-size: .85rem
}

.player-error button {
    padding: 8px 20px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: .8rem
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .4
    }
}

/* Responsive */
@media(max-width:768px) {
    .sidebar {
        transform: translateX(-100%)
    }

    .sidebar.open {
        transform: translateX(0)
    }

    .main {
        margin-left: 0
    }

    .menu-toggle {
        display: block
    }

    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px
    }

    .channel-card {
        padding: 10px 6px
    }

    .channel-card .ch-logo,
    .channel-card .ch-placeholder {
        width: 44px;
        height: 44px
    }
}