/* ============================================================
   PROGAIN PROTOCOLS — BASE STYLES
   Global typography, utilities, common patterns
   ============================================================ */

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--dark-2); }
::-webkit-scrollbar-thumb { background: var(--dark-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dark); }

/* ── SELECTION ────────────────────────────────────────────── */
::selection { background: var(--accent); color: var(--dark); }

/* ── FOCUS VISIBLE ────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── UTILITIES ────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.hidden { display: none !important; }
.visible { display: block !important; }

.text-accent { color: var(--accent); }
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right  { text-align: right; }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }

/* ── BADGE ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: .72rem; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase;
}
.badge-accent  { background: rgba(242,228,0,.15); color: var(--accent); }
.badge-green   { background: var(--green-bg);     color: var(--green); }
.badge-blue    { background: var(--blue-bg);       color: var(--blue); }
.badge-red     { background: var(--red-bg);        color: var(--red); }
.badge-purple  { background: var(--purple-bg);     color: var(--purple); }
.badge-orange  { background: var(--orange-bg);     color: var(--orange); }
.badge-muted   { background: rgba(255,255,255,.08); color: var(--text-white-muted); }

/* ── BUTTON ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600; font-size: .9rem;
  letter-spacing: .02em;
  transition: var(--transition);
  cursor: pointer; border: none; outline: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  color: var(--dark);
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: var(--shadow-accent-lg);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-white);
  border: 1px solid var(--dark-border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-dark {
  background: var(--dark-card);
  color: var(--text-white);
  border: 1px solid var(--dark-border);
}
.btn-dark:hover { border-color: var(--dark-border-md); background: var(--dark-3); }

.btn-sm { padding: 8px 16px; font-size: .82rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 16px 32px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }

/* ── CARD ─────────────────────────────────────────────────── */
.card {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: var(--transition);
}
.card:hover { border-color: var(--dark-border-md); }
.card-accent-border { border-color: rgba(242,228,0,.25); }

/* ── INPUT ────────────────────────────────────────────────── */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label {
  font-size: .82rem; font-weight: 600;
  color: var(--text-white-muted);
  letter-spacing: .03em; text-transform: uppercase;
}
.input-field {
  width: 100%;
  padding: 14px 16px;
  background: var(--dark-3);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius-md);
  color: var(--text-white);
  font-size: .95rem;
  transition: var(--transition);
}
.input-field::placeholder { color: var(--text-white-muted); }
.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-field.input-error { border-color: var(--red); }
.input-error-msg {
  font-size: .78rem; color: var(--red);
  display: flex; align-items: center; gap: 5px;
}

/* ── DIVIDER ──────────────────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-white-muted); font-size: .82rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1;
  height: 1px; background: var(--dark-border);
}

/* ── LOADER ───────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--dark-border-md);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader-overlay {
  position: fixed; inset: 0;
  background: var(--dark);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
  z-index: var(--z-top);
  transition: opacity .4s ease;
}
.loader-overlay.fade-out { opacity: 0; pointer-events: none; }

/* ── TOAST ────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: var(--z-toast);
  pointer-events: none;
  /* Prevent toast from causing horizontal overflow */
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--dark-card);
  border: 1px solid var(--dark-border-md);
  border-radius: var(--radius-md);
  color: var(--text-white);
  font-size: .88rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
  pointer-events: all;
  min-width: 240px; max-width: 360px;
  word-break: break-word;
}
.toast.toast-success { border-color: var(--green); }
.toast.toast-error   { border-color: var(--red); }
.toast.toast-info    { border-color: var(--blue); }
.toast.toast-warn    { border-color: var(--orange); }
.toast.toast-out     { animation: toastOut .3s ease forwards; }

@keyframes toastIn  { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { from { opacity:1; transform:translateX(0); } to { opacity:0; transform:translateX(20px); } }

/* ── TOAST — MOBILE POSITION ──────────────────────────────── */
@media (max-width: 480px) {
  #toast-container {
    bottom: 12px; right: 12px; left: 12px;
    max-width: 100%;
    align-items: stretch;
  }
  .toast {
    min-width: 0; max-width: 100%; width: 100%;
    font-size: .84rem; padding: 11px 14px;
  }
  @keyframes toastIn  { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
  @keyframes toastOut { from { opacity:1; transform:translateY(0); } to { opacity:0; transform:translateY(12px); } }
}

/* ── ANIMATIONS ───────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(242,228,0,.15); }
  50%       { box-shadow: 0 0 40px rgba(242,228,0,.35); }
}

.anim-fade-up   { animation: fadeInUp .5s ease both; }
.anim-fade      { animation: fadeIn   .4s ease both; }
.anim-scale-in  { animation: scaleIn  .35s ease both; }

/* Staggered delays */
.delay-1 { animation-delay: .1s; }
.delay-2 { animation-delay: .2s; }
.delay-3 { animation-delay: .3s; }
.delay-4 { animation-delay: .4s; }
.delay-5 { animation-delay: .5s; }

/* ── PROGRESS BAR ─────────────────────────────────────────── */
.progress-bar-wrap {
  width: 100%; height: 6px;
  background: var(--dark-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: var(--radius-full);
  transition: width .6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── AVATAR ───────────────────────────────────────────────── */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
  flex-shrink: 0;
  background: var(--dark-3);
  color: var(--accent);
  border: 2px solid var(--dark-border);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: .78rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.5rem; }
