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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #34495e;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

#status {
    font-size: 0.9rem;
    padding: 0.25rem 0.75rem;
    background-color: #34495e;
    border-radius: 12px;
    transition: background-color 0.3s ease;
}

#status.connected {
    background-color: #27ae60;
}

#status.disconnected {
    background-color: #e74c3c;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 1rem;
    background-color: #fafafa;
}

#messages {
    flex: 1;
    overflow-y: auto;
}

.message {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background-color: white;
    border-left: 3px solid #3498db;
    animation: slideIn 0.2s ease-out;
}

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

.message.system {
    background-color: #ecf0f1;
    border-left-color: #95a5a6;
    font-style: italic;
    color: #7f8c8d;
    text-align: center;
}

.message.own {
    background-color: #e8f4f8;
    border-left-color: #2ecc71;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
}

.message-nickname {
    font-weight: 600;
    color: #2c3e50;
}

.message-time {
    color: #95a5a6;
}

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


.form-container {
    padding: 1rem;
    background-color: white;
    border-top: 1px solid #ecf0f1;
    display: flex;
    gap: 0.5rem;
}

.form-container.hidden {
    display: none;
}

input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

button {
    padding: 0.75rem 1.5rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button:hover {
    background-color: #2980b9;
}

button:active {
    background-color: #21618c;
}

button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.error-message {
    background-color: #e74c3c;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin: 0.5rem 0;
    animation: slideIn 0.2s ease-out;
}

@media (max-width: 600px) {
    #app {
        max-width: 100%;
        box-shadow: none;
    }
    
    header {
        padding: 0.75rem;
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    #status {
        font-size: 0.8rem;
        padding: 0.2rem 0.5rem;
    }
    
    .form-container {
        padding: 0.75rem;
    }
    
    button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .message {
        margin-bottom: 0.5rem;
        padding: 0.4rem 0.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
