/* Xtream Codes IPTV Player - Dark Theme Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0f172a;
    --bg-panel: #1e293b;
    --bg-card: #0f172a;
    --bg-input: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #818cf8;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --warning: #f59e0b;
    --border: #334155;
    --radius: 10px;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-panel);
    padding: 48px 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-header h1 {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 15px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    border: 1px solid transparent;
    backdrop-filter: blur(4px);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text);
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-group input::placeholder {
    color: #64748b;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.login-footer {
    margin-top: 36px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== LAYOUT ===== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-panel);
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.site-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.user-greet {
    font-size: 14px;
    color: var(--text-muted);
}

/* Navigation */
.main-nav {
    display: flex;
    gap: 6px;
    background: var(--bg-panel);
    padding: 6px 28px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.nav-item {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--bg-input);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
}

.nav-item.nav-logout {
    margin-left: auto;
    color: var(--danger);
}

.nav-item.nav-logout:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Container */
.container {
    max-width: 1300px;
    margin: 28px auto;
    padding: 0 24px;
}

/* Cards */
.card {
    background: var(--bg-panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.card h3 {
    padding: 18px 24px;
    font-size: 17px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    background: var(--bg-input);
}

.card > div {
    padding: 20px 24px;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.info-item .label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.info-item .value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.status-active {
    color: var(--success);
}

/* Stats */
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.stat-box {
    flex: 1;
    text-align: center;
    padding: 20px 16px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.stat-number {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    display: block;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    display: block;
}

.progress-bar {
    height: 8px;
    background: #334155;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.action-card:hover {
    background: var(--bg-input);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.action-icon {
    font-size: 34px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.action-title {
    font-size: 16px;
    font-weight: 600;
    display: block;
}

.action-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
}

.category-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 24px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.category-tab:hover, .category-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.category-tabs::-webkit-scrollbar {
    height: 4px;
}
.category-tabs::-webkit-scrollbar-track {
    background: transparent;
}
.category-tabs::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 2px;
}

/* Content Grid - Movies / Poster View */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 22px;
}

.poster-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
}

.poster-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px -6px rgba(0,0,0,0.4);
    border-color: var(--primary);
}

.poster-thumb {
    position: relative;
    width: 100%;
    height: 270px;
    background: #0f172a;
    overflow: hidden;
}

.poster-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.poster-card:hover .poster-thumb img {
    transform: scale(1.05);
}

.poster-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
    backdrop-filter: blur(4px);
}

.poster-card:hover .poster-overlay {
    opacity: 1;
}

.poster-play {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.poster-info {
    padding: 14px 16px;
}

.poster-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.poster-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* Channel List View */
.channel-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.channel-item:hover {
    background: var(--bg-input);
    border-color: var(--primary);
    transform: translateX(4px);
}

.channel-logo {
    width: 52px;
    height: 52px;
    background: #0f172a;
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    border: 1px solid var(--border);
}

.channel-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.channel-info {
    flex: 1;
    min-width: 0;
}

.channel-number {
    font-size: 13px;
    font-weight: 800;
    color: var(--primary);
    margin-right: 10px;
    min-width: 26px;
    display: inline-block;
}

.channel-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 3px;
}

.channel-category {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.channel-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.channel-item:hover .channel-actions {
    opacity: 1;
}

.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--text);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Player */
.player-container {
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 24px;
}

.player-card {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.video-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    display: block;
}

.player-actions {
    display: flex;
    gap: 12px;
    padding: 20px 28px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.player-meta {
    padding: 20px 28px;
    color: var(--text);
}

.player-meta h2 {
    font-size: 22px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.player-meta p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stream-links {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Dashboard category grid */
.dashboard-cats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.cat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    display: block;
}

.cat-card:hover {
    background: var(--bg-input);
    border-color: var(--primary);
    transform: translateY(-3px);
}

.cat-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.cat-title {
    font-size: 17px;
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

.cat-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* Loading */
.skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
    display: block;
}

/* Player Action Buttons - one line on desktop, stacked on mobile */
.player-actions-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: nowrap;
    margin-top: 16px;
}

.player-actions-row .btn {
    flex: 1;
    min-width: 0;
}

@media (max-width: 568px) {
    .player-actions-row {
        flex-direction: column;
        align-items: stretch;
    }
    .player-actions-row .btn {
        width: 100%;
    }
}
    width: 40px;
    height: 40px;
    border: 3px solid #334155;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #334155;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    animation-play-state: running;
    display: inline-block;
    margin: 20px auto;
}

.error-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--danger);
}

.error-state .icon {
    font-size: 56px;
    margin-bottom: 16px;
    display: block;
}

.error-state .error-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.error-state .error-msg {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Pagination */
.pagination-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pagination-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Search inputs in TV layout - match category item theme */
.tv-sidebar input[type="text"],
.tv-main input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.tv-sidebar input[type="text"]:focus,
.tv-main input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: var(--bg-card);
}

.tv-sidebar input[type="text"]::placeholder,
.tv-main input[type="text"]::placeholder {
    color: #64748b;
}

/* ===== TV LAYOUT (Sidebar + Main) ===== */
.tv-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.tv-sidebar {
    width: 260px;
    flex-shrink: 0;
}

.tv-main {
    flex: 1;
    min-width: 0;
}

.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tv-header h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.badge {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: #334155;
    color: var(--text-muted);
    white-space: nowrap;
}

.badge-loading {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
    animation: pulse 1.5s infinite;
}

.badge-ready {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Sidebar */
.sidebar-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    height: fit-content;
    position: sticky;
    top: 110px;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 12px;
    display: block;
}

.cat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cat-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.cat-item:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.cat-item.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Loading skeletons */
.loading-skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

.channel-skel {
    height: 64px;
    margin-bottom: 8px;
}

.poster-skel {
    width: 100%;
    height: 270px;
    border-radius: 12px;
}

@media (max-width: 900px) {
    .tv-layout {
        flex-direction: column;
    }
    .tv-sidebar {
        width: 100%;
    }
    .sidebar-section {
        position: static;
    }
}

/* General Responsive */
@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        gap: 14px;
        align-items: stretch;
        padding: 16px 20px;
    }
    .topbar-right {
        display: flex;
        justify-content: space-between;
        width: 100%;
    }
    .main-nav {
        padding: 6px 16px;
    }
    .nav-item {
        padding: 8px 12px;
        font-size: 13px;
    }
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
    }
    .poster-thumb {
        height: 210px;
    }
    .container {
        padding: 0 16px;
    }
    .quick-actions {
        grid-template-columns: 1fr;
    }
    .tv-sidebar {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px;
    }
    .login-header h1 {
        font-size: 26px;
    }
    .content-grid {
        grid-template-columns: 1fr;
    }
    .poster-thumb {
        height: 200px;
    }
    .container {
        padding: 0 16px;
    }
    .quick-actions {
        grid-template-columns: 1fr;
    }
}