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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    max-height: 700px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.name-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.name-input-container label {
    font-size: 13px;
    opacity: 0.9;
    white-space: nowrap;
}

#userName {
    padding: 6px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    max-width: 150px;
}

#userName::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#userName:focus {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.3);
}

#saveNameButton {
    padding: 6px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    line-height: 1;
    min-width: 32px;
}

#saveNameButton:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

#saveNameButton:active {
    transform: scale(0.95);
}

.name-saved-feedback {
    font-size: 12px;
    color: #4ade80;
    font-weight: 600;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.name-saved-feedback.show {
    opacity: 1;
    transform: translateX(0);
}

.room-id {
    font-size: 12px;
    opacity: 0.9;
    font-family: monospace;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
}

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

.messages-container::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

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

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

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

.message-name {
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
}

.message-time {
    font-size: 11px;
    color: #666;
    font-family: monospace;
}

.message-text {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
    word-wrap: break-word;
}

.input-container {
    display: flex;
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    gap: 12px;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

#messageInput:focus {
    border-color: #667eea;
}

#sendButton {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

#sendButton:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#sendButton:active {
    transform: translateY(0);
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .chat-container {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .chat-header {
        padding: 15px;
    }
    
    .chat-header h1 {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .header-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .name-input-container {
        width: 100%;
        flex-wrap: wrap;
    }
    
    #userName {
        flex: 1;
        max-width: none;
        min-width: 120px;
    }
    
    #saveNameButton {
        flex-shrink: 0;
    }
    
    .room-id {
        font-size: 10px;
        padding: 4px 8px;
    }
    
    .messages-container {
        padding: 15px;
    }
    
    .input-container {
        padding: 15px;
    }
}

