/* ──────────────────────────────────────────────────────────────────────────
   UI polish: subtle, reversible quality cues applied site-wide.
   Everything here is conservative and honours prefers-reduced-motion.
   Reveal/count-up hidden states are applied by JS only, so if the script
   fails to load nothing is ever left invisible.
   ────────────────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
    /* Button micro-press */
    .btn {
        transition: transform .08s ease, box-shadow .15s ease, filter .15s ease;
    }
    .btn:active:not(:disabled):not(.disabled) {
        transform: translateY(1px);
    }

    /* Gentle hover-lift, only for cards that already opt into a shadow utility
       (content cards) - avoids lifting plain/structural cards and modals. */
    .card.shadow-sm, .card.shadow {
        transition: transform .18s ease, box-shadow .18s ease;
    }
    .card.shadow-sm:hover, .card.shadow:hover {
        transform: translateY(-2px);
        box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .12) !important;
    }
}

/* Softer, calmer focus ring than the Bootstrap default .25rem/.25 alpha. */
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .15);
}

/* ── Skeleton shimmer (AJAX loading placeholders) ───────────────────────── */
.ui-skel-wrap { width: 100%; }
.ui-skel {
    position: relative;
    overflow: hidden;
    background: #e9ecef;
    border-radius: 6px;
}
.ui-skel::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent);
    animation: ui-shimmer 1.3s infinite;
}
.ui-skel-line { height: 12px; margin: 9px 0; }
.ui-skel-card { height: 60px; margin-bottom: 10px; border-radius: 10px; }

@keyframes ui-shimmer { 100% { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
    .ui-skel::after { animation: none; }
}

/* ── Semantic badge system (app-wide) ───────────────────────────────────────
   One consistent meaning -> colour mapping for count/status chips across the
   product, so colour signals urgency rather than decorating each screen:
     - neutral grey  (bg-secondary) ....... a plain roll-up count, no action
     - amber         (bg-warning text-dark)  needs attention / due soon
     - red           (bg-danger) ........... overdue / blocking only
     - green         (bg-success) .......... a positive / ready state
     - blue          (bg-info text-dark) ... informational / new
   Express the meaning with the Bootstrap contextual class above; every theme
   preset already remaps those, so this stays theme-reactive automatically.

   Low-contrast safety net: amber and info badges are easy to ship with the
   default white text (poor contrast on a light chip). Force readable dark text
   unless the markup explicitly opted into light text. No !important, so the
   themed presets (professional/space/neon/etc.) can still restyle badges. */
.badge.bg-warning:not(.text-white):not(.text-light),
.badge.bg-info:not(.text-white):not(.text-light) {
    color: #212529;
}

/* ── Calm brand-toned badge set ─────────────────────────────────────────────
   A near-monochrome chip system: the hue follows --site-primary so chips
   recolour with the theme preset, and intensity (not separate hues) carries
   the gentle hierarchy. Tints are baked SOLID via color-mix rather than real
   opacity, so they render predictably over any surface, hover state or theme
   (real transparency would shift contrast depending on what's behind it).

     .badge-soft  -> light brand tint + near-black text. Counts and plain
                     status/info. Light pill + dark text scores ~AAA on any
                     surface and stays legible even on the dark presets.
     .badge-brand -> solid brand + white text. "Needs attention / due soon",
                     so actionable items have presence without shouting (~AA).
     .badge-alert -> deepened red + white text. Overdue / blocking ONLY. Kept
                     a distinct hue on purpose: per WCAG 1.4.1, urgency must
                     not be signalled by a darker shade of the same colour.

   Scoped at .badge.<name> so the default/light themes render exactly as
   designed; the themed presets that restyle .badge with !important
   (professional/space/neon) still fold these into their own badge look. */
.badge.badge-soft {
    background: color-mix(in srgb, var(--site-primary, #0078D4) 14%, #ffffff);
    color: #1f2a37;
    border: 1px solid color-mix(in srgb, var(--site-primary, #0078D4) 30%, transparent);
    font-weight: 600;
}
.badge.badge-brand {
    background: var(--site-primary, #0078D4);
    color: #ffffff;
    border: 1px solid transparent;
    font-weight: 600;
}
.badge.badge-alert {
    background: #c62828;
    color: #ffffff;
    border: 1px solid transparent;
    font-weight: 600;
}

/* Fallback for browsers without color-mix(): a fixed pale-blue tint. */
@supports not (background: color-mix(in srgb, red 10%, white)) {
    .badge.badge-soft { background: #e7f1fb; border-color: #bcd8f2; }
}
