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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Join Form Styles */
.join-form {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 400px;
    text-align: center;
}

.join-form h1 {
    color: #333;
    margin-bottom: 1.5rem;
}

.join-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    margin-bottom: 1rem;
    transition: border-color 0.3s;
}

.join-form input:focus {
    outline: none;
    border-color: #667eea;
}

.join-form button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.join-form button:hover {
    background: #5a6fd8;
}

/* Chat Interface Styles */
.chat-interface {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-rows: 60px 1fr 80px;
    grid-template-columns: 1fr 250px;
    grid-template-areas: 
        "header header"
        "messages users"
        "input input";
}

.chat-header {
    grid-area: header;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid #eee;
    backdrop-filter: blur(10px);
}

.chat-header h2 {
    color: #333;
}

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

.user-count {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.chat-container {
    grid-area: messages;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.message {
    background: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    animation: messageSlide 0.3s ease-out;
}

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

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.message-username {
    font-weight: bold;
    color: #667eea;
}

.message-time {
    font-size: 12px;
    color: #888;
}

.message-content {
    color: #333;
    word-wrap: break-word;
}

.system-message {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    text-align: center;
    font-style: italic;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.typing-indicator {
    padding: 0.5rem 1rem;
    color: #667eea;
    font-style: italic;
    font-size: 14px;
    min-height: 30px;
}

.message-input-container {
    grid-area: input;
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    border-top: 1px solid #eee;
    backdrop-filter: blur(10px);
}

.message-input-container form {
    display: flex;
    gap: 0.5rem;
}

.message-input-container input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.message-input-container input:focus {
    outline: none;
    border-color: #667eea;
}

.message-input-container button {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s;
}

.message-input-container button:hover {
    background: #5a6fd8;
}

.message-input-container button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.user-list {
    grid-area: users;
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    border-left: 1px solid #eee;
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.user-list h3 {
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.user-list ul {
    list-style: none;
}

.user-list li {
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 5px;
    color: #333;
    transition: background 0.3s;
}

.user-list li:hover {
    background: rgba(102, 126, 234, 0.2);
}

.error-message {
    color: #e74c3c;
    margin-top: 0.5rem;
    font-size: 14px;
    text-align: center;
}

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

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.modal-content button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-interface {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "header"
            "messages"
            "input";
    }
    
    .user-list {
        display: none;
    }
    
    .join-form {
        width: 90%;
        margin: 0 1rem;
    }
}

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

.messages-container::-webkit-scrollbar-track,
.user-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.messages-container::-webkit-scrollbar-thumb,
.user-list::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover,
.user-list::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}
