/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f5f5f5;
}

/* Header */
.app-header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0078d4;
}

.logo i {
    margin-right: 0.5rem;
    font-size: 1.8rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: #0078d4;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: #106ebe;
    transform: scale(1.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f0f0f0;
    border-radius: 20px;
}

.logout-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.logout-btn:hover {
    background: #c82333;
}

/* Main App Content */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Login Section */
.login-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
}

.login-container {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 500px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
    font-size: 1.1rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0078d4;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: #0078d4;
    color: white;
}

.btn-primary:hover {
    background: #106ebe;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 120, 212, 0.3);
}

/* Messaging Interface */
.messaging-interface {
    flex: 1;
    display: flex;
    height: calc(100vh - 80px);
    background: white;
}

.sidebar {
    width: 300px;
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

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

.sidebar-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.refresh-btn {
    background: #0078d4;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: #106ebe;
    transform: rotate(180deg);
}

.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

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

.user-item.active {
    background: #0078d4;
    color: white;
    border-color: #0078d4;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #0078d4;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.2rem;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.user-email {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.user-item.active .user-email {
    color: rgba(255, 255, 255, 0.8);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.leader-badge {
    background: #ffc107;
    color: #333;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.user-item.active .leader-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.online-indicator {
    width: 10px;
    height: 10px;
    background: #28a745;
    border-radius: 50%;
    margin-left: auto;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background: white;
}

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

.chat-user-info .user-avatar {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
}

.user-details h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.user-status {
    color: #666;
    font-size: 0.9rem;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
}

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

.welcome-message i {
    font-size: 4rem;
    color: #0078d4;
    margin-bottom: 1rem;
}

.welcome-message h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.message {
    display: flex;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease;
}

.message.incoming {
    justify-content: flex-start;
}

.message.outgoing {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    position: relative;
}

.message.incoming .message-content {
    background: white;
    border: 1px solid #e0e0e0;
}

.message.outgoing .message-content {
    background: #0078d4;
    color: white;
}

.message-text {
    margin-bottom: 0.25rem;
    word-wrap: break-word;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
}

.message-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.message-input-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.message-input-container input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.message-input-container input:focus {
    border-color: #0078d4;
}

.send-btn {
    background: #0078d4;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    background: #106ebe;
    transform: scale(1.1);
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Notifications */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.notification {
    background: #0078d4;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 300px;
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.warning {
    background: #ffc107;
    color: #333;
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Dark Theme */
.dark-theme {
    background: #1a1a1a;
    color: #e0e0e0;
}

.dark-theme .app-header {
    background: #2a2a2a;
    border-bottom-color: #404040;
}

.dark-theme .sidebar {
    background: #2a2a2a;
    border-right-color: #404040;
}

.dark-theme .user-item {
    background: #3a3a3a;
    border-color: #404040;
    color: #e0e0e0;
}

.dark-theme .user-item:hover {
    background: #404040;
}

.dark-theme .user-item.active {
    background: #0078d4;
    color: white;
}

.dark-theme .chat-header {
    background: #2a2a2a;
    border-bottom-color: #404040;
}

.dark-theme .messages-container {
    background: #1a1a1a;
}

.dark-theme .message.incoming .message-content {
    background: #3a3a3a;
    border-color: #404040;
    color: #e0e0e0;
}

.dark-theme .message-input-area {
    background: #2a2a2a;
    border-top-color: #404040;
}

.dark-theme .message-input-container input {
    background: #3a3a3a;
    border-color: #404040;
    color: #e0e0e0;
}

.dark-theme .message-input-container input:focus {
    border-color: #0078d4;
}

.dark-theme .login-container {
    background: #2a2a2a;
    color: #e0e0e0;
}

.dark-theme .login-header h2 {
    color: #e0e0e0;
}

.dark-theme .form-group input,
.dark-theme .form-group textarea {
    background: #3a3a3a;
    border-color: #404040;
    color: #e0e0e0;
}

.dark-theme .form-group input:focus,
.dark-theme .form-group textarea:focus {
    border-color: #0078d4;
}

/* Responsive Design */
@media (max-width: 768px) {
    .messaging-interface {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .users-list {
        display: flex;
        overflow-x: auto;
        padding: 1rem;
    }
    
    .user-item {
        min-width: 200px;
        margin-right: 0.5rem;
        margin-bottom: 0;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    .login-container {
        padding: 2rem;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 1.5rem;
    }
    
    .login-header h2 {
        font-size: 1.5rem;
    }
    
    .message-content {
        max-width: 85%;
    }
}