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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    overflow: hidden;
}

/* Screen Management */
.screen {
    display: none;
    width: 100vw;
    height: 100vh;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #4e54c8, #8f94fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-form {
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 400px;
    max-width: 90%;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.form-row select {
    flex: 1;
}

input, select {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.form-options {
    margin-bottom: 20px;
}

.form-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #4e54c8, #8f94fb);
    color: white;
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 84, 200, 0.4);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.status-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Chat Screen */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-left h1 {
    background: linear-gradient(135deg, #4e54c8, #8f94fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#onlineCount {
    color: #8f94fb;
    font-size: 0.9em;
}

.btn-logout {
    background: rgba(255, 0, 0, 0.3);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255, 0, 0, 0.5);
}

/* Layout */
.chat-layout {
    display: flex;
    height: calc(100vh - 70px);
}

.sidebar {
    width: 300px;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Panels */
.panel {
    margin: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h3 {
    font-size: 1em;
}

.btn-icon {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
}

.panel-content {
    max-height: 300px;
    overflow-y: auto;
}

.rooms-panel {
    flex: 1;
}

.users-panel {
    flex: 1;
}

/* Room and User Lists */
.room-item, .user-item {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.3s ease;
}

.room-item:hover, .user-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.room-item.active {
    background: linear-gradient(135deg, #4e54c8, #8f94fb);
}

.room-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
}

.room-users {
    color: #8f94fb;
}

.user-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    display: inline-block;
    margin-right: 8px;
}

/* Video Container */
.video-container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
}

.local-video-wrapper, .remote-video-wrapper {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

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

.video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-controls {
    display: flex;
    gap: 5px;
}

.btn-control {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-control.active {
    background: #4CAF50;
}

.btn-control.inactive {
    background: #f44336;
}

/* Chat Area */
.chat-area {
    height: 300px;
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.message-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #8f94fb;
    margin-bottom: 5px;
}

.message-text {
    word-wrap: break-word;
}

.message-input-container {
    display: flex;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.input-tools {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-right: 10px;
}

.btn-tool {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
}

.btn-tool:hover {
    background: rgba(255, 255, 255, 0.1);
}

.color-picker {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

#messageInput {
    flex: 1;
    resize: none;
    border: none;
    border-radius: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    margin-right: 10px;
}

.btn-send {
    background: linear-gradient(135deg, #4e54c8, #8f94fb);
    border: none;
    color: white;
    padding: 0 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 84, 200, 0.4);
}

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

.modal-content {
    background: #1a1a2e;
    padding: 30px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 400px;
    max-width: 90%;
}

.modal-content h3 {
    margin-bottom: 20px;
    text-align: center;
}

.modal-content input {
    margin-bottom: 15px;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions button {
    flex: 1;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}