/* =========================
   DESIGN TOKENS
========================= */
:root {
    --primary-color: #233469;
    --accent-color: #80222F;

    --bg-color: #0e1120;
    --chat-bg: #161a2f;
    --header-bg: #1b2140;

    --text-primary: #f1f3f9;
    --text-secondary: #a0a7c3;

    --incoming-msg-bg: #242a4a;
    --outgoing-msg-bg: linear-gradient(135deg, #233469, #2f4496);

    --incoming-msg-text: #f1f3f9;
    --outgoing-msg-text: #ffffff;

    --input-bg: #1f2545;
    --border-color: rgba(255,255,255,0.08);

    --shadow-sm: 0 2px 6px rgba(0,0,0,0.25);
    --shadow-md: 0 10px 30px rgba(0,0,0,0.45);
}

/* =========================
   RESET
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================
   BODY
========================= */
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: radial-gradient(circle at top, #1a1f3d, #0e1120);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
}

/* =========================
   CHAT CONTAINER
========================= */
.chat-container {
    width: 100%;
    height: 100%;
    background: var(--chat-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 768px) {
    .chat-container {
        max-width: 900px;
        height: 90vh;
        border-radius: 18px;
        box-shadow: var(--shadow-md);
        border: 1px solid var(--border-color);
    }
}

/* =========================
   HEADER
========================= */
.chat-header {
    background: var(--header-bg);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    height: 42px;
    display: flex;
    align-items: center;
}

.logo-img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.header-info h1 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* =========================
   MESSAGES AREA
========================= */
.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--chat-bg);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* =========================
   MESSAGE BUBBLES
========================= */
.message {
    max-width: 72%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.55;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.25s ease;
}

@media (min-width: 768px) {
    .message {
        max-width: 65%;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-message {
    background: var(--incoming-msg-bg);
    color: var(--incoming-msg-text);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
}

.user-message {
    background: var(--outgoing-msg-bg);
    color: var(--outgoing-msg-text);
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

/* =========================
   MESSAGE TIME
========================= */
.message-time {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    opacity: 0.6;
    text-align: right;
}

/* =========================
   INPUT AREA
========================= */
.chat-input-area {
    background: var(--header-bg);
    padding: 18px 20px;
    border-top: 1px solid var(--border-color);
}

#chatForm {
    display: flex;
    align-items: center;
    gap: 12px;
}

#userInput {
    flex: 1;
    background: var(--input-bg);
    border: none;
    border-radius: 28px;
    padding: 14px 20px;
    color: var(--text-primary);
    font-size: 15px;
}

#userInput::placeholder {
    color: var(--text-secondary);
}

#userInput:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(35,52,105,0.35);
}

/* =========================
   SEND BUTTON
========================= */
#sendBtn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #80222F, #a13345);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 16px rgba(128,34,47,0.4);
    transition: all 0.2s ease;
}

#sendBtn:hover {
    transform: translateY(-1px);
}

#sendBtn:active {
    transform: scale(0.95);
}

#sendBtn:disabled {
    background: #444;
    box-shadow: none;
    cursor: not-allowed;
}

/* =========================
   TYPING LOADER
========================= */
.typing-loader {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: var(--incoming-msg-bg);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* =========================
   SCROLLBAR
========================= */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}
