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

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

.chat-wrapper {
    width: 90%;
    max-width: 800px;
    height: 90vh;
    background: white;
    border-radius: 15px;
    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;
    text-align: center;
}

.chat-header h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.username-container {
    display: flex;
    justify-content: center;
    gap: 10px;
}

#username-input {
    padding: 8px 12px;
    border: none;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    width: 200px;
}

#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

.message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease-in;
}

.message-content {
    display: inline-block;
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.message-content.own {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    float: right;
}

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

.message-content.own .message-header {
    color: rgba(255,255,255,0.9);
}

.message-content:not(.own) .message-header {
    color: #666;
}

.time {
    margin-left: 10px;
    opacity: 0.7;
}

.message-text {
    word-wrap: break-word;
    line-height: 1.4;
}

.chat-footer {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

#chat-form {
    display: flex;
    gap: 10px;
}

#message-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    resize: none;
    min-height: 45px;
    max-height: 120px;
    font-family: inherit;
}

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

.send-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}

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

/* Scrollbar Styling */
#chat-container::-webkit-scrollbar {
    width: 6px;
}

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

#chat-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

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

@media (max-width: 600px) {
    .chat-wrapper {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .message-content {
        max-width: 85%;
    }
}