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

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #2c3e50 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.chat-box {
    width: 420px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    height: 620px;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
}

.header-info h3 {
    font-size: 15px;
    font-weight: 600;
}

.status {
    font-size: 12px;
    color: #2ecc71;
    opacity: 0.9;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

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

.message {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 14px;
    word-wrap: break-word;
    animation: fadeIn 0.2s ease;
}

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

.user {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    align-self: flex-end;
    border-radius: 16px 16px 4px 16px;
}

.bot {
    background: white;
    color: #2d3436;
    align-self: flex-start;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.typing {
    padding: 8px 20px;
    font-size: 13px;
    color: #999;
    display: none;
    background: #f8f9fa;
}

.typing span {
    animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

.input-area {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid #eee;
    gap: 10px;
    background: white;
    align-items: center;
}

input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid #e0e0e0;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
    background: #f8f9fa;
}

input:focus { border-color: #2c3e50; background: white; }

button {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, opacity 0.15s;
    flex-shrink: 0;
}

button:hover { opacity: 0.85; transform: scale(1.05); }
button:active { transform: scale(0.95); }