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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow-x: hidden;
}

/* LOGIN PAGE STYLES */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-box h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2em;
    font-weight: 300;
}

.login-box p {
    color: #666;
    margin-bottom: 30px;
    font-size: 0.9em;
}

#nicknameForm {
    margin-bottom: 20px;
}

#nickname {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 50px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

#nickname:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#join-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

#join-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.chat-info {
    margin-top: 20px;
    color: #888;
    font-size: 0.8em;
}

/* CHAT PAGE STYLES */
.chat-page {
    display: flex;
    height: 100vh;
    background: #f5f7fa;
}

/* SIDEBAR */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.sidebar-header {
    padding: 20px 15px;
    border-bottom: 1px solid #e1e5e9;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.sidebar-header h3 {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 5px;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    opacity: 0.9;
}

#logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.rooms-section, .users-section {
    padding: 15px 10px;
}

.rooms-section {
    border-bottom: 1px solid #e1e5e9;
}

.rooms-section h4, .users-section h4 {
    font-size: 0.75em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding: 0 5px;
    font-weight: 600;
}

.room-item, .user-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    margin: 2px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85em;
}

.room-item:hover, .user-item:hover {
    background: #f8f9fa;
}

.room-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.room-item span:first-child {
    margin-right: 8px;
    font-size: 0.9em;
}

.users-section {
    flex: 1;
    overflow-y: auto;
}

.user-list {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.user-item {
    padding: 6px 10px;
    font-size: 0.8em;
}

.user-item::before {
    content: "🟢";
    margin-right: 6px;
    font-size: 8px;
}

/* MAIN CHAT AREA */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.chat-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e1e5e9;
    background: white;
}

.chat-header h2 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 5px;
}

.chat-info {
    color: #666;
    font-size: 0.8em;
}

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

.welcome-message {
    text-align: center;
    color: #999;
    margin: 50px 0;
    font-style: italic;
}

.message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    animation: fadeInUp 0.3s ease;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.8em;
}

.message-author {
    font-weight: 600;
    color: #667eea;
}

.message-time {
    color: #999;
}

.message-content {
    font-size: 0.9em;
    line-height: 1.4;
    color: #333;
}

.message-translation {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0f2f5;
    border-radius: 8px;
    font-size: 0.85em;
    color: #666;
    border-left: 3px solid #667eea;
}

.message-input-container {
    padding: 20px 25px;
    border-top: 1px solid #e1e5e9;
    background: white;
}

#messageForm {
    display: flex;
    gap: 10px;
    align-items: center;
}

#messageInput {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e1e5e9;
    border-radius: 25px;
    font-size: 0.9em;
    outline: none;
    transition: all 0.3s ease;
}

#messageInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#send-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.typing-indicator {
    margin-top: 10px;
    font-size: 0.8em;
    color: #999;
    min-height: 20px;
}

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    width: 45px;
    height: 45px;
    background: rgba(102, 126, 234, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

/* MOBILE STYLES */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        transition: left 0.3s ease;
        width: 280px;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .chat-main {
        width: 100%;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .chat-header {
        padding-left: 80px;
    }
    
    .messages-container {
        padding: 15px 20px;
    }
    
    .message-input-container {
        padding: 15px 20px;
    }
    
    .login-box {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 260px;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .chat-header h2 {
        font-size: 1.1em;
    }
    
    .messages-container {
        padding: 10px 15px;
    }
    
    .message {
        padding: 10px 12px;
    }
    
    .message-input-container {
        padding: 10px 15px;
    }
    
    #messageInput {
        padding: 10px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    #send-btn {
        width: 40px;
        height: 40px;
    }
}

/* Scrollbar styles */
.messages-container::-webkit-scrollbar,
.user-list::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track,
.user-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb,
.user-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover,
.user-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}