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

:root {
    --bg-dark: #090d16;
    --card-bg: rgba(18, 24, 38, 0.75);
    --card-border: rgba(0, 229, 255, 0.2);
    --accent: #00e5ff;
    --accent-hover: #33ecff;
    --accent-glow: rgba(0, 229, 255, 0.35);
    --text-main: #f0f6fc;
    --text-muted: #8b949e;
    --live-red: #ff3366;
    --live-glow: rgba(255, 51, 102, 0.5);
    --offline-grey: #6e7681;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: 
        radial-gradient(circle at 15% 20%, rgba(0, 229, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(138, 43, 226, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(9, 13, 22, 1) 0%, #05070b 100%);
    z-index: -1;
}

.hidden {
    display: none !important;
}

/* ================= AUTH MODAL ================= */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 229, 255, 0.1);
    animation: fadeIn 0.4s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.logo-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    padding: 6px 14px;
    border-radius: 50px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 1px;
}

.auth-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #b0c4de 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.input-group {
    position: relative;
    margin-bottom: 12px;
}

.input-group input {
    width: 100%;
    padding: 14px 44px 14px 18px;
    background: rgba(10, 15, 26, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.25s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.toggle-eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}

.error-msg {
    display: none;
    color: #ff4d6d;
    font-size: 13px;
    margin-bottom: 12px;
    text-align: center;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    cursor: pointer;
}

.remember-me input {
    accent-color: var(--accent);
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent) 0%, #00b4d8 100%);
    border: none;
    border-radius: 12px;
    color: #04101e;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(0, 229, 255, 0.3);
    transition: all 0.25s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(0, 229, 255, 0.45);
}

/* ================= APP CONTAINER ================= */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: rgba(9, 13, 22, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--accent);
}

.webrtc-badge {
    background: rgba(0, 229, 255, 0.1);
    color: var(--accent);
    border: 1px solid rgba(0, 229, 255, 0.25);
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
}

.nav-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.status-pill.offline {
    background: rgba(110, 118, 129, 0.15);
    border: 1px solid rgba(110, 118, 129, 0.3);
    color: var(--offline-grey);
}

.status-pill.online {
    background: rgba(255, 51, 102, 0.15);
    border: 1px solid rgba(255, 51, 102, 0.4);
    color: var(--live-red);
    box-shadow: 0 0 15px var(--live-glow);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
}

.status-pill.online .pulse-dot {
    animation: pulse 1.5s infinite;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

/* ================= MAIN CONTENT LAYOUT ================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 24px;
    gap: 16px;
}

@media (min-width: 1200px) {
    .main-content {
        flex-direction: row;
    }
}

.player-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 1280px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Overlays */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(9, 13, 22, 0.92);
    z-index: 10;
    transition: opacity 0.3s ease;
    text-align: center;
    padding: 24px;
}

.radar-anim {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.circle {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0;
    animation: ripple 2.5s infinite cubic-bezier(0.1, 0.2, 0.3, 1);
}

.circle-1 { width: 40px; height: 40px; animation-delay: 0s; }
.circle-2 { width: 70px; height: 70px; animation-delay: 0.8s; }
.circle-3 { width: 100px; height: 100px; animation-delay: 1.6s; }

.radar-icon {
    font-size: 28px;
    z-index: 2;
}

.offline-overlay h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.offline-overlay p {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 420px;
    line-height: 1.5;
}

/* Unmute Button Overlay */
.unmute-overlay {
    background: rgba(0, 0, 0, 0.4);
    z-index: 15;
}

.btn-unmute {
    background: rgba(18, 24, 38, 0.85);
    backdrop-filter: blur(15px);
    border: 1px solid var(--accent);
    color: var(--text-main);
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 229, 255, 0.3);
    animation: float 2s infinite ease-in-out;
}

/* Custom Controls Bar */
.controls-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.video-container:hover .controls-bar {
    opacity: 1;
}

.controls-left, .controls-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.control-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: background 0.2s;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

#volume-slider {
    width: 80px;
    height: 4px;
    accent-color: var(--accent);
    cursor: pointer;
}

.live-tag {
    background: var(--live-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.stats-badge {
    font-size: 12px;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    background: rgba(0, 229, 255, 0.12);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0, 229, 255, 0.2);
}

/* ================= DEBUG LOGS DRAWER ================= */
.logs-drawer {
    width: 100%;
    max-width: 460px;
    background: rgba(14, 20, 32, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    height: 480px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.logs-drawer.closed {
    display: none;
}

.logs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logs-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.log-badge {
    background: rgba(0, 229, 255, 0.2);
    color: var(--accent);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
}

.logs-actions {
    display: flex;
    gap: 6px;
}

.btn-small {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.16);
}

.logs-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.logs-content::-webkit-scrollbar {
    width: 6px;
}

.logs-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1.4;
    word-break: break-all;
}

.log-time {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}

.log-entry.info { color: #80d8ff; background: rgba(0, 229, 255, 0.04); }
.log-entry.warn { color: #ffd166; background: rgba(255, 209, 102, 0.08); }
.log-entry.error { color: #ff5c8a; background: rgba(255, 92, 138, 0.1); }
.log-entry.success { color: #06d6a0; background: rgba(6, 214, 160, 0.08); }

.app-footer {
    text-align: center;
    padding: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.7); }
    70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(255, 51, 102, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 51, 102, 0); }
}

@keyframes ripple {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@media (max-width: 768px) {
    .navbar { padding: 12px 16px; }
    .main-content { padding: 8px; }
    .webrtc-badge { display: none; }
    .logs-drawer { height: 300px; max-width: 100%; }
}
