/* ─────────────────────────────────────────────────────────────────────────────
 * utilities.css — extracted inline-style utilities
 *
 * Built to replace inline `style="…"` attributes so we can drop 'unsafe-inline'
 * from the CSP `style-src` directive. Conventions:
 *
 *   1. Bootstrap 5 utilities are NOT redefined here — use them directly:
 *      d-none, d-flex, d-block, w-100, m-0/p-0, m-1..m-5, rounded, rounded-circle,
 *      text-center/start/end, fw-bold/semibold, align-items-*, justify-content-*,
 *      gap-*, flex-shrink-0, etc.
 *
 *   2. Theme-aware classes use existing tokens from main.css:
 *      var(--text-primary), var(--glass-border), var(--bg-surface), etc.
 *
 *   3. Brand-colour utilities mirror Tailwind palette names so they're easy
 *      to map mentally: amber-400, emerald-500, indigo-300, violet-300, etc.
 *
 *   4. One-off utilities prefixed `.u-` so they're searchable.
 *
 *   5. `!important` is preserved where the inline style had it (these were
 *      escape-hatches against Bootstrap defaults; keep that behaviour).
 *
 * Maintenance: when adding new utility, group by category alphabetically.
 * Don't add one-offs; if a value only appears once, leave the inline style
 * (or extract into a per-template <style nonce="…"> block).
 * ─────────────────────────────────────────────────────────────────────────── */


/* ═══════════════════════════════════════════════════════════════════════════
   COLOURS — text
   ═══════════════════════════════════════════════════════════════════════════ */

/* Theme-token aliases (replace inline `color: var(--…)` declarations) */
.text-primary-strong   { color: var(--text-primary)   !important; }
.text-secondary-strong { color: var(--text-secondary) !important; }
.text-muted-strong     { color: var(--text-muted)     !important; }
.text-primary-soft     { color: var(--text-primary); }
.text-secondary-soft   { color: var(--text-secondary); }
.text-muted-soft       { color: var(--text-muted); }

/* Brand-aligned palette (Tailwind names — most-used hex values across templates) */
.text-amber-400        { color: #fbbf24; }            /* warning / accent yellow */
.text-amber-500        { color: #f59e0b; }
.text-emerald-400      { color: #34d399; }
.text-emerald-500      { color: #10b981; }            /* success green */
.text-indigo-300       { color: #818cf8; }            /* primary-light */
.text-indigo-400       { color: #6366f1; }            /* primary */
.text-violet-300       { color: #a78bfa; }
.text-violet-500       { color: #8b5cf6; }
.text-purple-500       { color: #a855f7; }
.text-cyan-400         { color: #22d3ee; }
.text-cyan-500         { color: #06b6d4; }
.text-pink-400         { color: #f472b6; }
.text-pink-500         { color: #ec4899; }
.text-rose-400         { color: #fb7185; }
.text-red-400          { color: #f87171; }
.text-red-500          { color: #ef4444; }
.text-slate-100        { color: #f1f5f9; }
.text-slate-200        { color: #e2e8f0; }
.text-slate-300        { color: #cbd5e1; }
.text-slate-400        { color: #94a3b8; }
.text-slate-500        { color: #64748b; }
.text-slate-700        { color: #475569; }
.text-gray-600         { color: #666; }


/* ═══════════════════════════════════════════════════════════════════════════
   COLOURS — background
   ═══════════════════════════════════════════════════════════════════════════ */

.bg-surface            { background: var(--bg-surface); }
.bg-surface-light      { background: var(--bg-surface-light); }
.bg-glass              { background: var(--glass-bg); }
.bg-dark-deep          { background: var(--bg-dark); }

/* Soft-tint accents — used for alert/highlight cards */
.bg-amber-soft         { background: rgba(251, 191, 36, 0.08); }
.bg-amber-strong       { background: rgba(251, 191, 36, 0.15); }
.bg-emerald-soft       { background: rgba(16, 185, 129, 0.08); }
.bg-emerald-strong     { background: rgba(16, 185, 129, 0.15); }
.bg-indigo-soft        { background: rgba(99, 102, 241, 0.08); }
.bg-indigo-strong      { background: rgba(99, 102, 241, 0.15); }
.bg-violet-soft        { background: rgba(139, 92, 246, 0.08); }
.bg-pink-soft          { background: rgba(236, 72, 153, 0.08); }
.bg-rose-soft          { background: rgba(251, 113, 133, 0.08); }
.bg-red-soft           { background: rgba(239, 68, 68, 0.05); }
.bg-red-strong         { background: rgba(239, 68, 68, 0.15); }
.bg-cyan-soft          { background: rgba(6, 182, 212, 0.08); }

/* Solid brand-palette backgrounds (used for indicator dots, progress fills) */
.bg-indigo-300         { background: #818cf8; }
.bg-indigo-500         { background: #6366f1; }
.bg-emerald-400        { background: #34d399; }
.bg-emerald-500        { background: #10b981; }
.bg-amber-400          { background: #fbbf24; }
.bg-pink-400           { background: #f472b6; }
.bg-pink-500           { background: #ec4899; }
.bg-violet-500         { background: #8b5cf6; }
.bg-red-500            { background: #ef4444; }
.bg-white-soft         { background: rgba(255, 255, 255, 0.04); }
.bg-white-medium       { background: rgba(255, 255, 255, 0.05); }
.bg-white-strong       { background: rgba(255, 255, 255, 0.08); }
.bg-black-soft         { background: rgba(0, 0, 0, 0.15); }
.bg-black-medium       { background: rgba(0, 0, 0, 0.3); }
.bg-black-strong       { background: rgba(0, 0, 0, 0.45); }


/* ═══════════════════════════════════════════════════════════════════════════
   BORDERS
   ═══════════════════════════════════════════════════════════════════════════ */

.border-glass          { border: 1px solid var(--glass-border); }
.border-glass-strong   { border: 1px solid var(--glass-border) !important; }
.border-light          { border: 1px solid #ddd; }                     /* legacy printable cards */
.border-dashed-glass   { border: 1px dashed var(--glass-border) !important; }

.border-amber-soft     { border: 1px solid rgba(251, 191, 36, 0.2); }
.border-amber-strong   { border: 1px solid rgba(251, 191, 36, 0.4); }
.border-emerald-soft   { border: 1px solid rgba(16, 185, 129, 0.2); }
.border-indigo-soft    { border: 1px solid rgba(99, 102, 241, 0.3); }
.border-pink-soft      { border: 1px solid rgba(236, 72, 153, 0.3); }
.border-red-soft       { border: 1px solid rgba(239, 68, 68, 0.3); }
.border-white-soft     { border-color: rgba(255, 255, 255, 0.08); }
.border-white-medium   { border-color: rgba(255, 255, 255, 0.1); }


/* ═══════════════════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════════════ */

/* Bootstrap 5 has fs-1..fs-6 (2.5rem..1rem). Below extends for smaller text. */
.fs-xs                 { font-size: 0.75rem; }
.fs-sm                 { font-size: 0.78rem; }
.fs-7                  { font-size: 0.8rem; }
.fs-8                  { font-size: 0.85rem; }
.fs-9                  { font-size: 0.9rem; }
.fs-10                 { font-size: 0.95rem; }

/* Line-heights */
.lh-tight              { line-height: 1.2; }
.lh-snug               { line-height: 1.4; }
.lh-normal             { line-height: 1.5; }
.lh-relaxed            { line-height: 1.6; }
.lh-loose              { line-height: 1.7; }


/* ═══════════════════════════════════════════════════════════════════════════
   SIZING (where Bootstrap doesn't cover)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Used for tiny coloured indicator dots */
.size-2                { width: 8px;  height: 8px; }
.size-2-5              { width: 10px; height: 10px; }
.size-3                { width: 12px; height: 12px; }
.size-3-5              { width: 14px; height: 14px; }
.size-4                { width: 16px; height: 16px; }
.size-5                { width: 20px; height: 20px; }
.size-6                { width: 24px; height: 24px; }
.size-8                { width: 32px; height: 32px; }

/* Heights used in progress bars / mini-meters */
.h-2                   { height: 8px; }
.h-2-5                 { height: 10px; }
.h-3                   { height: 12px; }
.h-4                   { height: 16px; }
.h-5                   { height: 20px; }
.h-6                   { height: 24px; }


/* ═══════════════════════════════════════════════════════════════════════════
   MAX-WIDTH / MAX-HEIGHT (where Bootstrap doesn't cover)
   ═══════════════════════════════════════════════════════════════════════════ */

.u-max-h-200           { max-height: 200px; }
.u-max-h-300           { max-height: 300px; }
.u-max-h-400           { max-height: 400px; }
.u-max-h-500           { max-height: 500px; }
.u-scroll-y            { overflow-y: auto; }
.u-scroll-x            { overflow-x: auto; }


/* ═══════════════════════════════════════════════════════════════════════════
   SPACING (extras beyond Bootstrap's m-/p-)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Compact paddings used in tables/printable cards */
.u-p-2-tight           { padding: 0.5rem 0.75rem; }
.u-p-card-print        { padding: 8px; }


/* ═══════════════════════════════════════════════════════════════════════════
   CURSOR / INTERACTION
   ═══════════════════════════════════════════════════════════════════════════ */

.u-cursor-pointer      { cursor: pointer; }
.u-cursor-not-allowed  { cursor: not-allowed; }
.u-cursor-grab         { cursor: grab; }


/* ═══════════════════════════════════════════════════════════════════════════
   ICON / SVG SIZING
   ═══════════════════════════════════════════════════════════════════════════ */

.u-icon-1x             { font-size: 1rem; }
.u-icon-1-5x           { font-size: 1.5rem; line-height: 1; }
.u-icon-2x             { font-size: 2rem; line-height: 1; }
.u-icon-3x             { font-size: 3rem; line-height: 1; }


/* Faint slate border (footer divider) */
.border-slate-faint    { border-color: rgba(203, 213, 225, 0.2); }


/* ═══════════════════════════════════════════════════════════════════════════
   MIN-WIDTH (where Bootstrap doesn't cover)
   ═══════════════════════════════════════════════════════════════════════════ */

.u-min-w-250           { min-width: 250px; }


/* ═══════════════════════════════════════════════════════════════════════════
   BORDER WIDTH (extras beyond Bootstrap's `border` / `border-2`)
   ═══════════════════════════════════════════════════════════════════════════ */

.u-border-w-2          { border-width: 2px; }


/* ═══════════════════════════════════════════════════════════════════════════
   COMPOSITES — common combinations seen 5+ times
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Experimental-banner (shared lab partial) ───────────────────────── */
.lab-banner-bg {
    background: linear-gradient(90deg, rgba(129, 140, 248, 0.1), rgba(192, 132, 252, 0.1));
    border-left: 4px solid #818cf8 !important;
}
.lab-banner-icon-circle {
    width: 50px;
    height: 50px;
    background: rgba(129, 140, 248, 0.2);
    color: #818cf8;
}
.lab-banner-pill {
    background: #818cf8;
    font-size: 10px;
}

/* ─── Feedback-form (shared lab partial) ──────────────────────────────── */
.lab-feedback-star {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}
.lab-feedback-empty-circle {
    background: rgba(129, 140, 248, 0.05);
    border: 2px dashed rgba(129, 140, 248, 0.2);
}

/* Strong glass modal background (heavier blur for dialog overlays) */
.modal-glass-strong {
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

/* ─── AI usage meter (rendered dynamically by base.html) ───────────────── */
.ai-meter-rail {
    flex: 1;
    min-width: 120px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}
.ai-meter-fill {
    height: 100%;
    width: 0;                            /* JS sets via element.style.width */
    transition: width 0.3s;
}
.ai-meter-text {
    font-weight: 600;
    white-space: nowrap;
}
.ai-meter-upgrade-link {
    white-space: nowrap;
}

/* Amber→orange premium gradient button (used in upgrade CTAs) */
.btn-premium-gradient {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: none;
    color: #0f172a;
}
.btn-premium-gradient:hover {
    color: #0f172a;
    filter: brightness(1.05);
}

/* Indigo accent border (used on glass-card notices) */
.border-indigo-tint {
    border: 1px solid rgba(129, 140, 248, 0.2);
}

/* Green→teal gradient (parent/teacher CTA — shared/home.html) */
.bg-green-teal-gradient {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}
.btn-green-teal-gradient {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
    border: none;
}
.btn-green-teal-gradient:hover {
    color: #fff;
    filter: brightness(1.05);
}

/* Printable revision card (used in printable views) */
.card-print {
    padding: 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: center;
}

/* Glass surface — replaces `background: var(--bg-surface); border: 1px solid var(--glass-border)` */
.surface-glass {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
}

.surface-glass-strong {
    background: var(--bg-surface) !important;
    border: 1px solid var(--glass-border) !important;
}
