/* ==========================================================================
   CHATBOT PAGE SPECIFIC STYLES
   ========================================================================== */

html,
body.chat-body-page {
    height: 100%;
    height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #121514;
    color: var(--gray-50, #f9fafb);
}

.chat-app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 85px 16px 16px 16px;
    /* Top padding accommodates fixed navbar */
    box-sizing: border-box;
    min-height: 0;
    /* Critical for flex child scrolling */
}

.chat-app-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-50, #f9fafb);
    margin: 0 0 12px 0;
    text-align: center;
    flex-shrink: 0;
}

/* Scrollable message container */
.chat-messages {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    margin-bottom: 12px;
    padding-right: 6px;
    scroll-behavior: smooth;
    min-height: 0;
    /* Ensures container shrinks on mobile screens */
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.message--bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--gray-50, #f9fafb);
    border-bottom-left-radius: 4px;
}

.message--user {
    align-self: flex-end;
    background: var(--mint-300, #4ade80);
    color: var(--gray-900, #0f172a);
    font-weight: 500;
    border-bottom-right-radius: 4px;
}

/* Markdown formatting */
.message p {
    margin: 4px 0;
}

.message p:first-child {
    margin-top: 0;
}

.message p:last-child {
    margin-bottom: 0;
}

.message ul,
.message ol {
    margin: 8px 0;
    padding-left: 18px;
}

.message li {
    margin-bottom: 4px;
}

.message strong {
    color: #ffffff;
    font-weight: 600;
}

.message code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

/* INPUT AREA - LOCKED AT BOTTOM */
.chat-input-area {
    flex-shrink: 0;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(26, 29, 28, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    padding: 6px 8px 6px 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
    margin-bottom: env(safe-area-inset-bottom, 0px);
    /* Respects iPhone/Android nav bars */
}

.chat-input-field {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--gray-50, #f9fafb);
    font-size: 14px;
    font-family: inherit;
}

.chat-input-field::placeholder {
    color: var(--gray-500, #6b7280);
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--mint-300, #4ade80);
    color: var(--gray-900, #0f172a);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}