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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #000;
    min-height: 100vh;
    overflow: hidden;
}

/* Setup Overlay */
.setup-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.setup-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 48px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.setup-card h1 {
    color: #1f2937;
    font-size: 2rem;
    margin-bottom: 32px;
    font-weight: 700;
}

.setup-card input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    text-align: center;
    background: white;
    transition: all 0.2s ease;
    margin-bottom: 24px;
}

.setup-card input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    background: #667eea;
    color: white;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* Meeting Container */
.meeting-container {
    position: fixed;
    inset: 0;
    background: #000;
}

/* Remote Videos - Focus on participants */
.remote-videos {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    gap: 8px;
    padding: 8px;
    padding-bottom: 100px;
    align-items: stretch;
    justify-items: stretch;
}

/* 2 participants - side by side */
.remote-videos:has(.video-container:nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr);
}

/* 3-4 participants - 2x2 grid */
.remote-videos:has(.video-container:nth-child(3):last-child),
.remote-videos:has(.video-container:nth-child(4):last-child) {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* 5+ participants - auto grid */
.remote-videos:has(.video-container:nth-child(n+5)) {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.video-container {
    position: relative;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    min-height: 200px;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-label {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

/* Self-view - Full screen when waiting, PiP when others join */
.self-view {
    position: fixed;
    inset: 0;
    z-index: 50;
    transition: all 0.4s ease;
}

.self-view.pip {
    inset: auto;
    bottom: 100px;
    right: 20px;
    width: 180px;
    height: 135px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.self-view.pip:hover {
    transform: scale(1.05);
}

.self-view video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.self-view .video-label {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.self-view.pip .video-label {
    bottom: 6px;
    left: 6px;
    font-size: 11px;
    padding: 4px 8px;
}

/* Apple-inspired Controls Bar */
.controls-bar {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    gap: 12px;
    z-index: 200;
}

.control-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.control-btn svg {
    width: 22px;
    height: 22px;
}

.control-btn:hover:not(:disabled) {
    transform: scale(1.1);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.control-btn.active {
    background: #30d158;
}

.control-btn.inactive {
    background: rgba(255, 255, 255, 0.2);
}

.control-btn.inactive svg {
    opacity: 0.5;
}

.disconnect-btn {
    background: #ff453a;
}

.disconnect-btn:hover:not(:disabled) {
    background: #ff6961;
}

/* Status Toast */
.status-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(20px);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.status-toast.show {
    opacity: 1;
}


/* Mobile Responsive */
@media (max-width: 768px) {
    .self-view.pip {
        width: 120px;
        height: 90px;
        bottom: 90px;
        right: 12px;
    }
    
    .controls-bar {
        bottom: 16px;
        right: 16px;
        gap: 8px;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
    }
    
    .control-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .remote-videos:has(.video-container:nth-child(n+5)) {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}
