/* -----------------------------------------------------------------------------
   app.css

   Root application stylesheet for the Blazor Server frontend. Provides base
   typography, Blazor error-boundary styling, form-validation colour tokens,
   and the shared app-grid helpers (sortable headers, per-column filter inputs,
   toolbar toggle button) used by data tables across the platform.

   Project : AspireAIApp.Web
   Author  : Theodor Harmse (Teddy)
   Created : 2026-03-06
----------------------------------------------------------------------------- */

/* Typography is owned by `assets/styles/themes/theme-system.css` (this file
   loads AFTER it, so a font-family here would silently override the theme's
   modern stack with whatever is listed - the old Helvetica/Arial rule did
   exactly that and made the whole app render in Arial on Windows). */

/* Theme colors are provided by `assets/styles/themes/theme-system.css` */

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem color-mix(in srgb, var(--glass-aura-cyan) 14%, transparent), 0 0 0 0.22rem color-mix(in srgb, var(--glass-aura-cyan) 9%, transparent);
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e51080;
}

.validation-message {
    color: #e51080;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ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ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* --- App-grid: sortable / filterable table enhancement helpers ------------- */

.app-grid-shell {
    position: relative;
}

.app-grid-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
    padding-inline: 0.1rem;
}

.app-grid-filter-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    color: var(--icon-color, var(--text-secondary));
    border-color: var(--glass-line-soft, var(--border-color)) !important;
    background: color-mix(in srgb, var(--glass-surface-muted, var(--bg-secondary)) 66%, transparent);
    box-shadow: none;
}

.app-grid-filter-toggle svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-grid-filter-toggle:hover,
.app-grid-filter-toggle:focus,
.app-grid-filter-toggle.is-active {
    color: var(--icon-color-strong, var(--text-primary));
    border-color: color-mix(in srgb, var(--glass-aura-cyan, var(--color-primary)) 30%, var(--glass-line, var(--border-color))) !important;
    background: color-mix(in srgb, var(--glass-aura-cyan, var(--color-primary)) 8%, var(--glass-surface-muted, var(--bg-secondary)));
}

.app-grid-filter-toggle.has-active-filters::after {
    content: "";
    position: absolute;
    top: 0.32rem;
    right: 0.32rem;
    width: 0.38rem;
    height: 0.38rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--glass-aura-cyan, var(--color-primary)) 82%, var(--text-primary));
}

.app-grid-sortable {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.app-grid-sortable:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--color-primary) 70%, white);
    outline-offset: -2px;
}

.app-grid-sort-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    margin-left: 0.35rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    vertical-align: middle;
}

.app-grid-sort-indicator::before {
    content: "↕";
}

.app-grid-sortable[data-sort-direction="asc"] .app-grid-sort-indicator {
    color: var(--color-primary);
}

.app-grid-sortable[data-sort-direction="asc"] .app-grid-sort-indicator::before {
    content: "↑";
}

.app-grid-sortable[data-sort-direction="desc"] .app-grid-sort-indicator {
    color: var(--color-primary);
}

.app-grid-sortable[data-sort-direction="desc"] .app-grid-sort-indicator::before {
    content: "↓";
}

.app-grid-filter-row > th {
    background-color: color-mix(in srgb, var(--table-header-bg) 72%, var(--bg-secondary));
    background-image: none;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    vertical-align: top;
}

.app-grid-filter-row[hidden] {
    display: none !important;
}

.app-grid-filter-cell {
    min-width: 7rem;
}

.app-grid-filter-cell-empty {
    min-width: 3rem;
}

.app-grid-filter-input {
    min-width: 6rem;
    border-color: color-mix(in srgb, var(--border-color) 82%, var(--color-primary));
    background-color: color-mix(in srgb, var(--bg-secondary) 94%, transparent);
    color: var(--text-primary);
}

.app-grid-filter-input::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.app-grid-no-results-row > td {
    font-style: italic;
}

@media (max-width: 991.98px) {
    .app-grid-filter-cell {
        min-width: 8.5rem;
    }

    .app-grid-filter-input {
        min-width: 8rem;
    }
}

/* AI Chatbot (personal chat) — hide the native file inputs behind the styled upload labels.
   Global (non-scoped) so it is unaffected by the scoped-CSS ::deep rewriter. */
.pchat-native-file,
.pchat-native-file input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    font-size: 0;
    color: transparent;
    cursor: pointer;
}

/* AI Chatbot (personal chat) — make the embedded AiChatConsole fill its pane. The console's own
   layout is a 2-column grid (sidebar + stage) that only collapses in compact mode; the personal
   chat renders it non-compact WITHOUT a sidebar, so the stage would otherwise sit in the narrow
   ~20rem sidebar column with the rest of the pane blank. These are GLOBAL (not scoped/::deep)
   descendant rules with a `.pchat-main .pchat-console` ancestor so their specificity beats the
   console's scoped grid regardless of stylesheet order. */
.pchat-main .pchat-console .ai-chat-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

.pchat-main .pchat-console .ai-chat-shell__layout {
    display: block;       /* single full-width column — no sidebar in this surface */
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.pchat-main .pchat-console .ai-chat-shell__stage {
    height: 100%;
    width: 100%;
    min-height: 0;
    max-height: 100%;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
}

.pchat-main .pchat-console .ai-chat-shell__messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.pchat-main .pchat-console .ai-chat-shell__composer {
    flex: 0 0 auto;
}

/* AI Chatbot: widen chat bubbles to ~80% of the message pane (same as the Full Chat popup).
   The console defaults to min(72ch, 92%); the 72ch cap makes them look narrow on this wide pane.
   User bubbles stay right-aligned, assistant left — only the width cap changes. */
.pchat-main .pchat-console .ai-chat-shell__message {
    max-width: 80%;
}
