/* Hermes — minimal v0 styling. Replace with a design system later. */

:root {
    --bg: #0e1116;
    --panel: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --accent: #f78166;
    --accent-dim: #6e3a26;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

h1 {
    font-size: 2rem;
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.02em;
}

.tagline {
    color: var(--muted);
    margin: 0 0 2rem 0;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin-right: 0.5rem;
}

button {
    background: var(--accent);
    color: #1a1a1a;
    border: 0;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

button:hover { background: #ff9479; }
button:disabled { background: var(--accent-dim); cursor: not-allowed; }

code {
    background: rgba(110, 118, 129, 0.4);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85em;
}

/* ── Initial boot (while /auth/me resolves) ───────────────────────────── */

.boot-loading {
    /* Empty placeholder so the page doesn't flash unauthed content for
       users who are signed in. /auth/me usually resolves in <100ms. */
    min-height: 100vh;
    background: var(--bg);
}

/* ── Sign-in hero (unauthenticated landing) ───────────────────────────── */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
}

.hero-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
    max-width: 720px;
    width: 100%;
}

.hero-logo {
    width: 100%;
    max-width: 600px;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

.hero-error {
    background: rgba(255, 110, 110, 0.12);
    border: 1px solid rgba(255, 110, 110, 0.35);
    color: #ffb3b3;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.95em;
    max-width: 480px;
}

.hero-signin {
    background: var(--accent);
    color: #1a1a1a;
    padding: 0.75rem 1.75rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05em;
    letter-spacing: 0.01em;
    transition: background 0.15s ease;
}

.hero-signin:hover {
    background: #ff9479;
}

.hero-foot {
    color: var(--muted);
    font-size: 0.85em;
    margin: 0;
}

/* ── Dashboard shell (authed) ─────────────────────────────────────────── */

/* The dashboard shell wraps everything inside the authed view. It overrides
   the default <main> max-width because the header/footer images need to
   stretch edge-to-edge for visual impact, while the inner panels stay
   constrained to the readable max-width via the existing <main> styles. */
.dash-shell {
    width: 100%;
}

/* Slim strip above the header image with signed-in user + sign out. */
.dash-userbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    background: rgba(22, 27, 34, 0.6);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85em;
}

.dash-user-email {
    color: var(--text);
    font-weight: 500;
}

/* Full-width banner images at top and bottom of the dashboard. */
.dash-banner {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

.dash-banner-top {
    /* Cap so an oversized header doesn't dominate the viewport. */
    max-height: 320px;
    object-fit: cover;
    object-position: center;
}

.dash-banner-bottom {
    max-height: 240px;
    object-fit: cover;
    object-position: center;
    margin-top: 2rem;
}

.auth-logout {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
}

.auth-logout:hover {
    color: var(--text);
    border-color: var(--muted);
    background: transparent;
}

/* ── Chat panel ───────────────────────────────────────────────────────── */

.chat-panel .hint {
    color: var(--muted);
    font-size: 0.9em;
    margin: -0.25rem 0 1rem 0;
}

.chat-panel .hint em {
    color: var(--text);
    font-style: normal;
    background: rgba(110, 118, 129, 0.25);
    padding: 0.05rem 0.4rem;
    border-radius: 3px;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-height: 80px;
    max-height: 480px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 0.25rem;
}

.chat-empty {
    color: var(--muted);
    font-style: italic;
    text-align: center;
    padding: 1.5rem 0;
    margin: 0;
}

.chat-bubble {
    max-width: 85%;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-bubble-user {
    background: var(--accent);
    color: #1a1a1a;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-bubble-hermes {
    background: rgba(110, 118, 129, 0.18);
    color: var(--text);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-bubble-error {
    background: rgba(255, 110, 110, 0.15);
    border: 1px solid rgba(255, 110, 110, 0.4);
    color: #ffb3b3;
    align-self: flex-start;
}

.chat-role {
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin-bottom: 0.2rem;
}

.chat-content {
    /* Lets backend Markdown-ish output render with newlines preserved. */
    white-space: pre-wrap;
}

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

.chat-input {
    flex: 1;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    font-size: 0.95em;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-input:disabled {
    opacity: 0.6;
}

.chat-send {
    min-width: 80px;
}

/* Typing indicator (three pulsing dots) shown while Hermes is thinking. */
.chat-typing {
    display: inline-flex;
    gap: 0.3rem;
    align-items: center;
    padding: 0.9rem 0.85rem;
}

.chat-typing .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
    animation: chat-pulse 1.2s infinite ease-in-out;
}

.chat-typing .dot:nth-child(2) {
    animation-delay: 0.2s;
}
.chat-typing .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chat-pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50%      { opacity: 1;   transform: scale(1); }
}
