/* ============================================================
   WEAVER Chat Interface Styles
   ============================================================ */

/* -- Layout ------------------------------------------------- */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
}

/* -- Header ------------------------------------------------- */

.chat-header {
    background: #282728;
    color: #fff;
    padding: 1rem 1.5rem;
    flex-shrink: 0;
    border-bottom: 3px solid #c5050c;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-brand i {
    font-size: 1.25rem;
    color: #c5050c;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.header-subtitle {
    font-size: 0.85rem;
    color: #aaa;
    margin-top: 0.25rem;
}

/* LLM status light: green while the model is answering, black once the
   backend has fallen back to verbatim checklist questions. */
.llm-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #aaa;
    white-space: nowrap;
}

.llm-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2e9e4f;
}

.llm-status.is-fallback .llm-status-dot {
    background: #000;
    box-shadow: 0 0 0 2px #aaa;
}

.llm-status.is-fallback .llm-status-label {
    color: #fff;
}

/* -- Message Area ------------------------------------------- */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* -- Message Bubbles ---------------------------------------- */

.message {
    max-width: 85%;
    animation: fadeIn 0.2s ease-in;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    line-height: 1.5;
}

.message.user .message-content {
    background: #c5050c;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message-role {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    opacity: 0.7;
}

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

.message-text {
    word-wrap: break-word;
}

/* -- Project Summary --------------------------------------- */

/* The summary is the deliverable, so its bubble reads as a document: full
   width, paper-white, with a rule down the side. */
.message--summary {
    max-width: 100%;
    align-self: stretch;
}

.message--summary .message-content {
    background: #fff;
    border: 1px solid #ddd;
    border-left: 3px solid #c5050c;
}

/* -- Markdown in Assistant Messages ------------------------- */

.message-text h1,
.message-text h2,
.message-text h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0.75rem 0 0.25rem;
}

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

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

.message-text p {
    margin: 0 0 0.5rem;
}

.message-text ul,
.message-text ol {
    margin: 0 0 0.5rem;
    padding-left: 1.15rem;
}

.message-text li {
    margin: 0.1rem 0;
}

.message-text code {
    font-size: 0.85em;
}

.message-text table {
    font-size: 0.85em;
    border-collapse: collapse;
}

.message-text th,
.message-text td {
    border: 1px solid #ddd;
    padding: 0.2rem 0.4rem;
}

/* -- Input Area --------------------------------------------- */

.chat-input-area {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.chat-input-row {
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    border-radius: 24px;
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    font-size: 0.95rem;
}

.chat-input:focus {
    border-color: #c5050c;
    box-shadow: 0 0 0 0.2rem rgba(197, 5, 12, 0.15);
    outline: none;
}

.chat-send {
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #c5050c;
    border-color: #c5050c;
    flex-shrink: 0;
}

.chat-send:hover,
.chat-send:focus {
    background: #a30409;
    border-color: #a30409;
}

.chat-send:disabled {
    background: #999;
    border-color: #999;
}

/* -- Typing Indicator --------------------------------------- */

.typing-indicator {
    padding: 0.25rem 0 0.5rem;
    font-size: 0.8rem;
    color: #888;
}

.typing-text {
    font-style: italic;
}

.typing-dots span {
    animation: blink 1.4s infinite;
    font-weight: bold;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* -- Animations --------------------------------------------- */

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

@keyframes blink {
    0%, 20% { opacity: 0; }
    50%     { opacity: 1; }
    100%    { opacity: 0; }
}

/* -- Responsive --------------------------------------------- */

@media (max-width: 768px) {
    .chat-container {
        max-width: 100%;
        box-shadow: none;
    }

    .message {
        max-width: 92%;
    }
}
