:root {
    --bg-dark: #0f0f14;
    --bg-card: #1a1a24;
    --bg-sidebar: #15151e;
    --primary: #7c5cff;
    --primary-hover: #6a4de8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-main: #ffffff;
    --text-sec: #9ca3af;
    --border: #2a2a38;
    --radius: 10px;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
}

/* === AUTH PAGES === */
.auth-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0f0f14 0%, #1a1a2e 100%);
    padding: 20px;
}

.auth-container { width: 100%; max-width: 420px; }

.auth-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--primary);
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 400;
    color: var(--text-sec);
}

.auth-links {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.auth-links a { color: var(--primary); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

/* === FORMS === */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-sec);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* === BUTTONS === */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-block;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--border); color: var(--text-main); }
.btn-block { width: 100%; }

/* === ALERTS === */
.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.alert-danger { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid var(--danger); }
.alert-success { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid var(--success); }

/* === APP LAYOUT === */
.app-container { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.sidebar-header h2 { color: var(--primary); margin-bottom: 5px; }
.user-email { font-size: 0.85rem; color: var(--text-sec); }

.sidebar nav { display: flex; flex-direction: column; }

.sidebar nav a {
    padding: 12px 20px;
    color: var(--text-sec);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.sidebar nav a:hover { background: rgba(124,92,255,0.1); color: var(--text-main); }
.sidebar nav a.active {
    background: rgba(124,92,255,0.15);
    color: var(--primary);
    border-left-color: var(--primary);
}

.main-content { flex: 1; padding: 30px; overflow-x: hidden; }

.section { display: none; }
.section.active { display: block; animation: fadeIn 0.3s; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* === STATS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border);
}

.stat-icon { font-size: 2.5rem; }
.stat-info h3 { font-size: 2rem; color: var(--primary); }
.stat-info p { color: var(--text-sec); font-size: 0.9rem; }

/* === PLAYER === */
.player-section {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.video-wrapper {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.video-wrapper video {
    width: 100%;
    max-height: 500px;
    display: block;
}

.custom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-sidebar);
    flex-wrap: wrap;
}

.custom-controls button {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.custom-controls button:hover { background: rgba(255,255,255,0.1); }

.custom-controls input[type="range"] {
    flex: 1;
    min-width: 100px;
    accent-color: var(--primary);
}

#timeDisplay { color: var(--text-sec); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.player-info h3 { margin-bottom: 5px; }
.player-info p { color: var(--text-sec); font-size: 0.9rem; }

/* === GRID CARDS === */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover { transform: translateY(-2px); border-color: var(--primary); }

.card h3 { margin-bottom: 10px; font-size: 1.1rem; }
.card p { color: var(--text-sec); font-size: 0.9rem; margin-bottom: 5px; }

.card-actions {
    margin-top: 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.card-actions .btn { padding: 6px 12px; font-size: 0.85rem; }

/* === SEARCH === */
.search-input {
    width: 100%;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    margin-bottom: 10px;
}

/* === PROGRESS BAR === */
.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
}

/* === MODAL === */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-sec);
}

/* === BROADCAST INFO === */
.broadcast-url {
    background: var(--bg-dark);
    padding: 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.85rem;
    word-break: break-all;
    margin: 10px 0;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-playing { background: rgba(16,185,129,0.2); color: var(--success); }
.badge-paused { background: rgba(245,158,11,0.2); color: var(--warning); }
.badge-stopped { background: rgba(156,163,175,0.2); color: var(--text-sec); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 10px 0;
    }
    
    .sidebar-header { display: none; }
    
    .sidebar nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 10px;
    }
    
    .sidebar nav a {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 10px 15px;
    }
    
    .sidebar nav a.active {
        border-left: none;
        border-bottom-color: var(--primary);
    }
    
    .main-content { padding: 15px; }
    
    .stats-grid { grid-template-columns: 1fr; }
    .grid-cards { grid-template-columns: 1fr; }
    
    .custom-controls { gap: 5px; }
    .custom-controls button { font-size: 0.9rem; padding: 4px 6px; }
}

@media (max-width: 480px) {
    .auth-card { padding: 25px 20px; }
    .section-header { flex-direction: column; align-items: stretch; }
    .section-header .btn { width: 100%; }
}