:root {
    /* Modern Color Palette */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-glass: rgba(30, 41, 59, 0.7);

    --accent-primary: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.5);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --border-color: rgba(148, 163, 184, 0.1);
    --glass-border: rgba(255, 255, 255, 0.05);

    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(239, 68, 68, 0.1) 0px, transparent 50%);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Form Elements */
input,
select,
textarea {
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

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

.btn-success:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

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

.btn-danger:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--text-secondary);
    color: var(--bg-primary);
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.login-container {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    text-align: center;
}

.login-container h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-primary), #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-container p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Main Application Container */
.container {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    transition: transform 0.3s ease;
    z-index: 100;
    overflow-y: auto;
}

.room-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.room-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.join-form {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.join-form input,
.join-form select {
    margin-bottom: 0;
}

.password-input,
.password-section {
    display: none;
}

.voice-controls {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.voice-controls h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.voice-controls p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.room-id-display {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--success);
}

.room-id-text {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.875rem;
    word-break: break-all;
    margin-top: 8px;
}

.create-room-btn {
    display: none;
}

.users-list {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid var(--border-color);
}

/* Sidebar Footer (Settings/Logout) */
.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.sidebar-footer .btn {
    width: 100%;
    justify-content: center;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    transition: var(--transition);
}

.user-item:hover {
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    margin-right: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Status Indicators */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 8px;
    box-shadow: 0 0 8px currentColor;
}

.status-online {
    color: var(--success);
    background: currentColor;
}

.status-speaking {
    color: var(--warning);
    background: currentColor;
    animation: pulse 1.5s infinite;
}

.status-muted {
    color: var(--danger);
    background: currentColor;
}

.status-in-call {
    color: var(--accent-primary);
    background: currentColor;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
    position: relative;
    overflow-y: auto;
}

.main-content.active {
    display: flex;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.header-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-info small {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.controls {
    display: flex;
    gap: 12px;
}

/* Content Area (Video + Chat) */
.content-area {
    display: flex;
    gap: 24px;
    flex: 1;
    min-height: 0;
}

/* Video Section */
.video-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    height: 100%;
    overflow-y: auto;
}

.video-container {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    aspect-ratio: 16/9;
    box-shadow: var(--shadow-md);
}

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

.video-label {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    backdrop-filter: blur(4px);
}

/* Chat Section */
.chat-section {
    width: 350px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.1);
}

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

.message {
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    max-width: 90%;
    align-self: flex-start;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-author {
    font-size: 0.75rem;
    color: var(--accent-primary);
    margin-bottom: 4px;
    font-weight: 600;
}

.message-content {
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-word;
}

.system-message {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    align-self: center;
    text-align: center;
}

.system-message .message-author {
    color: var(--success);
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.1);
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.chat-send-btn {
    padding: 0 20px;
    border-radius: var(--radius-sm);
    background: var(--accent-primary);
    color: white;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.chat-send-btn:hover {
    background: var(--accent-hover);
}

/* Settings Modal */
.settings-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.settings-content {
    background: var(--bg-secondary);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.settings-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
}

.setting-group small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Range Slider Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    padding: 0;
    border: none;
    width: 100%;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
}

/* Connection Status */
.connection-status {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 100;
    transition: var(--transition);
}

.status-connected {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-connecting {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Mobile Nav - Hidden by default */
.mobile-nav {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1500;
        transition: transform 0.3s ease;
    }

    .sidebar.hidden {
        transform: translateX(-100%);
    }

    .main-content {
        padding: 16px;
        width: 100%;
    }

    .header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .controls {
        justify-content: space-between;
    }

    .content-area {
        flex-direction: column;
    }

    .chat-section {
        width: 100%;
    }

    .mobile-nav {
        display: block;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 2000;
    }

    .mobile-nav-btn {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--accent-primary);
        color: white;
        border: none;
        box-shadow: var(--shadow-lg);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        cursor: pointer;
        transition: var(--transition);
    }

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