:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

header {
    padding: 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 10;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
}

.logo span {
    color: var(--text-primary);
}

main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 80px;
    /* Header height */
    position: relative;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

/* Join Screen */
#join-screen {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    transition: opacity 0.3s ease;
}

#join-screen h2 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input[type="text"] {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: var(--primary);
}

select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.5rem;
}

select:focus {
    border-color: var(--primary);
}

select option {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 0.5rem;
}

.btn {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.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: var(--danger-hover);
}

.btn-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    padding: 0;
}

/* Video Grid */
#video-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    width: 100%;
    height: 100%;
    padding: 1rem;
    display: none;
    /* Hidden initially */
}

@media (min-width: 768px) {
    #video-grid.active {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    /* Mirror local video */
}

#remote-video {
    /* Don't mirror remote video usually, but sometimes preferred */
    transform: scaleX(1);
}

.user-label {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    backdrop-filter: blur(4px);
}

/* Controls */
#controls {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    background: var(--glass-bg);
    padding: 1rem;
    border-radius: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 20;
}

#controls.active {
    opacity: 1;
    pointer-events: all;
}

/* Notifications */
.notification {
    position: fixed;
    top: 5rem;
    right: 1.5rem;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    z-index: 50;
}

.notification.show {
    transform: translateX(0);
}

/* Utility */
.hidden {
    display: none !important;
}

.connecting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
    color: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}