/* ═══════════════════════════════════════════════════════════════
   EasyAIOU Student Portal — ASYNC STATE COMPONENTS
   One loading / error / empty treatment for every page that fetches.

       <link rel="stylesheet" href="/static/ui-states.css">

   Markup:
       <div class="ui-loading"><span class="ui-spinner"></span>Loading…</div>
       <div class="ui-error">Message <button class="ui-retry">Retry</button></div>
       <div class="ui-empty"><i class="fas fa-inbox"></i><p>Nothing yet</p></div>

   Brand accent lives here only — no component below hardcodes a colour.
   Change --ui-accent to restyle every spinner and loading state at once.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --ui-accent:  #2563eb;   /* EasyAIOU blue — matches the portal UI */
  --ui-error:   #ef4444;
  --ui-error-bg:#fef2f2;
  --ui-muted:   #94a3b8;
  --ui-line:    #e2e8f0;
}

/* ── Loading ──────────────────────────────────────────────────── */
.ui-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  color: var(--ui-muted);
  font-size: 13px;
}

.ui-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--ui-line);
  border-top-color: var(--ui-accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: ui-spin .7s linear infinite;
}

.ui-spinner.lg { width: 28px; height: 28px; border-width: 3px; }

@keyframes ui-spin { to { transform: rotate(360deg); } }

/* ── Error ────────────────────────────────────────────────────── */
.ui-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  border: 1px solid rgba(239, 68, 68, .25);
  border-radius: 10px;
  background: var(--ui-error-bg);
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.45;
}

.ui-error::before {
  content: "\f071";                 /* Font Awesome exclamation-triangle */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: var(--ui-error);
  flex-shrink: 0;
}

.ui-retry {
  margin-left: auto;
  padding: 7px 12px;
  min-height: 36px;
  border: 1px solid rgba(239, 68, 68, .35);
  border-radius: 8px;
  background: #fff;
  color: var(--ui-error);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ui-retry:hover { background: var(--ui-error); color: #fff; }

/* ── Empty ────────────────────────────────────────────────────── */
.ui-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--ui-muted);
}

.ui-empty i     { font-size: 26px; opacity: .4; }
.ui-empty p     { margin: 0; font-size: 13px; }
.ui-empty .hint { font-size: 12px; opacity: .8; }

/* ── Inline button spinner ────────────────────────────────────── */
.is-busy { position: relative; color: transparent !important; pointer-events: none; }

.is-busy::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ui-spin .7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .ui-spinner, .is-busy::after { animation-duration: 2s; }
}
