/* Ask ARIEL chat UI. Ported from the standalone chatbot/index.html. */
:root {
    --bg: #f7f7f5;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e7e6e2;
    --accent: #d97a3f;
    --navy: #101a2c;
    --text: #17181c;
    --muted: #7c7c76;
    --border: #e5e4df;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
    display: flex;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.serif { font-family: Georgia, "Times New Roman", serif; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: 270px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 18px 14px;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.sidebar__logo-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.sidebar__top { padding: 0 14px 10px; }

.new-chat {
    width: 100%;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13.5px;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}
.new-chat:hover { background: #fafaf9; border-color: #d8d7d1; }

.chat-list__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding: 10px 20px 4px;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-item {
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    color: #45463f;
    transition: background 0.15s;
}
.chat-item:hover { background: #f5f4f1; }
.chat-item--active { background: #eef1f6; color: var(--text); font-weight: 500; }

.chat-item__title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.chat-item__del {
    opacity: 0;
    border: none;
    background: transparent;
    color: #a3a29b;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    flex-shrink: 0;
}
.chat-item:hover .chat-item__del { opacity: 1; }
.chat-item__del:hover { color: #d9534f; }

.sidebar__footer {
    padding: 12px;
    border-top: 1px solid var(--sidebar-border);
}

.hotel-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12.5px;
    color: #3b3c37;
    background: #fff;
}

.hotel-chip__avatar {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--navy);
    flex-shrink: 0;
}

.hotel-chip__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Main chat ---------- */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat__body {
    flex: 1;
    padding: 28px 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.msg { display: flex; max-width: 75%; animation: fadeIn 0.25s ease; }
.msg--bot { align-self: flex-start; }
.msg--user { align-self: flex-end; justify-content: flex-end; }

.msg__bubble {
    padding: 11px 16px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.msg--user .msg__bubble {
    background: var(--navy);
    color: #fff;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}

.msg--bot .msg__bubble {
    background: #fff;
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

/* Markdown formatting inside bot bubbles */
.msg--bot .msg__bubble > *:first-child { margin-top: 0; }
.msg--bot .msg__bubble > *:last-child { margin-bottom: 0; }
.msg--bot .msg__bubble p { margin: 8px 0; }
.msg--bot .msg__bubble ul,
.msg--bot .msg__bubble ol { margin: 8px 0; padding-left: 22px; }
.msg--bot .msg__bubble li { margin: 3px 0; }
.msg--bot .msg__bubble h1,
.msg--bot .msg__bubble h2,
.msg--bot .msg__bubble h3 { margin: 12px 0 6px; font-size: 15.5px; }

.msg--bot .msg__bubble code {
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 13px;
    font-family: "Consolas", "Courier New", monospace;
}

.msg--bot .msg__bubble pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}
.msg--bot .msg__bubble pre code { background: none; padding: 0; color: inherit; }

.msg--bot .msg__bubble table {
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 13.5px;
}

.msg--bot .msg__bubble th,
.msg--bot .msg__bubble td {
    border: 1px solid var(--border);
    padding: 5px 9px;
    text-align: left;
}

.msg--bot .msg__bubble a { color: var(--accent); }

.msg--bot .msg__bubble blockquote {
    margin: 8px 0;
    padding-left: 12px;
    border-left: 3px solid var(--border);
    color: var(--muted);
}

.chart-box {
    margin: 12px 0 4px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.chart-box canvas { max-width: 100%; }

.chart-dl {
    margin-top: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--accent);
    font-size: 12.5px;
    padding: 5px 12px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s;
}
.chart-dl:hover { background: #fafaf9; }

.starter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 75%;
}

.starter-chip {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 12.5px;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}
.starter-chip:hover { background: #fafaf9; border-color: #d0cfc8; }

/* ---------- Login screen ---------- */
.login-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.login-card {
    width: 100%;
    max-width: 340px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 28px;
    text-align: center;
}

.login-card .sidebar__logo {
    justify-content: center;
    padding: 0 0 6px;
    font-size: 22px;
}

.login-subtitle {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 22px;
}

.login-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    margin-bottom: 12px;
    transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--accent); }

.login-btn {
    width: 100%;
    border: none;
    background: var(--accent);
    color: #fff;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s;
}
.login-btn:hover { filter: brightness(1.06); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
    color: #c0392b;
    font-size: 12.5px;
    margin: 10px 0 0;
    min-height: 16px;
}

.sign-out {
    display: block;
    width: 100%;
    text-align: center;
    border: none;
    background: none;
    color: var(--muted);
    font-size: 11.5px;
    padding: 8px 0 0;
    cursor: pointer;
    text-decoration: underline;
}

.typing { display: flex; gap: 4px; padding: 4px 2px; }

.typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
    animation: bounce 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

.chat__footer {
    display: flex;
    gap: 10px;
    padding: 18px 32px 24px;
    background: var(--bg);
}

.chat__input {
    flex: 1;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 24px;
    padding: 13px 20px;
    font-size: 14.5px;
    font-family: inherit;
    outline: none;
    resize: none;
    max-height: 160px;
    line-height: 1.4;
    transition: border-color 0.15s;
    /* No scrollbar until the box actually hits max-height; autoResize() in
       ask-ariel.js switches this to auto when the content outgrows it. */
    overflow-y: hidden;
}
.chat__input:focus { border-color: #c9c8c1; }

.chat__send {
    border: none;
    background: var(--accent);
    color: #fff;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.15s;
    flex-shrink: 0;
}
.chat__send:hover { filter: brightness(1.06); }
.chat__send:disabled { opacity: 0.5; cursor: not-allowed; }

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

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}
