@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

:root {
    --bg-main: #0a0c10;
    --bg-card: #151921;
    --bg-input: #1c212b;
    --border: #2d343f;
    --text-primary: #f0f2f5;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --success: #10b981;
    --shadow-card: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --radius: 12px;
    
    /* Layout Constants - Increased to 280px for stability */
    --sidebar-width: 280px;
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 80px;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: radial-gradient(circle at 50% 0%, #1a1f2e 0%, #0a0c10 100%);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-layout, .app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    overflow: hidden;
}

.sidebar-header .logo {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-header h1, .sidebar-header span {
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1024px) {
    .sidebar-header h1, .sidebar-header span, .nav-link span {
        display: none;
    }
    .nav-link { justify-content: center; padding: 0.75rem; }
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.nav-link i {
    width: 18px;
    height: 18px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

/* Tab Buttons */
.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    opacity: 0.8;
}

.tab-btn:hover {
    color: var(--text-primary);
    opacity: 1;
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    opacity: 1;
    background: transparent;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 -4px 12px rgba(59, 130, 246, 0.5);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width) !important;
    padding: 2.5rem 3rem;
    width: calc(100% - var(--sidebar-width)) !important;
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
}

/* Force children to respect container width */
.main-content * {
    max-width: 100%;
}

/* Typography */
h1, h2, h3 { font-weight: 700; }
h1 { font-size: 1.875rem; color: #fff; }

/* Buttons - RESTORED */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-primary { background-color: var(--accent); color: white; }
.btn-primary:hover { background-color: var(--accent-hover); }
.btn-secondary { background-color: var(--bg-input); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background-color: var(--border); }
.btn-danger { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background-color: rgba(239, 68, 68, 0.2); }

/* Grid */
.stream-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 1.5rem;
    margin-top: 2rem;
}

.stream-card {
    border-color: rgba(255,255,255,0.05);
    background: linear-gradient(135deg, var(--bg-card), rgba(255,255,255,0.02));
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.stream-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(59, 130, 246, 0.3);
}

/* Badges */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-live, .badge-online { background-color: var(--success); color: white; }
.badge-connecting { background-color: #fbbf24; color: #000; }
.badge-offline { background-color: var(--border); color: var(--text-secondary); }

/* Utilities */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-4 { margin-top: 1rem; }

/* Modals & Forms */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal-card, .modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Form Inputs */
.form-input, .modal-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.form-input:focus { outline: none; border-color: var(--accent); background: #232936; }

/* Analytics Stats Grid */
.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1rem;
}
.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}
.stat-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.stat-value { font-size: 1.25rem; font-weight: 700; color: white; }

/* Live Button */
.live-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 0 12px;
    height: 28px;
    border-radius: 14px;
    font-size: 0.65rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.live-btn.on-air { color: #ef4444 !important; background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.2); }
.live-btn .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.live-btn.on-air .dot { box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); animation: live-pulse-smooth 2s infinite ease-in-out; }

@keyframes live-pulse-smooth { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.3); opacity: 0.6; } }

.video-js { background-color: #000; }
