@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

:root {
    --bg-1: #0b1021;
    --bg-2: #0f172a;
    --card: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --glow: rgba(99, 102, 241, 0.35);
    --accent: #7c3aed;
    --accent-2: #06b6d4;
    --text: #e5e7eb;
    --muted: #a5b4fc;
    --user-bubble: linear-gradient(135deg, #7c3aed, #06b6d4);
    --bot-bubble: rgba(255, 255, 255, 0.08);
}

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

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at 20% 20%, rgba(124,58,237,0.15), transparent 35%),
                radial-gradient(circle at 80% 0%, rgba(6,182,212,0.18), transparent 40%),
                linear-gradient(135deg, var(--bg-1), var(--bg-2));
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    color: var(--text);
}

.container {
    width: 100%;
    max-width: 960px;
    height: 90vh;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255,255,255,0.02);
    backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, rgba(124,58,237,0.35), rgba(6,182,212,0.4));
    color: #fff;
    padding: 22px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 24px;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.header p {
    font-size: 13px;
    color: #e0e7ff;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f87171;
    margin-left: 8px;
    box-shadow: 0 0 0 0 rgba(6,182,212,0.45);
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: #34d399;
    box-shadow: 0 0 0 0 rgba(52,211,153,0.35);
}

@keyframes pulse {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
    100% { transform: scale(0.95); }
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.25s ease-out;
}

.message > div {
    display: inline-flex;
    flex-direction: column;
    width: auto;
}

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

.message.user { justify-content: flex-end; }
.message.assistant { justify-content: flex-start; }

.message-content {
    padding: 10px 12px;
    border-radius: 14px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: inline-block;
    max-width: 500px;
}

.user .message-content {
    background: var(--user-bubble);
    color: #f8fafc;
    border: none;
    border-bottom-right-radius: 6px;
}

.assistant .message-content {
    background: var(--bot-bubble);
    color: var(--text);
    border-bottom-left-radius: 6px;
}

.message-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user .message-label { text-align: right; }

.input-container {
    padding: 18px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    background: rgba(255,255,255,0.02);
}

.input-wrapper { flex: 1; display: flex; gap: 12px; }

input[type="text"] {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    border-radius: 12px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]::placeholder { color: #94a3b8; }

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(6,182,212,0.15);
}

button {
    padding: 14px 18px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #f8fafc;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.15s, box-shadow 0.15s;
    font-size: 14px;
    min-width: 90px;
}

button:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 12px 35px rgba(6,182,212,0.25);
}

button:active { transform: translateY(0); }

.clear-btn {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    border: 1px solid var(--border);
    min-width: 80px;
}

.clear-btn:hover {
    box-shadow: 0 12px 35px rgba(255,255,255,0.08);
}

.loading { display: flex; gap: 6px; align-items: center; }

.loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-2);
    animation: bounce 1.4s infinite;
}

.loading span:nth-child(2) { animation-delay: 0.15s; }
.loading span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.error-message {
    background: rgba(248,113,113,0.12);
    color: #fecdd3;
    padding: 12px 16px;
    border-radius: 12px;
    margin: 10px 0;
    font-size: 13px;
    border: 1px solid rgba(248,113,113,0.25);
}

.info-message {
    background: rgba(59,130,246,0.12);
    color: #bfdbfe;
    padding: 12px 16px;
    border-radius: 12px;
    margin: 10px 0;
    font-size: 13px;
    border: 1px solid rgba(59,130,246,0.25);
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    flex-direction: column;
    color: #cbd5e1;
    gap: 14px;
}

.empty-state-icon { font-size: 48px; }

.empty-state p { font-size: 15px; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.15);
}

::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }