/* Woolly look (WoollyApp src/constants/theme.ts): warm palette, Luckiest Guy headings, solid "3D edge" shadows. */

@font-face {
    font-family: "Luckiest Guy";
    src: url("fonts/LuckiestGuy-Regular.ttf") format("truetype");
    font-display: swap;
}

:root {
    --w-bg: #faf9f5;
    --w-surface: #f1ede4;
    --w-text: #1a1000;
    --w-muted: #6b6252;
    --w-border: #e3ded2;
    --w-accent: #eb9a3b;
    --w-accent-shape: #c85f0e;
    --w-on-accent: #1a1000;
    --w-danger: #d92d20;
    --w-danger-shape: #a3241a;
    --w-success-shape: #1d4a2e;
    --w-info-shape: #1b3e5a;
    --w-tertiary-shape: #42306b;
}

@media (prefers-color-scheme: dark) {
    :root {
        --w-bg: #1f1606;
        --w-surface: #2e2410;
        --w-text: #f7f1de;
        --w-muted: #b0a584;
        --w-border: #463a1a;
        --w-accent-shape: #a85504;
        --w-danger: #f97066;
        --w-danger-shape: #b4483f;
    }
}

html, body {
    background: var(--w-bg);
    color: var(--w-text);
    font-family: "Spline Sans", Inter, system-ui, sans-serif;
    font-weight: 500;
}

.display {
    font-family: "Luckiest Guy", "Spline Sans", system-ui, sans-serif;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* Buttons: a solid edge under the face that collapses when pressed. */
.mud-button-filled {
    border-radius: 18px;
    font-weight: 800;
    box-shadow: 0 5px 0 var(--w-border) !important;
    margin-bottom: 5px;
    transition: transform 80ms ease, box-shadow 80ms ease;
}
.mud-button-filled.mud-button-filled-primary { box-shadow: 0 5px 0 var(--w-accent-shape) !important; }
.mud-button-filled.mud-button-filled-error { box-shadow: 0 5px 0 var(--w-danger-shape) !important; }
.mud-button-filled.mud-button-filled-success { box-shadow: 0 5px 0 var(--w-success-shape) !important; }
.mud-button-filled.mud-button-filled-info,
.mud-button-filled.mud-button-filled-secondary { box-shadow: 0 5px 0 var(--w-info-shape) !important; }
.mud-button-filled.mud-button-filled-tertiary { box-shadow: 0 5px 0 var(--w-tertiary-shape) !important; }
.mud-button-filled:active:not(.mud-button-disabled) {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--w-accent-shape) !important;
}
.mud-button-filled.mud-button-disabled { box-shadow: none !important; opacity: 0.8; }
.mud-button-text { font-weight: 800; }
.mud-button-text.mud-button-text-primary { color: var(--w-accent-shape); }

/* Cards and panels: bordered surface with a neutral edge. */
.mud-paper:not(.mud-appbar):not(.mud-drawer):not(.mud-popover):not(.mud-snackbar),
.mud-card {
    border: 2px solid var(--w-border);
    border-radius: 20px;
    box-shadow: 0 5px 0 var(--w-border) !important;
}
.mud-dialog { border-radius: 20px; }
.mud-dialog .mud-dialog-title h6 {
    font-family: "Luckiest Guy", "Spline Sans", system-ui, sans-serif;
    font-weight: 400;
    font-size: 1.5rem;
}

/* Inputs: 2px border, radius 18, uppercase labels. */
.mud-input-outlined-border {
    border-width: 2px !important;
    border-radius: 18px !important;
}
.mud-input-label {
    font-weight: 800 !important;
}

/* Chips: pills with small uppercase text. */
.mud-chip {
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mud-table-head .mud-table-cell {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: var(--w-muted);
}
.mud-table-cell a { color: inherit; font-weight: 700; }

/* App bar and drawer. */
.app-bar { border-bottom: 2px solid var(--w-border); }
.app-bar-logo { width: 36px; height: 36px; border-radius: 50%; margin: 0 10px 0 4px; }
.app-bar-title { font-size: 1.5rem; padding-top: 4px; }
.app-bar-user { font-weight: 700; margin-right: 8px; }
.nav-menu .mud-nav-link { font-weight: 800; border-radius: 16px; margin: 4px 8px; width: auto; }
.nav-menu .mud-nav-link.active { background: rgba(26, 16, 0, 0.12) !important; color: inherit !important; }

/* Help drawer: a topic rendered from Markdown. */
.help-drawer { border-left: 2px solid var(--w-border); }
.help-header { display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px 24px; }
.help-content { padding: 0 24px 24px; line-height: 1.55; overflow-y: auto; }
.help-content h2 { font-size: 1rem; font-weight: 800; margin: 20px 0 6px; }
.help-content p { margin: 0 0 10px; }
.help-content ul, .help-content ol { margin: 0 0 10px; padding-left: 20px; }
.help-content li { margin-bottom: 4px; }
.help-content code { background: var(--w-surface); border-radius: 6px; padding: 1px 5px; }
.help-content a { color: var(--w-accent-shape); font-weight: 700; }
.help-sections .mud-expand-panel { border-color: var(--w-border); }
.help-sections .mud-expand-panel-text { font-weight: 800; }

/* Conversations: the list's rows open a conversation; a conversation is a timeline of bubbles and tool calls. */
.clickable-row { cursor: pointer; }
/* Agent avatar picker: a row that scrolls sideways; the picked one is ringed in the accent color. */
.avatar-picker { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.avatar-pick { flex: none; width: 80px; height: 112px; padding: 4px; border: 2.5px solid transparent; border-radius: 18px; background: var(--w-surface); cursor: pointer; }
.avatar-pick.selected { border-color: var(--w-accent); }
.avatar-pick img { width: 100%; height: 100%; object-fit: contain; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.bubble {
    max-width: 80%;
    border: 2px solid var(--w-border);
    border-radius: 18px;
    padding: 10px 14px;
}
.bubble-user { align-self: flex-start; background: var(--w-surface); }
.bubble-agent { align-self: flex-end; background: var(--w-bg); }
.bubble-meta { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--w-muted); margin-bottom: 4px; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-flagged { border-color: var(--w-danger); }
.bubble-reported { border-color: var(--w-accent); }
.bubble-alert { font-size: 13px; font-weight: 700; margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.bubble-flagged .bubble-alert { color: var(--w-danger); margin: 0 0 6px; }
.bubble-reported .bubble-alert { color: var(--w-accent-shape); }
.bubble-alert .bubble-text { flex-basis: 100%; font-weight: 500; color: var(--w-text); }
.bubble-image { display: block; max-width: 240px; max-height: 240px; border-radius: 12px; margin-top: 8px; }
.tool-call { align-self: center; width: min(80%, 720px); border: 2px dashed var(--w-border); border-radius: 14px; font-size: 13px; }
.tool-call summary { display: flex; align-items: center; gap: 8px; padding: 6px 12px; cursor: pointer; }
.tool-kind { border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; color: #fff; }
.tool-kind-server { background: var(--w-info-shape); }
.tool-kind-app { background: var(--w-tertiary-shape); }
.tool-name { font-family: ui-monospace, monospace; font-weight: 700; }
.tool-preview { color: var(--w-muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-body { padding: 0 12px 12px; }
.tool-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--w-muted); margin: 8px 0 4px; }
.tool-body pre {
    margin: 0;
    max-height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: var(--w-surface);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
}

/* Page header. */
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header .page-title { display: flex; align-items: center; gap: 4px; flex: 1; }
.page-header h1 { font-size: 2.25rem; margin: 0; padding-top: 6px; }
.section-title { font-size: 1.5rem; padding-top: 4px; }
.muted { color: var(--w-muted); }

/* Login (static page, no MudBlazor). */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--w-surface);
    border: 2px solid var(--w-border);
    border-radius: 20px;
    box-shadow: 0 5px 0 var(--w-border);
    padding: 32px 24px;
    text-align: center;
}
.login-card form { text-align: left; }
.login-logo { width: 96px; height: 96px; border-radius: 50%; box-shadow: 0 4px 0 var(--w-accent-shape); }
.login-card h1 { font-size: 40px; line-height: 48px; margin: 16px 0 24px; }
.field-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: var(--w-muted);
    margin: 16px 0 6px;
}
.field {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-size: 16px;
    color: var(--w-text);
    background: var(--w-bg);
    border: 2px solid var(--w-border);
    border-radius: 18px;
    padding: 12px 16px;
    outline: none;
}
.field:focus { border-color: var(--w-accent); }
.validation-message, .login-error { color: var(--w-danger); font-size: 14px; font-weight: 700; margin: 8px 0 0; }
.button-3d {
    width: 100%;
    margin: 24px 0 5px;
    font: inherit;
    font-size: 17px;
    font-weight: 800;
    color: var(--w-on-accent);
    background: var(--w-accent);
    border: none;
    border-radius: 18px;
    padding: 16px 24px;
    box-shadow: 0 5px 0 var(--w-accent-shape);
    cursor: pointer;
    transition: transform 80ms ease, box-shadow 80ms ease;
}
.button-3d:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--w-accent-shape); }

#blazor-error-ui {
    background: var(--w-danger);
    color: #fff;
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

h1:focus { outline: none; }
