* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, 'Segoe UI', 'Roboto', sans-serif;
}

body {
    background: linear-gradient(135deg, #0b1120 0%, #19223c 50%, #1e2a44 100%);
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 10%, rgba(120, 160, 255, 0.08) 0%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.header {
    background: rgba(20, 30, 55, 0.65);
    backdrop-filter: blur(16px);
    border-radius: 32px;
    padding: 1rem 2rem;
    margin-bottom: 1.8rem;
    border: 1px solid rgba(100, 150, 220, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

h1 {
    font-size: 1.7rem;
    background: linear-gradient(135deg, #eef2ff, #9ac8ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.3px;
}

.auto-logout-tip {
    font-size: 0.75rem;
    color: #9ab3e0;
    background: rgba(0,0,0,0.3);
    padding: 4px 12px;
    border-radius: 30px;
    backdrop-filter: blur(4px);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.2rem;
    margin-bottom: 1.8rem;
}

.stat-card {
    background: rgba(15, 25, 45, 0.7);
    backdrop-filter: blur(12px);
    border-radius: 28px;
    padding: 1.2rem;
    text-align: center;
    border: 1px solid rgba(100,150,220,0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.2);
}
.stat-card .label { font-size: 0.85rem; color: #b8ceff; letter-spacing: 1px; }
.stat-card .number { font-size: 2rem; font-weight: 700; color: #eef3ff; }

.action-glass {
    background: rgba(20, 30, 50, 0.55);
    backdrop-filter: blur(12px);
    border-radius: 48px;
    padding: 0.8rem 1.2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(100,150,220,0.3);
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.action-btn {
    background: rgba(30, 45, 75, 0.8);
    backdrop-filter: blur(4px);
    border: none;
    padding: 10px 20px;
    border-radius: 40px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    color: #eef3ff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.action-btn.primary { background: #2b6ef0; color: white; box-shadow: 0 4px 12px rgba(43,110,240,0.3); }
.action-btn.danger { background: #e5484d; color: white; }
.action-btn.warning { background: #f59e0b; color: white; }
.action-btn.secondary { background: #2c3e66; color: white; }
.action-btn:hover { transform: translateY(-2px); filter: brightness(1.05); box-shadow: 0 8px 18px rgba(0,0,0,0.25); }

.main-layout {
    display: flex;
    gap: 1.8rem;
    flex-wrap: wrap;
}
.sidebar { flex: 1; min-width: 240px; }
.content { flex: 3; min-width: 300px; }

.category-sidebar {
    background: rgba(15, 25, 45, 0.7);
    backdrop-filter: blur(12px);
    border-radius: 28px;
    padding: 1.2rem;
    border: 1px solid rgba(100,150,220,0.35);
}
.category-sidebar h3 {
    color: #eef3ff;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-left: 4px solid #3b82f6;
    padding-left: 12px;
}
.category-list-sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
}
.category-sidebar-item {
    background: rgba(30, 50, 80, 0.5);
    padding: 10px 14px;
    border-radius: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.category-sidebar-item.active {
    background: #2b6ef0;
    border-color: #6ba2ff;
    box-shadow: 0 0 10px rgba(43,110,240,0.5);
}
.category-sidebar-item span {
    color: #eef3ff;
    font-weight: 500;
}
.category-sidebar-item button {
    background: none;
    border: none;
    color: #ffaaae;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 6px;
}
.add-cat-sidebar {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}
.add-cat-sidebar input {
    flex: 1;
    background: rgba(10,20,35,0.8);
    border: 1px solid #4a6a9e;
    border-radius: 40px;
    padding: 8px 14px;
    color: white;
}
.mini { padding: 6px 12px; }

.card {
    background: rgba(15, 25, 45, 0.7);
    backdrop-filter: blur(12px);
    border-radius: 28px;
    padding: 1.2rem;
    border: 1px solid rgba(100,150,220,0.35);
}
.card-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border-left: 5px solid #3b82f6;
    padding-left: 14px;
    color: #eef3ff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.category-badge {
    font-size: 0.8rem;
    background: rgba(0,0,0,0.3);
    padding: 2px 10px;
    border-radius: 30px;
}

.channel-table {
    width: 100%;
    border-collapse: collapse;
}
.channel-table th, .channel-table td {
    padding: 12px 8px;
    border-bottom: 1px solid rgba(71, 105, 155, 0.4);
    background-color: rgba(0, 0, 0, 0.2);
    color: #eef2ff;
    text-align: left;
}
.channel-table th {
    background: rgba(30, 50, 80, 0.6);
    font-weight: 600;
}
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: bold;
}
.status-valid { background: #22c55e; color: #000; }
.status-invalid { background: #ef4444; color: #fff; }
.status-unknown { background: #6b7280; color: #fff; }
.channel-actions button {
    background: rgba(25, 40, 70, 0.8);
    border: 1px solid #4f7bc0;
    padding: 4px 10px;
    font-size: 0.7rem;
    margin: 2px;
    border-radius: 30px;
}
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}
.pagination button {
    background: rgba(30,45,75,0.8);
    border: 1px solid #3b6e9e;
    padding: 6px 14px;
    border-radius: 30px;
    cursor: pointer;
    color: #eef3ff;
}
.pagination button.active {
    background: #2b6ef0;
    color: white;
}

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: rgba(20, 30, 50, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 32px;
    max-width: 600px;
    width: 90%;
    border: 1px solid rgba(100,150,220,0.5);
    animation: modalFade 0.2s ease;
}
@keyframes modalFade {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
.player-modal-content {
    max-width: 800px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(100,150,220,0.3);
}
.modal-title { font-size: 1.3rem; font-weight: 600; color: #eef3ff; }
.close-btn {
    font-size: 1.8rem;
    cursor: pointer;
    color: #aab8e5;
    transition: 0.2s;
}
.close-btn:hover { color: #ff8a8e; }
.modal-body { padding: 1.5rem; max-height: 70vh; overflow-y: auto; }
.log-area {
    background: rgba(0, 0, 0, 0.6);
    color: #b9f6ca;
    padding: 14px;
    border-radius: 1.2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    max-height: 300px;
    overflow-y: auto;
}
.player-box {
    text-align: center;
}
.player-box video {
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.5);
    background: #000;
}
.playing-info {
    margin-top: 12px;
    font-size: 0.9rem;
    color: #cbd5e6;
}
.stop-btn {
    margin-top: 12px;
    background: #2c3e66;
}

.password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(12px);
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
}
.password-box {
    background: rgba(20,30,50,0.98);
    border-radius: 40px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    border: 1px solid rgba(100,150,220,0.6);
}
.password-box input {
    width: 100%;
    padding: 12px;
    background: rgba(10,20,35,0.9);
    border: 1px solid #4a6a9e;
    border-radius: 48px;
    color: white;
    margin-bottom: 15px;
}
.error-msg { color: #ff8a8e; font-size: 0.85rem; margin: 5px 0; }

.progress-bar-container {
    background: rgba(0,0,0,0.5);
    border-radius: 30px;
    height: 20px;
    margin: 15px 0;
    overflow: hidden;
}
.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #2b6ef0, #60a5fa);
    transition: width 0.3s;
}
.progress-stats {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    font-size: 0.9rem;
}
.stat-item {
    background: rgba(0,0,0,0.4);
    padding: 6px 12px;
    border-radius: 20px;
}
.stat-item span:first-child { color: #aac8ff; }
.stat-item span:last-child { font-weight: bold; color: #eef3ff; }
.detect-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}