:root {
    --bg-dark: #0f1015;
    --panel-bg: rgba(255, 255, 255, 0.03);
    --panel-border: rgba(255, 255, 255, 0.08);
    --accent: #4f46e5;
    --accent-hover: #6366f1;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(79, 70, 229, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.08), transparent 25%);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    height: 80px;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--panel-border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    color: var(--accent);
    font-size: 28px;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.room-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--panel-bg);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--panel-border);
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-info:hover {
    background: rgba(255, 255, 255, 0.08);
}

.info-icon {
    font-size: 16px;
    color: var(--text-secondary);
}

.room-id {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.time-display {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Main Content & Video Grid */
.main-content {
    flex: 1;
    display: flex;
    padding: 1.5rem;
    gap: 1.5rem;
    overflow: hidden;
}

.video-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.video-grid {
    display: grid;
    grid-gap: 1.5rem;
    width: 100%;
    height: 100%;
    align-content: center;
    justify-content: center;
    transition: all 0.3s ease;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
    background-color: #000;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--panel-border);
    transform: scale(0.98);
    opacity: 0;
    animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes scaleIn {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
    background-color: #1a1b23;
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--panel-border);
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
    border: none;
    transition: opacity 0.3s ease;
}

.video-container.video-off video {
    opacity: 0;
}

.avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: var(--accent);
    color: white;
    font-size: 36px;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.video-container.video-off .avatar {
    opacity: 1;
}

.video-name {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10;
}

/* Footer Controls */
.controls-footer {
    height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 2rem;
    background: linear-gradient(to top, var(--bg-dark), transparent);
    padding-bottom: 1.5rem;
}

.controls-container {
    display: flex;
    gap: 1rem;
    background: var(--panel-bg);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
}

.control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.control-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.control-btn.disabled {
    background: #333;
    color: var(--danger);
}

.leave-btn {
    background: var(--danger);
    color: white;
}

.leave-btn:hover {
    background: var(--danger-hover);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.control-btn .material-icons {
    font-size: 22px;
}

/* Chat Section */
.chat-section {
    width: 350px;
    background: rgba(15, 16, 21, 0.8);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 1.1rem;
    font-weight: 500;
}

.close-chat {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
}

.close-chat:hover {
    color: var(--text-primary);
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.message.own {
    align-items: flex-end;
}

.message .sender {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.message .text {
    background: var(--panel-bg);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    max-width: 85%;
    line-height: 1.4;
}

.message.own .text {
    background: var(--accent);
    color: white;
}

.chat-input-container {
    padding: 1rem;
    border-top: 1px solid var(--panel-border);
    display: flex;
    gap: 0.5rem;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-full);
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

#chat-input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.send-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-name {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10;
}

/* Waiting Screen Overlay */
.overlay-screen {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 16, 21, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
}
.overlay-content {
    text-align: center;
    background: var(--panel-bg);
    padding: 3rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--panel-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.overlay-icon { 
    font-size: 64px; 
    color: var(--accent); 
    margin-bottom: 1rem; 
    animation: pulse 2s infinite; 
}
@keyframes pulse { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }
.overlay-content h2 { margin-bottom: 0.5rem; }

/* Join Requests Container */
.join-requests-container {
    position: fixed;
    top: 20px; right: 20px;
    display: flex; flex-direction: column; gap: 10px;
    z-index: 9998;
}
.join-request-card {
    background: rgba(15, 16, 21, 0.95);
    border: 1px solid var(--panel-border);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    display: flex; flex-direction: column; gap: 10px;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.join-request-actions {
    display: flex; gap: 10px;
}
.btn-admit { 
    background: var(--accent); color: white; border: none; 
    padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; 
    font-weight: 500; font-family: 'Outfit', sans-serif;
}
.btn-deny { 
    background: transparent; color: var(--danger); border: 1px solid var(--danger); 
    padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; 
    font-weight: 500; font-family: 'Outfit', sans-serif;
}
.btn-admit:hover { background: var(--accent-hover); }
.btn-deny:hover { background: var(--danger-hover); color: white; }
