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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    color: #333;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

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

#currentUserName {
    font-weight: 600;
}

.user-id {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Main Container */
.main-container {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    height: calc(100vh - 100px);
}

/* User Panel */
.user-panel {
    width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.panel-header h3 {
    font-size: 1.2rem;
    color: #333;
}

.btn-add {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-add:hover {
    background: #5568d3;
}

/* Add User Form */
.add-user-form {
    padding: 1rem;
    background: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
}

.add-user-form input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-primary {
    flex: 1;
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    flex: 1;
    background: #95a5a6;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* User List */
.user-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.3s;
    gap: 1rem;
}

.user-item.clickable {
    cursor: pointer;
}

.user-item.clickable:hover {
    background: #f0f0f0;
    transform: translateX(5px);
}

.user-item.online {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.user-item.offline {
    background: #f5f5f5;
    border-left: 4px solid #9e9e9e;
    opacity: 0.7;
}

.user-item.in-call {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
}

.user-id-small {
    font-size: 0.8rem;
    color: #777;
}

.user-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.user-status-indicator.online .status-dot {
    background: #4caf50;
    box-shadow: 0 0 8px #4caf50;
}

.user-status-indicator.offline .status-dot {
    background: #9e9e9e;
}

.user-status-indicator.in-call .status-dot {
    background: #ff9800;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 0.85rem;
    font-weight: 500;
}

.user-status-indicator.online .status-text {
    color: #4caf50;
}

.user-status-indicator.offline .status-text {
    color: #9e9e9e;
}

.user-status-indicator.in-call .status-text {
    color: #ff9800;
}

/* Video Panel */
.video-panel {
    flex: 1;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.welcome-screen h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.welcome-screen p {
    font-size: 1.1rem;
}

/* Video Container */
.video-container {
    flex: 1;
    position: relative;
    background: #000;
}

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

#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remote-user-name {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
}

.local-video-wrapper {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 250px;
    height: 180px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    border: 3px solid white;
}

#localVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.local-label {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Call Controls */
.call-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    transform: scale(1.1);
    background: #e0e0e0;
}

.control-btn.muted {
    background: #ff6b6b;
    color: white;
}

.control-btn.end-call {
    background: #e74c3c;
    color: white;
}

.control-btn.end-call:hover {
    background: #c0392b;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.modal-content p {
    margin-bottom: 1rem;
    color: #555;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-success {
    flex: 1;
    background: #4caf50;
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.btn-success:hover {
    background: #45a049;
}

.btn-danger {
    flex: 1;
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Call Status */
.call-status {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    z-index: 999;
    font-size: 1rem;
}

/* Calling Animation */
.calling-animation {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.5rem 0;
}

.calling-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Permissions Modal */
.permissions-modal {
    max-width: 550px;
    padding: 2rem;
}

.permissions-modal h2 {
    text-align: center;
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.permissions-intro {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.permissions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.permission-item {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

.permission-item.granted {
    background: #e8f5e9;
    border-color: #4caf50;
}

.permission-item.denied {
    background: #ffebee;
    border-color: #f44336;
}

.permission-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.permission-details {
    flex: 1;
}

.permission-details h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.1rem;
}

.permission-details p {
    margin: 0 0 0.5rem 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

.permission-status {
    margin-top: 0.5rem;
}

.status-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.pending {
    background: #fff3e0;
    color: #f57c00;
}

.status-badge.granted {
    background: #4caf50;
    color: white;
}

.status-badge.denied {
    background: #f44336;
    color: white;
}

.permissions-note {
    background: #e3f2fd;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #2196f3;
    font-size: 0.9rem;
    color: #1565c0;
}

.permissions-note strong {
    color: #0d47a1;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.permissions-footer {
    text-align: center;
    margin-top: 1rem;
    color: #999;
}

.permissions-footer small {
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
        height: auto;
    }

    .user-panel {
        width: 100%;
        max-height: 300px;
    }

    .video-panel {
        min-height: 500px;
    }

    .local-video-wrapper {
        width: 150px;
        height: 120px;
    }
}

@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .user-item {
        padding: 0.8rem;
    }

    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .local-video-wrapper {
        width: 120px;
        height: 90px;
        bottom: 0.5rem;
        right: 0.5rem;
    }

    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}
