:root {
    --bg: #020617;
    --panel: #0f172a;
    --user: linear-gradient(135deg, #6366f1, #4f46e5);
    --bot: #1f2937;
    --text: #e5e7eb;
    --muted: #9ca3af;
}


/* ===== RESET ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Inter", system-ui, sans-serif;
}

html,
body {
    height: 100%;
}

body {
    background: linear-gradient(135deg, #020617, #0f172a);
    color: var(--text);
    overflow: hidden;
}


/* ===== APP ===== */

.chat-app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    /* fixes mobile keyboard issues */
}


/* ===== HEADER ===== */

.chat-header {
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid #1f2937;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.chat-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.chat-header span {
    font-size: 13px;
    color: var(--muted);
}


/* ===== BODY ===== */

.chat-body {
    flex: 1;
    padding: 20px;
    padding-bottom: 96px;
    /* prevents footer overlap */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}


/* ===== MESSAGES ===== */

.bot-msg,
.user-msg {
    width: fit-content;
    max-width: 70%;
    padding: 14px 16px;
    border-radius: 14px;
    line-height: 1.55;
    font-size: 14px;
    animation: fadeIn 0.2s ease;
    word-wrap: break-word;
    white-space: pre-wrap;
}


/* BOT MESSAGE */

.bot-msg {
    background: var(--bot);
    color: var(--text);
    border-top-left-radius: 6px;
    align-self: flex-start;
}


/* USER MESSAGE */

.user-msg {
    background: var(--user);
    color: #ffffff;
    border-top-right-radius: 6px;
    align-self: flex-end;
}


/* ===== FOOTER ===== */

.chat-footer {
    position: sticky;
    bottom: 0;
    display: flex;
    padding: 16px;
    background: rgba(15, 23, 42, 0.98);
    border-top: 1px solid #1f2937;
    gap: 12px;
    backdrop-filter: blur(10px);
    z-index: 10;
    flex-shrink: 0;
}

.chat-footer input {
    flex: 1;
    padding: 14px 16px;
    border-radius: 12px;
    border: none;
    outline: none;
    background: #020617;
    color: var(--text);
    font-size: 14px;
}

.chat-footer input::placeholder {
    color: var(--muted);
}

.chat-footer button {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    font-size: 18px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-footer button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}


/* ===== SCROLLBAR ===== */

.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 10px;
}


/* ===== ANIMATION ===== */

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


/* ===== MOBILE OPTIMIZATION ===== */

@media (max-width: 600px) {
    .chat-body {
        padding: 14px;
        padding-bottom: 110px;
        /* extra safety for keyboard */
    }
    .bot-msg,
    .user-msg {
        max-width: 85%;
        font-size: 13px;
    }
    .chat-header h1 {
        font-size: 16px;
    }
    .chat-footer {
        padding: 12px;
    }
    .chat-footer input {
        padding: 12px 14px;
        font-size: 13px;
    }
    .chat-footer button {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}