/* ============================================================
   CRASA admin theme

   A restrained, editorial skin for the Filament admin. It layers
   on top of Filament's own component CSS and the runtime brand
   palette injected from config/brand.php (the single source of
   brand truth). It does NOT redefine any --crasa-* brand token:
   every colour here is consumed from those tokens, or derived from
   them with color-mix(). Re-skinning the platform is still a single
   edit to config/brand.php. See ROADMAP.md Phase 1.2, CLAUDE.md.

   Loaded into the admin head by AppServiceProvider. The brand tokens
   themselves arrive from resources/views/partials/brand-tokens.blade.php,
   injected by AdminPanelProvider. No em dashes, no hardcoded brand hex.
   ============================================================ */

/* ------------------------------------------------------------
   Local, derived theme variables (light)
   These are scoped to the panel body and built only from brand
   tokens, plus white/black/transparent (neutral, not brand
   colours). Pairings are chosen to meet WCAG AA in both modes.
   ------------------------------------------------------------ */
.fi-body {
    --admin-bg:            var(--crasa-cream);
    --admin-surface:       #ffffff;
    --admin-surface-soft:  color-mix(in srgb, var(--crasa-cream) 55%, #ffffff);
    --admin-border:        var(--crasa-border);
    --admin-border-strong: color-mix(in srgb, var(--crasa-navy) 14%, transparent);

    --admin-text:        var(--crasa-charcoal);    /* body copy: AA on surfaces */
    --admin-text-muted:  var(--crasa-slate);       /* secondary: AA on surfaces */
    --admin-heading:     var(--crasa-navy);

    --admin-accent:       var(--crasa-green);          /* fills, bars, borders */
    --admin-accent-text:  var(--crasa-green-dark);     /* green text: AA on light */
    --admin-accent-tint:  color-mix(in srgb, var(--crasa-green) 10%, #ffffff);

    --admin-shadow-sm: 0 1px 2px color-mix(in srgb, var(--crasa-navy) 6%, transparent);
    --admin-shadow-md: 0 1px 3px color-mix(in srgb, var(--crasa-navy) 7%, transparent),
                       0 1px 2px color-mix(in srgb, var(--crasa-navy) 5%, transparent);

    background-color: var(--admin-bg);
    color: var(--admin-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ------------------------------------------------------------
   Dark mode: an on-brand navy neutral, not a flat grey.
   Surfaces step up from navy-dark; text stays high-contrast.
   ------------------------------------------------------------ */
.dark .fi-body {
    --admin-bg:            var(--crasa-navy-dark);
    --admin-surface:       var(--crasa-navy);
    --admin-surface-soft:  var(--crasa-navy-soft);
    --admin-border:        color-mix(in srgb, #ffffff 8%, transparent);
    --admin-border-strong: color-mix(in srgb, #ffffff 14%, transparent);

    --admin-text:        var(--crasa-cream);        /* AA on navy */
    --admin-text-muted:  var(--crasa-slate-light);  /* AA on navy */
    --admin-heading:     #ffffff;

    --admin-accent:       var(--crasa-green-bright);
    --admin-accent-text:  var(--crasa-green-bright); /* AA on navy */
    --admin-accent-tint:  color-mix(in srgb, var(--crasa-green-bright) 14%, transparent);

    --admin-shadow-sm: 0 1px 2px color-mix(in srgb, #000000 30%, transparent);
    --admin-shadow-md: 0 1px 3px color-mix(in srgb, #000000 35%, transparent);
}

/* ============================================================
   Typography
   Body face comes from the panel ->font() token (Inter). Headings
   use the brand serif (Lora) for an editorial, on-brand register.
   ============================================================ */

.fi-header-heading,
.fi-section-header-heading,
.fi-modal-heading,
.fi-wi-stats-overview-stat-value {
    font-family: var(--crasa-font-serif);
    letter-spacing: -0.01em;
}

.fi-header-heading {
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--admin-heading);
    line-height: 1.2;
}

.fi-header-subheading {
    color: var(--admin-text-muted);
    font-size: 0.95rem;
}

/* ============================================================
   Main surface and sections (cards)
   ============================================================ */

.fi-main {
    background-color: var(--admin-bg);
}

.fi-section,
.fi-wi-stats-overview-stat {
    background-color: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    box-shadow: var(--admin-shadow-sm);
}

.fi-section-header-heading {
    font-size: 1.05rem;
    color: var(--admin-heading);
}

.fi-section-header {
    border-bottom: 1px solid var(--admin-border);
}

/* ============================================================
   Sidebar
   ============================================================ */

.fi-sidebar,
.fi-sidebar-header,
.fi-sidebar-nav {
    background-color: var(--admin-surface);
    border-color: var(--admin-border);
}

.fi-sidebar-nav {
    padding: 0.85rem 0.6rem;
}

/* A clean list: no markers, no grouped tree decoration. */
.fi-sidebar-nav ul,
.fi-sidebar-nav li {
    list-style: none;
}

.fi-sidebar-item-grouped-border {
    display: none;
}

.fi-sidebar-group-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--admin-text-muted);
}

.fi-sidebar-item-button {
    color: var(--admin-text-muted);
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.fi-sidebar-item-button:hover {
    background-color: var(--admin-surface-soft);
    color: var(--admin-text);
}

.fi-sidebar-item-icon {
    color: var(--admin-text-muted);
}

.fi-sidebar-item-button:hover .fi-sidebar-item-icon {
    color: var(--admin-text);
}

/* Active item: AA-contrast green text on a green tint, with a left
   accent bar. The accent text uses green-dark in light mode so the
   small, semibold label still clears 4.5:1. */
.fi-sidebar-item.fi-active .fi-sidebar-item-button {
    background-color: var(--admin-accent-tint);
    color: var(--admin-accent-text);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--admin-accent);
}

.fi-sidebar-item.fi-active .fi-sidebar-item-icon {
    color: var(--admin-accent-text);
}

/* ============================================================
   Topbar
   ============================================================ */

.fi-topbar > nav {
    background-color: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
}

/* ============================================================
   Tables
   ============================================================ */

.fi-ta {
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    box-shadow: var(--admin-shadow-sm);
}

.fi-ta-header-cell {
    background-color: var(--admin-surface-soft);
    color: var(--admin-text-muted);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.fi-ta-row {
    transition: background-color 0.12s ease;
}

.fi-ta-row:hover {
    background-color: var(--admin-surface-soft);
}

/* ============================================================
   Forms
   Control colours come from Filament's primary palette
   (config/brand.php). Here we only refine the focus affordance so
   it reads as brand green in both modes.
   ============================================================ */

.fi-input:focus,
.fi-fo-text-input input:focus,
.fi-fo-textarea textarea:focus {
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--admin-accent) 22%, transparent);
    outline: none;
}

/* ============================================================
   Stats overview (dashboard)
   ============================================================ */

/* The overview is configured for six cards (StatsOverview::getColumns()),
   which Filament's own grid classes only cover up to four. Lay them out
   responsively here: six across on wide screens, stepping down below. */
.fi-wi-stats-overview-stats-ctn {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .fi-wi-stats-overview-stats-ctn {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .fi-wi-stats-overview-stats-ctn {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.fi-wi-stats-overview-stat {
    padding: 1.25rem;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.fi-wi-stats-overview-stat:hover {
    box-shadow: var(--admin-shadow-md);
    border-color: var(--admin-border-strong);
}

.fi-wi-stats-overview-stat-label {
    color: var(--admin-text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.fi-wi-stats-overview-stat-value {
    font-size: 1.9rem;
    font-weight: 600;
    color: var(--admin-heading);
    line-height: 1.15;
}

.fi-wi-stats-overview-stat-description {
    color: var(--admin-text-muted);
    font-size: 0.78rem;
}

/* Hide the stat sparklines. The chart arrays in StatsOverview.php are
   illustrative placeholders, not real time series, so a trend line would
   imply data we do not have. Restrained and honest per CLAUDE.md. Remove
   this rule once the stats carry genuine historical data. */
.fi-wi-stats-overview-stat-chart {
    display: none;
}

/* ============================================================
   Dark mode component surfaces
   Filament defaults to its slate grays in dark mode; we steer the
   key surfaces to the brand navy so dark mode reads as on-brand.
   ============================================================ */

.dark .fi-main,
.dark .fi-body {
    background-color: var(--admin-bg);
}

.dark .fi-sidebar,
.dark .fi-sidebar-header,
.dark .fi-sidebar-nav,
.dark .fi-topbar > nav,
.dark .fi-section,
.dark .fi-wi-stats-overview-stat,
.dark .fi-ta {
    background-color: var(--admin-surface);
    border-color: var(--admin-border);
}

.dark .fi-ta-header-cell,
.dark .fi-ta-row:hover {
    background-color: var(--admin-surface-soft);
}

.dark .fi-header-heading,
.dark .fi-section-header-heading {
    color: var(--admin-heading);
}

/* ============================================================
   Motion: respect users who prefer reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .fi-sidebar-item-button,
    .fi-ta-row,
    .fi-wi-stats-overview-stat {
        transition: none;
    }
}

/* ============================================================
   Small screens
   ============================================================ */

@media (max-width: 768px) {
    .fi-header-heading {
        font-size: 1.4rem;
    }
    .fi-wi-stats-overview-stat-value {
        font-size: 1.6rem;
    }
}

/* ============================================================
   Dashboard polish (phase 26): a calm, institutional landing that
   matches the redesigned member area. Quiet header (no gradient
   greeting), uniform stat cards (no per-stat colour, icons or
   charts), and a tidy activity list. All pairings target WCAG AA.
   ============================================================ */

/* Quiet page header (replaces the gradient greeting banner). */
.crasa-dash-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--admin-border-strong);
}
.crasa-dash-title {
    font-family: var(--crasa-font-serif);
    font-weight: 600;
    font-size: 1.7rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--admin-heading);
    margin: 0;
}
.crasa-dash-sub {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    color: var(--admin-text-muted);
}
.crasa-dash-dot { margin: 0 0.3rem; color: var(--admin-border-strong); }
.crasa-dash-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.crasa-dash-btn {
    display: inline-flex;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--admin-text);
    background: var(--admin-surface);
    border: 1px solid var(--admin-border-strong);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.crasa-dash-btn:hover {
    background: var(--admin-surface-soft);
    border-color: var(--crasa-green);
    color: var(--admin-heading);
}

/* Uniform, calm stat cards: flat, neutral, no colour accents. */
.fi-wi-stats-overview-stat { box-shadow: none; }
.fi-wi-stats-overview-stat:hover { box-shadow: var(--admin-shadow-sm); }
.fi-wi-stats-overview-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--admin-text-muted);
}
.fi-wi-stats-overview-stat-value {
    color: var(--admin-heading);
    font-size: 1.85rem;
    font-weight: 600;
}
.fi-wi-stats-overview-stat-description {
    color: var(--admin-text-muted);
    font-size: 0.8rem;
}
/* Belt and braces: no decorative description icon colour, no sparkline. */
.fi-wi-stats-overview-stat-description-icon { color: var(--admin-text-muted); }
.fi-wi-stats-overview-stat canvas { display: none; }

/* Tidy recent-activity list (no coloured icon circles). */
.crasa-act-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.crasa-act-row {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.7rem 0;
    border-top: 1px solid var(--admin-border);
}
.crasa-act-row:first-child { border-top: 0; }
.crasa-act-type {
    flex: 0 0 5.5rem;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--admin-text-muted);
}
.crasa-act-main { flex: 1; min-width: 0; text-decoration: none; display: block; }
.crasa-act-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--admin-heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.crasa-act-main:hover .crasa-act-title { color: var(--admin-accent-text); }
.crasa-act-meta { display: block; font-size: 0.78rem; color: var(--admin-text-muted); margin-top: 0.1rem; }
.crasa-act-time { flex: 0 0 auto; font-size: 0.75rem; color: var(--admin-text-muted); white-space: nowrap; }
.crasa-act-empty { font-size: 0.85rem; color: var(--admin-text-muted); margin: 0; }
