:root {
    --primary: #2d8cff;
    /* Zoom Blue */
    --primary-hover: #1e7bd8;
    --danger: #ff4d4d;
    --dark-bg: #121212;
    --surface-bg: #1e1e1e;
    --control-bg: #242424;
    --sidebar-bg: #1e1e1e;
    --text-main: #e1e1e1;
    --text-muted: #a0a0a0;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Join Screen - Premium Glassmorphism */
#join-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 420px;
    background: rgba(30, 30, 30, 0.8);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 3.5rem 2.5rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.brand {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.5rem;
}

.brand i {
    font-size: 2.8rem;
    color: var(--primary);
    filter: drop-shadow(0 0 10px rgba(45, 140, 255, 0.4));
}

.brand h1 {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -1px;
}

#join-container p {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    font-size: 1rem;
}

.field {
    position: relative;
    margin-bottom: 1.2rem;
}

.field i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.field input {
    width: 100%;
    padding: 15px 15px 15px 50px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.field input:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 4px rgba(45, 140, 255, 0.15);
}

#join-btn {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
}

#join-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(45, 140, 255, 0.3);
}

/* Meeting Layout */
.meeting-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: #000;
}

/* Video Stage */
.video-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #121212;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 15px;
    padding: 20px;
    height: 100%;
    width: 100%;
    overflow-y: auto;
    align-items: center;
    justify-items: center;
}

.video-wrapper {
    position: relative;
    background-color: #1a1a1a;
    border-radius: 16px;
    overflow: hidden;
    width: 100%;
    height: 100%;
    max-height: 480px;
    max-width: 853px;
    /* 16:9 */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.video-wrapper:hover {
    transform: scale(1.01);
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-info {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 6px 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: white;
    z-index: 5;
}

.status-icons i {
    font-size: 0.75rem;
    color: var(--danger);
}

/* Sidebar - Modern Dark Mode */
.sidebar {
    width: 360px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid var(--glass-border);
    z-index: 100;
    padding-bottom: 85px;
    /* Offset for fixed controls bar */
}

.sidebar.collapsed {
    width: 0;
    opacity: 0;
    pointer-events: none;
    border: none;
}

.sidebar-tabs {
    display: flex;
    background: #1a1a1a;
    padding: 8px;
    gap: 4px;
}

.sidebar-tabs button {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s;
    position: relative;
    /* For badge */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sidebar-tabs button.active {
    color: var(--primary);
    background: rgba(45, 140, 255, 0.1);
}

.sidebar-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-panel.active {
    display: flex;
}

/* User List */
#user-list {
    padding: 1rem;
    overflow-y: auto;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    transition: background 0.2s;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.user-info-side {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-item i.fa-user-circle {
    font-size: 1.4rem;
    color: var(--primary);
}

.user-item .me-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Chat Panel */
#chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: #1e1e1e;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
}

.message.self {
    align-self: flex-end;
}

.message .user {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding: 0 4px;
}

.message .text {
    background: #2d2d2d;
    padding: 10px 14px;
    border-radius: 14px;
    border-top-left-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #eee;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.message.self .text {
    background: var(--primary);
    color: white;
    border-radius: 14px;
    border-top-right-radius: 4px;
    border-top-left-radius: 14px;
}

.chat-input-area {
    padding: 1.2rem;
    display: flex;
    gap: 10px;
    background: #181818;
    border-top: 1px solid var(--glass-border);
}

.chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: #121212;
    color: white;
    outline: none;
    transition: all 0.3s;
}

.chat-input-area input:focus {
    border-color: var(--primary);
}

.chat-input-area button {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.chat-input-area button:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

/* Controls Bar - sleek Bottom Bar */
.controls-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 85px;
    background: rgba(22, 22, 22, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    border-top: 1px solid var(--glass-border);
    z-index: 1000;
}

.left-controls .room-tag {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
}

.left-controls i {
    color: #4cd137;
}

.center-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    min-width: 80px;
    padding: 8px;
    border-radius: 12px;
    transition: all 0.3s;
}

/* Unified Media Menu Styles */
.control-group {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 2px;
    position: relative;
    border: 1px solid var(--glass-border);
    transition: all 0.3s;
}

.control-group:hover {
    background: rgba(255, 255, 255, 0.08);
}

.control-group .control-btn {
    min-width: 70px;
    padding: 6px 4px;
    background: none !important;
    /* Avoid double background */
    border: none;
}

.control-group .control-btn:hover {
    box-shadow: none;
}

.menu-trigger {
    background: none;
    border: none;
    color: #888;
    padding: 0 8px;
    height: 40px;
    cursor: pointer;
    border-left: 1px solid var(--glass-border);
    transition: color 0.2s;
}

.menu-trigger:hover {
    color: white;
}

.dropdown-menu {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    min-width: 180px;
    display: none;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1100;
}

.dropdown-menu.show {
    display: flex;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.menu-section-header {
    padding: 8px 16px 4px 16px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-main);
    width: 100%;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

.dropdown-menu button:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-menu button i {
    width: 20px;
    font-size: 1rem;
    color: var(--primary);
}

.dropdown-menu button.hidden {
    display: none;
}

.control-btn i {
    font-size: 1.5rem;
}

.control-btn span {
    font-size: 0.75rem;
    font-weight: 600;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.control-btn.danger {
    color: #ff5e57;
}

.control-btn.danger:hover {
    background: rgba(255, 94, 87, 0.1);
    color: #ff5e57;
}

.control-btn.inactive i {
    color: var(--danger);
}

.right-controls {
    display: flex;
    gap: 12px;
}

.control-btn.secondary {
    position: relative;
    min-width: 60px;
}

.control-btn.secondary.active {
    background: rgba(45, 140, 255, 0.15);
    color: var(--primary);
}

.badge {
    position: absolute;
    top: 4px;
    right: 12px;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--control-bg);
}

.sidebar-tabs .badge {
    position: relative;
    top: auto;
    right: auto;
    display: inline-flex;
    margin-left: 6px;
    border: none;
    background: rgba(45, 140, 255, 0.2);
    color: var(--primary);
    min-width: 20px;
}

.sidebar-tabs button.active .badge {
    background: var(--primary);
    color: white;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .controls-bar {
        padding: 0 10px;
        height: 75px;
    }

    .room-tag {
        display: none;
    }

    .center-controls {
        gap: 8px;
    }

    .control-btn {
        min-width: 60px;
        padding: 4px;
    }

    .control-btn span {
        font-size: 0.65rem;
    }

    .sidebar {
        position: fixed;
        right: 0;
        top: 0;
        height: calc(100% - 75px);
        width: 100%;
        box-shadow: none;
        padding-bottom: 0;
        /* Fix mobile gap */
    }

    .sidebar.collapsed {
        transform: translateX(100%);
    }

    .video-grid {
        grid-template-columns: 1fr;
        padding: 10px;
    }
}

.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#join-container {
    animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}