/* ============================================================
   anota app portal — design system
   Brand: teal→green (from the anota wordmark), blue-hued neutrals.
   Quality bar: Jotform or better. No Bootstrap-template look.
   ============================================================ */

:root {
    /* Brand */
    --an-teal: #1B9AAA;
    --an-green: #7DC242;
    --an-primary: #16A385;
    --an-primary-dark: #0F8A70;
    --an-primary-subtle: #E9F7F3;
    --an-gradient: linear-gradient(90deg, #1B9AAA, #7DC242);

    /* Neutrals — blue-hued, never pure gray */
    --an-ink: #0B1929;
    --an-slate-800: #1E3A5F;
    --an-slate-600: #475B73;
    --an-slate-500: #64748B;
    --an-slate-400: #94A3B8;
    --an-slate-300: #CBD5E1;
    --an-slate-200: #E2E8F0;
    --an-slate-100: #F1F5F9;
    --an-slate-50: #F8FAFC;

    /* Semantic */
    --an-success: #2E7D32;
    --an-warning: #B45309;
    --an-error: #C62828;

    /* Shadows */
    --an-shadow-sm: 0 1px 3px rgba(11, 25, 41, .08), 0 1px 2px rgba(11, 25, 41, .04);
    --an-shadow-md: 0 4px 6px rgba(11, 25, 41, .06), 0 2px 4px rgba(11, 25, 41, .04);
    --an-shadow-lg: 0 10px 24px rgba(11, 25, 41, .08), 0 4px 8px rgba(11, 25, 41, .04);
    --an-shadow-glow: 0 0 0 1px rgba(22, 163, 133, .10), 0 4px 16px rgba(22, 163, 133, .14);

    --an-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
    font-family: var(--an-font);
    color: var(--an-ink);
    background: var(--an-slate-50);
    margin: 0;
}

h1:focus { outline: none; }

a { color: var(--an-primary); }
a:hover { color: var(--an-primary-dark); }

/* ---------- shell ---------- */
.an-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.an-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--an-slate-200);
}

.an-topbar-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.an-brand { display: flex; align-items: center; }
.an-brand img { height: 26px; display: block; }

.an-nav { display: flex; gap: 6px; }

.an-nav-link {
    font-size: .875rem;
    font-weight: 600;
    color: var(--an-slate-600);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    background: none;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.an-nav-link:hover { background: var(--an-slate-100); color: var(--an-ink); }
.an-nav-link.active { color: var(--an-primary); background: var(--an-primary-subtle); }

.an-topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.an-user {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--an-slate-600);
    font-size: .875rem;
    padding: 5px 10px 5px 5px;
    border-radius: 999px;
    transition: background 150ms ease;
}

.an-user:hover { background: var(--an-slate-100); color: var(--an-ink); }

.an-help-link {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--an-slate-500);
    transition: background 150ms ease, color 150ms ease;
}

.an-help-link:hover { background: var(--an-slate-100); color: var(--an-ink); }

.an-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--an-gradient);
    color: #fff;
    font-weight: 700;
    font-size: .8125rem;
    display: grid;
    place-items: center;
}

.an-user-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.an-logout { margin: 0; }
.an-logout-btn { color: var(--an-slate-500); }

/* workspace switcher (only rendered for users with more than one membership) */
.an-ws-form { margin: 0; }

.an-ws-select {
    height: 32px;
    max-width: 180px;
    padding: 0 8px;
    border: 1px solid var(--an-slate-300);
    border-radius: 8px;
    background: #fff;
    color: var(--an-slate-600);
    font: inherit;
    font-size: .8125rem;
}

.an-main { flex: 1; }

/* ---------- impersonation banner (MainLayout, "view as tenant" support session) ---------- */
.an-impersonation-banner {
    background: var(--an-error);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 24px;
    font-size: .875rem;
    font-weight: 600;
    text-align: center;
}

.an-impersonation-stop-form { margin: 0; }

.an-impersonation-stop-btn {
    background: rgba(255, 255, 255, .16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 6px;
    padding: 5px 12px;
    font-size: .8125rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 150ms ease;
}

.an-impersonation-stop-btn:hover { background: rgba(255, 255, 255, .28); }

/* ---------- suspended-workspace banner (MainLayout, member's own workspace) ---------- */
.an-suspended-banner {
    background: #FFF3E0;
    color: #7C4A03;
    text-align: center;
    padding: 10px 24px;
    font-size: .875rem;
    font-weight: 600;
    border-bottom: 1px solid #F5D399;
}

@media (max-width: 640px) {
    .an-impersonation-banner { flex-direction: column; gap: 8px; padding: 10px 16px; }
    .an-suspended-banner { padding: 10px 16px; }
}

/* ---------- page scaffolding ---------- */
.an-page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.an-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.an-page-title {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.1;
    margin: 0;
    color: var(--an-ink);
}

.an-page-sub {
    margin: 6px 0 0;
    color: var(--an-slate-500);
    font-size: 1rem;
}

/* ---------- buttons ---------- */
.an-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--an-primary);
    color: #fff !important;
    font-weight: 600;
    font-size: .875rem;
    padding: 10px 22px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 150ms ease, transform 100ms ease, box-shadow 200ms ease;
}

.an-btn-primary:hover { background: var(--an-primary-dark); box-shadow: var(--an-shadow-md); }
.an-btn-primary:active { transform: scale(.98); }
.an-btn-primary:disabled { opacity: .5; cursor: default; }

.an-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: var(--an-slate-600);
    font-weight: 600;
    font-size: .875rem;
    padding: 10px 22px;
    border-radius: 6px;
    border: 1px solid var(--an-slate-300);
    cursor: pointer;
    text-decoration: none;
    transition: background 150ms ease, border-color 150ms ease;
}

.an-btn-secondary:hover { background: var(--an-slate-50); border-color: var(--an-slate-400); color: var(--an-ink); }

.an-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: var(--an-error);
    font-weight: 600;
    font-size: .875rem;
    padding: 10px 22px;
    border-radius: 6px;
    border: 1px solid #F0B9B9;
    cursor: pointer;
    text-decoration: none;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.an-btn-danger:hover { background: var(--an-error); border-color: var(--an-error); color: #fff; }
.an-btn-danger:disabled { opacity: .5; cursor: default; }

/* ---------- cards & tables ---------- */
.an-card {
    background: #fff;
    border: 1px solid var(--an-slate-200);
    border-radius: 8px;
    box-shadow: var(--an-shadow-sm);
}

.an-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9375rem;
}

.an-table th {
    text-align: left;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--an-slate-500);
    padding: 14px 20px;
    border-bottom: 1px solid var(--an-slate-200);
}

.an-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--an-slate-100);
    color: var(--an-slate-600);
    vertical-align: middle;
}

.an-table tbody tr { transition: background 120ms ease; }
.an-table tbody tr:hover { background: var(--an-slate-50); }
.an-table tbody tr:last-child td { border-bottom: none; }

.an-table .an-cell-title a {
    color: var(--an-ink);
    font-weight: 600;
    text-decoration: none;
}

.an-table .an-cell-title a:hover { color: var(--an-primary); }

/* ---------- status pills ---------- */
.an-pill {
    display: inline-block;
    font-size: .75rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 3px 12px;
}

.an-pill-published { background: #E7F5E9; color: var(--an-success); }
.an-pill-draft { background: var(--an-slate-100); color: var(--an-slate-500); }
.an-pill-archived { background: var(--an-slate-50); color: var(--an-slate-400); }

/* ---------- empty state ---------- */
.an-empty {
    text-align: center;
    padding: 96px 24px;
}

.an-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 16px;
    background: var(--an-primary-subtle);
    display: grid;
    place-items: center;
    font-size: 28px;
}

.an-empty h2 { font-size: 1.25rem; font-weight: 600; margin: 0 0 8px; color: var(--an-ink); }
.an-empty p { color: var(--an-slate-500); margin: 0 0 24px; }

/* ---------- status banners (Identity StatusMessage + inline notices) ---------- */
.an-status {
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    font-size: .875rem;
    line-height: 1.5;
    margin-bottom: 18px;
}

.an-status p { margin: 0 0 6px; }
.an-status p:last-child { margin-bottom: 0; }

.an-status-success {
    border-left: 3px solid var(--an-success);
    background: #E7F5E9;
    color: #1B5E20;
}

.an-status-error {
    border-left: 3px solid var(--an-error);
    background: #FEF2F2;
    color: #7F1D1D;
}

.an-status-error a { color: #7F1D1D; font-weight: 600; }

.an-status-warning {
    border-left: 3px solid var(--an-warning);
    background: #FFF8EB;
    color: #7C4A03;
}

.an-status-warning a { color: #7C4A03; font-weight: 600; }

/* ---------- alerts ---------- */
.an-alert {
    border-left: 3px solid var(--an-warning);
    background: #FFF8EB;
    color: #7C4A03;
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
    font-size: .875rem;
    margin-bottom: 20px;
}

/* ---------- focus & a11y ---------- */
:focus-visible { outline: 2px solid var(--an-primary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

@media (max-width: 640px) {
    .an-user-name { display: none; }
    .an-topbar-inner { gap: 12px; }
    .an-page { padding: 24px 16px 60px; }
}

/* ---------- platform-admin sidebar (AdminLayout.razor) ----------
   Dark, deliberately distinct from an-topbar's light teal chrome, so operating the
   platform never reads as "inside a tenant's workspace". Defined globally, not in
   AdminLayout.razor.css: Blazor's NavLink doesn't reliably forward the CSS-isolation
   scope attribute onto its rendered <a>, so scoped rules silently never match it —
   an-nav-link has the same constraint, which is why MainLayout has no scoped CSS file
   either. Visual language adapted from the Anota Cloud Admin design spec (2026-07-16). */
.adm-shell {
    min-height: 100vh;
    display: flex;
    background: var(--an-slate-50);
}

.adm-sidebar {
    width: 248px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    color: #fff;
    background: linear-gradient(180deg, #0B1929 0%, #0C2733 55%, #0E3540 100%);
}

.adm-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 8px 22px;
}

.adm-brand-mark {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 11px;
    background: var(--an-gradient);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.1875rem;
    box-shadow: 0 4px 16px rgba(27, 154, 170, .4);
}

.adm-brand-word { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.adm-brand-word-accent { color: var(--an-green); }
.adm-brand-sub { font-size: .6875rem; color: rgba(255, 255, 255, .5); letter-spacing: .04em; }

.adm-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.adm-sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 9px;
    font-size: .875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .68);
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
}

.adm-sidebar-nav-link:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.adm-sidebar-nav-link.active { background: rgba(255, 255, 255, .14); color: #fff; }

.adm-sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.adm-sidebar-exit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    font-size: .8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .55);
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
}

.adm-sidebar-exit:hover { background: rgba(255, 255, 255, .09); color: #fff; }

.adm-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
}

.adm-sidebar-avatar {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    background: var(--an-gradient);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .8125rem;
}

.adm-sidebar-user-info { min-width: 0; line-height: 1.2; }
.adm-sidebar-user-name { font-size: .8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-sidebar-user-role { font-size: .6875rem; color: rgba(255, 255, 255, .5); }

/* No padding/max-width here — every admin page wraps its own content in the shared
   .an-page, exactly like MainLayout's pages do. Only the sidebar chrome differs. */
.adm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Design spec's 64px white header: eyebrow crumb + page title on the left, global tenant
   search + New Tenant on the right. Title is route-derived in AdminLayout. */
.adm-topbar {
    min-height: 64px;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid var(--an-slate-200);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 28px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.adm-topbar-heading { min-width: 0; line-height: 1.25; }

.adm-topbar-crumb {
    font-size: .6875rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--an-slate-400);
    font-weight: 500;
}

.adm-topbar-title {
    font-size: 1.1875rem;
    font-weight: 700;
    color: var(--an-ink);
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adm-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.adm-topbar-search {
    position: relative;
    display: flex;
    align-items: center;
    color: var(--an-slate-400);
}

.adm-topbar-search svg {
    position: absolute;
    left: 12px;
    pointer-events: none;
}

.adm-topbar-search input {
    width: 260px;
    height: 38px;
    padding: 0 14px 0 36px;
    border: 1px solid var(--an-slate-200);
    border-radius: 10px;
    font: inherit;
    font-size: .875rem;
    background: var(--an-slate-50);
    color: var(--an-ink);
}

.adm-topbar-search input:focus {
    outline: none;
    border-color: var(--an-primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 133, .14);
}

.adm-topbar-new {
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    background: var(--an-primary);
    color: #fff;
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(22, 163, 133, .28);
    transition: background 150ms ease;
}

.adm-topbar-new:hover { background: var(--an-primary-dark); color: #fff; }

.adm-content { flex: 1; overflow-y: auto; }

@media (max-width: 860px) {
    .adm-shell { flex-direction: column; }
    .adm-sidebar { width: auto; flex-direction: row; align-items: center; padding: 12px 16px; }
    .adm-brand { padding: 0; }
    .adm-sidebar-nav { flex-direction: row; margin-left: auto; }
    .adm-sidebar-footer { display: none; }
    .adm-topbar { flex-wrap: wrap; padding: 10px 16px; position: static; }
    .adm-topbar-search input { width: 160px; }
}

@media (max-width: 720px) {
    .adm-topbar-inner { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 10px; }
}

/* ============================================================
   Template plumbing (Identity pages, validation, error UI)
   ============================================================ */

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid var(--an-error); }
.validation-message { color: var(--an-error); font-size: .8125rem; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: 6px;
}

.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;
}
