/* ─── Chamber Buddy global styles ──────────────────────────────────────────
   Brand identity:  vibrant orange (#F97316) + deep navy (#0F172A) + warm
   off-white surfaces. Tokens here mirror the values in
   Theme/ChamberBuddyTheme.cs so non-MudBlazor surfaces (splash screen,
   scrollbars, focus rings, error UI) stay in sync with the rest of the
   design system.
   ───────────────────────────────────────────────────────────────────────── */

:root {
    --cb-primary: #F97316;
    --cb-primary-dark: #EA580C;
    --cb-primary-light: #FED7AA;
    --cb-primary-soft: #FFF7ED;
    --cb-secondary: #0F172A;
    --cb-text-primary: #0F172A;
    --cb-text-secondary: #475569;
    --cb-divider: #E7E5E4;
    --cb-bg: #FAFAF9;
    --cb-surface: #FFFFFF;
    --cb-error: #DC2626;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--cb-text-primary);
    background-color: var(--cb-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html {
    scroll-behavior: smooth;
}

a {
    color: var(--cb-primary);
}

code, pre {
    font-family: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, Menlo, monospace;
    font-size: 0.85em;
    background: var(--cb-primary-soft);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    color: var(--cb-primary-dark);
}
pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* Visible focus rings for keyboard nav. */
:focus-visible {
    outline: 2px solid var(--cb-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Refined scrollbars. */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 8px;
    border: 2px solid var(--cb-bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.32); }

/* ─── Brand mark — image-based ─────────────────────────────────────────── */
/* Used by ChamberBuddyMark.razor. Two sizes — "lg" embeds the full marketing
   logo image; "sm" shows the mascot icon + "Chamber Buddy" wordmark text. */

.cb-logo-img {
    display: block;
    width: auto;
    height: auto;
    user-select: none;
}
.cb-logo-img--lg {
    max-width: min(520px, 100%);
    max-height: 240px;
}

.cb-logo-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    user-select: none;
}
.cb-logo-mascot {
    height: 40px;
    width: 40px;
    object-fit: contain;
    flex: 0 0 auto;
}
.cb-logo-text {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    line-height: 1;
}
.cb-logo-text-my {
    font-style: italic;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: -0.02em;
    color: var(--cb-secondary);
    transform: translateY(-0.45em);
}
.cb-logo-text-cb {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.025em;
    color: var(--cb-secondary);
}
.cb-logo-text-buddy {
    color: var(--cb-primary);
    margin-left: 0.18em;
}
.cb-logo-text--white .cb-logo-text-my,
.cb-logo-text--white .cb-logo-text-cb {
    color: #FFFFFF;
}
.cb-logo-text--white .cb-logo-text-buddy {
    color: var(--cb-primary-light);
}

@media (max-width: 600px) {
    .cb-logo-text-my { display: none; }
    .cb-logo-text-cb { font-size: 1rem; }
    .cb-logo-mascot { height: 34px; width: 34px; }
}

/* ─── Splash screen (shown until WASM mounts) ──────────────────────────── */

.cb-splash {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    background:
        radial-gradient(circle at 12% 18%, rgba(249, 115, 22, 0.10) 0%, transparent 45%),
        radial-gradient(circle at 88% 82%, rgba(14, 165, 233, 0.08) 0%, transparent 50%),
        linear-gradient(160deg, #FFFFFF 0%, #FAFAF9 100%);
    z-index: 1;
    padding: 2rem;
}

.cb-splash-logo {
    width: auto;
    height: auto;
    max-width: min(560px, 90%);
    max-height: 50vh;
    /* Rounded corners + layered shadow stack. The stack reads as:
         1) hairline 1-2px shadow — separates the card from the page
         2) close 4-12px shadow — small depth, "sits on a surface"
         3) mid 18-36px shadow — premium lift, the "expensive card" feel
         4) outer 40-80px shadow tinted with the MCB orange — atmospheric
            glow that nods to the brand without being literal about it.
       Layering instead of one big shadow is what makes it feel embossed
       rather than blurred. */
    border-radius: 20px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.05),
        0 4px 12px rgba(15, 23, 42, 0.08),
        0 18px 36px -12px rgba(15, 23, 42, 0.14),
        0 40px 80px -32px rgba(249, 115, 22, 0.22);
}

.cb-splash-tagline {
    font-size: 1rem;
    font-weight: 500;
    color: var(--cb-text-secondary);
    letter-spacing: -0.005em;
}

.cb-splash-loader {
    display: flex;
    gap: 0.4rem;
}
.cb-splash-loader span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cb-primary);
    opacity: 0.4;
    animation: cb-splash-pulse 1.2s infinite ease-in-out;
}
.cb-splash-loader span:nth-child(2) { animation-delay: 0.15s; }
.cb-splash-loader span:nth-child(3) { animation-delay: 0.3s; }
@keyframes cb-splash-pulse {
    0%, 80%, 100% { transform: scale(0.85); opacity: 0.4; }
    40%           { transform: scale(1.1);  opacity: 1.0; }
}

.cb-splash-foot {
    position: absolute;
    bottom: 1.5rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--cb-text-secondary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ─── Blazor error banner ──────────────────────────────────────────────── */

#blazor-error-ui {
    background: var(--cb-error);
    color: #FFFFFF;
    bottom: 0;
    box-shadow: 0 -10px 30px -10px rgba(220, 38, 38, 0.4);
    display: none;
    left: 0;
    padding: 0.85rem 1.25rem 0.85rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 0.875rem;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    color: #FFFFFF;
    font-size: 1.1rem;
}
#blazor-error-ui .reload {
    color: #FFFFFF;
    text-decoration: underline;
    margin-left: 0.5rem;
}

/* ─── App-level utility classes ─────────────────────────────────────────── */

/* Cards that lift on hover. Use on dashboard tiles and clickable surfaces. */
.cb-lift {
    transition:
        transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
        box-shadow 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cb-lift:hover {
    transform: translateY(-3px);
    box-shadow:
        0 20px 32px -12px rgba(249, 115, 22, 0.16),
        0 8px 16px -8px rgba(249, 115, 22, 0.10);
}

/* ─── Member avatar tile ────────────────────────────────────────────────── */
/* Square-ish business-logo tile used in member rows / cards across the
   admin app. Originally defined in Members.razor's <style> block, but
   Accounts.razor uses the same classes and Members.razor wasn't mounted
   on the Accounts page -- so logos rendered at their natural size (huge).
   Hoisted here so every page that uses .cb-member-avatar gets the right
   constraint without having to duplicate. */
.cb-member-avatar {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--cb-surface-2, #FAFAF9);
    border: 1px solid var(--cb-divider, #E2E8F0);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    font-weight: 700;
    color: var(--cb-text-secondary, #64748B);
    font-size: 1.05rem;
}
.cb-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cb-member-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 0.78rem;
}

/* ─── Metric tiles ──────────────────────────────────────────────────────── */
/* Shared dashboard-style stat cards. Used by Home.razor (4-up across the
   chamber dashboard) and Accounts.razor (4-up AR stats). Lift into the
   global stylesheet — scoped styles inside a single .razor only apply
   to that page, which is why Accounts initially rendered as bare orange
   text (the classes existed in Home's <style> block, not anywhere
   reachable from Accounts). Any future dashboard-style page can opt in
   by using the same class names. */
.cb-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
@media (min-width: 900px) {
    .cb-metric-grid { grid-template-columns: repeat(4, 1fr); }
}
.cb-metric-tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px;
    background: white;
    border: 1px solid var(--cb-divider);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color 120ms, transform 120ms, box-shadow 120ms;
}
.cb-metric-tile:hover {
    border-color: var(--cb-primary);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -10px rgba(249, 115, 22, 0.35);
}
.cb-metric-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: grid; place-items: center;
    margin-bottom: 4px;
}
.cb-metric-icon-primary  { background: rgba(249,115,22,0.10); color: var(--cb-primary); }
.cb-metric-icon-info     { background: rgba(14,165,233,0.10); color: #0369A1; }
.cb-metric-icon-warning  { background: rgba(234,179,8,0.10);  color: #B45309; }
.cb-metric-icon-success  { background: rgba(22,163,74,0.10);  color: #15803D; }
.cb-metric-num {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--mud-palette-text-primary);
    line-height: 1.05;
}
.cb-metric-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
}
.cb-metric-sub {
    font-size: 11px;
    color: var(--mud-palette-text-secondary);
    font-style: italic;
}

/* Subtle gradient panel backgrounds for hero sections. */
.cb-hero {
    background:
        radial-gradient(circle at 0% 0%,    rgba(249, 115, 22, 0.10) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(14, 165, 233,  0.08) 0%, transparent 55%),
        linear-gradient(160deg, #FFFFFF 0%, #FAFAF9 100%);
    border: 1px solid var(--cb-divider);
    border-radius: 16px;
}

/* Page transitions — small fade-up on first render. */
.cb-page-enter {
    animation: cb-page-fade 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes cb-page-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

h1, h2, h3, h4, h5, h6 {
    color: var(--cb-text-primary);
}

.mud-snackbar { border-radius: 10px !important; }
.mud-paper.mud-paper-outlined { border-color: var(--cb-divider); }
