/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background: #0f0f0f; color: #fff; overflow: hidden; }

/* Login */
.login-body { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100vh; 
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); 
}
.login-box { 
    background: rgba(255,255,255,0.05); 
    backdrop-filter: blur(10px);
    padding: 40px; 
    border-radius: 15px; 
    width: 350px; 
    display: flex; 
    flex-direction: column; 
    gap: 15px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.login-box h2 { text-align: center; color: #fff; margin-bottom: 10px; }
.login-box input, .login-box select, .login-box button { 
    padding: 12px; 
    border-radius: 8px; 
    border: 1px solid rgba(255,255,255,0.1); 
    background: rgba(255,255,255,0.05);
    color: #fff;
}
.login-box button { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    color: white; 
    cursor: pointer; 
    font-weight: bold;
    border: none;
    transition: transform 0.2s;
}
.login-box button:hover { transform: translateY(-2px); }

/* Header */
header { 
    background: rgba(20,20,30,0.98); 
    padding: 0 20px; 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    border-bottom: 1px solid rgba(255,255,255,0.1);
    height: 55px;
    flex-shrink: 0;
}
#burger-btn { background: none; border: none; color: white; font-size: 22px; cursor: pointer; padding: 5px; }
.title { font-weight: bold; font-size: 17px; color: #fff; }
.status-badge { 
    background: #6c757d; 
    padding: 5px 12px; 
    border-radius: 20px; 
    font-size: 11px; 
    font-weight: bold;
    margin-left: auto;
}
.status-badge.active { background: #28a745; }
.status-badge.live { background: #dc3545; animation: pulse 2s infinite; }
.user-info { margin-left: 10px; font-size: 13px; }
.user-info a { color: #dc3545; text-decoration: none; font-weight: bold; margin-left: 8px; }

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

/* Layout Container */
.app-container { 
    display: flex; 
    height: calc(100vh - 55px); 
    position: relative;
    overflow: hidden;
}

/* Sidebar */
aside { 
    position: fixed; 
    left: 0; 
    top: 55px; 
    bottom: 0; 
    width: 300px; 
    background: rgba(20,20,30,0.98); 
    border-right: 1px solid rgba(255,255,255,0.1); 
    transform: translateX(-100%); 
    transition: transform 0.3s ease; 
    z-index: 100; 
    display: flex; 
    flex-direction: column;
    box-shadow: 5px 0 15px rgba(0,0,0,0.3);
}
aside.open { transform: translateX(0); }
.sidebar-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 12px 15px; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
}
.sidebar-header h3 { font-size: 14px; color: #fff; }
#close-sidebar { background: none; border: none; color: white; cursor: pointer; font-size: 18px; }

.control-group { padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.control-group label { display: block; margin-bottom: 6px; font-size: 12px; color: #aaa; }
.control-group input, .control-group button { 
    width: 100%; 
    padding: 8px; 
    border-radius: 6px; 
    border: 1px solid rgba(255,255,255,0.1); 
    background: rgba(255,255,255,0.05); 
    color: white;
    margin-bottom: 8px;
    font-size: 13px;
}
.control-group button { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    border: none;
    cursor: pointer;
    font-weight: bold;
}

.log-section { flex: 1; display: flex; flex-direction: column; padding: 12px; overflow: hidden; }
.log-section h3 { font-size: 12px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
#copy-log-btn { 
    font-size: 10px; 
    padding: 3px 6px; 
    background: rgba(255,255,255,0.1); 
    border: none; 
    border-radius: 4px; 
    color: #fff;
    cursor: pointer;
}
#log-container { 
    flex: 1; 
    overflow-y: auto; 
    font-size: 11px; 
    font-family: 'Courier New', monospace; 
    display: flex; 
    flex-direction: column; 
    gap: 5px; 
}
.log-item { 
    padding: 5px 8px; 
    border-left: 3px solid #555; 
    background: rgba(255,255,255,0.02);
    border-radius: 0 4px 4px 0;
}
.log-item.success { border-color: #28a745; background: rgba(40,167,69,0.1); }
.log-item.warning { border-color: #ffc107; background: rgba(255,193,7,0.1); }
.log-item.error { border-color: #dc3545; background: rgba(220,53,69,0.1); }

/* Main Content */
main { 
    flex: 1; 
    padding: 15px; 
    display: flex; 
    flex-direction: column;
    margin-left: 0;
    transition: margin-left 0.3s ease;
    overflow: hidden;
}
main.with-sidebar { margin-left: 300px; }

/* Grid Container - FIXED */
.grid-container { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    grid-template-rows: 1fr 1fr; 
    gap: 12px; 
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.slot { 
    background: #000; 
    border: 2px solid rgba(255,255,255,0.1); 
    border-radius: 10px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    position: relative; 
    overflow: hidden;
    min-height: 0;
}
.slot video { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}
.placeholder { color: #555; font-size: 13px; }

.slot-overlay {
    position: absolute; 
    bottom: 8px; 
    left: 8px; 
    background: rgba(0,0,0,0.85); 
    color: white; 
    padding: 5px 10px; 
    border-radius: 5px; 
    font-size: 11px; 
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
}
.live-badge {
    width: 7px;
    height: 7px;
    background: #dc3545;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.pool-info { 
    text-align: center; 
    padding: 10px; 
    color: #888; 
    font-size: 12px; 
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
    margin-top: 12px;
    flex-shrink: 0;
}

/* Toast */
#toast-container { 
    position: fixed; 
    bottom: 20px; 
    right: 20px; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    z-index: 200; 
}
.toast { 
    background: rgba(30,30,40,0.95); 
    backdrop-filter: blur(10px);
    padding: 12px 18px; 
    border-radius: 8px; 
    border-left: 4px solid #667eea;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
    font-size: 13px;
}
@keyframes slideIn { 
    from { transform: translateX(100%); opacity: 0; } 
    to { transform: translateX(0); opacity: 1; } 
}

/* Streamer Page - Professional Layout */
.streamer-main {
    display: flex;
    flex-direction: column;
    padding: 0;
}
.video-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    padding: 15px;
    min-height: 0;
}
#local-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}
.streamer-footer {
    background: rgba(20,20,30,0.98);
    padding: 10px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    height: 50px;
}
.footer-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.footer-info span {
    font-size: 12px;
    color: #aaa;
}
.footer-info strong {
    font-size: 13px;
    color: #fff;
}
#status-text {
    font-size: 12px;
    color: #ffc107;
    font-weight: 500;
}
.disconnect-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    transition: background 0.2s;
}
.disconnect-btn:hover {
    background: #c82333;
}

/* Responsive */
@media (max-width: 1024px) {
    aside { width: 280px; }
    main.with-sidebar { margin-left: 280px; }
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, auto);
    }
    .slot { aspect-ratio: 16/9; }
    aside { width: 100%; }
    main.with-sidebar { margin-left: 0; }
    .streamer-footer {
        flex-direction: column;
        height: auto;
        padding: 10px;
        gap: 8px;
    }
}