/* ═══════════════════════════════════════
   COMPONENTS.CSS — Reusable UI pieces
   ═══════════════════════════════════════ */

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--r-full);
  border: none;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .3px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--dur-fast);
}
.btn:hover::after  { background: rgba(255,255,255,0.06); }
.btn:active        { transform: scale(0.96); }
.btn:disabled      { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--violet), #9B5CFF);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124,111,255,0.4);
  width: 100%;
}
.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(124,111,255,0.55);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--emerald), #00B87A);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,214,143,0.35);
  width: 100%;
}

.btn-ghost {
  background: var(--bg3);
  border: 1.5px solid var(--border2);
  color: var(--text2);
  width: 100%;
}
.btn-ghost:hover { border-color: var(--border3); color: var(--text); }

.btn-danger {
  background: var(--danger-dim);
  border: 1.5px solid var(--danger);
  color: var(--danger);
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: .8rem;
  border-radius: var(--r-full);
}

/* Loading state */
.btn .btn-spinner {
  width: 17px; height: 17px;
  border: 2.5px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: none;
  flex-shrink: 0;
}
.btn.loading .btn-spinner { display: block; }
.btn.loading .btn-text    { opacity: 0.7; }

/* ── INPUTS ── */
.input-group { margin-bottom: 18px; }

.input-label {
  display: block;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}

.input {
  width: 100%;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .95rem;
  outline: none;
  transition: border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              background var(--dur);
  -webkit-appearance: none;
}
.input:focus {
  border-color: var(--violet);
  background: var(--bg4);
  box-shadow: 0 0 0 4px rgba(124,111,255,0.12);
}
.input::placeholder { color: var(--text3); }
.input.error  { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(255,92,122,0.1); }
.input.success{ border-color: var(--emerald); box-shadow: 0 0 0 4px rgba(0,214,143,0.1); }

/* Input with icon */
.input-wrap { position: relative; }
.input-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
}
.input-wrap .input { padding-left: 42px; }

/* ── CARDS ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  transition: border-color var(--dur), transform var(--dur) var(--ease);
}
.card:hover { border-color: var(--border2); }

.card-pressable {
  cursor: pointer;
}
.card-pressable:active { transform: scale(0.98); }

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .5px;
}
.badge-violet  { background: var(--violet-dim);  color: var(--violet2); }
.badge-emerald { background: var(--emerald-dim); color: var(--emerald2); }
.badge-amber   { background: var(--amber-dim);   color: var(--amber2); }
.badge-sky     { background: var(--sky-dim);     color: var(--sky2); }
.badge-rose    { background: var(--rose-dim);    color: var(--rose2); }
.badge-coral   { background: var(--coral-dim);   color: var(--coral); }

/* ── PROGRESS BAR ── */
.progress-wrap {
  height: 5px;
  background: var(--bg4);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--violet), var(--emerald));
  transition: width 0.5s var(--ease-out);
  position: relative;
  overflow: hidden;
}
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}
@keyframes shimmer {
  to { left: 200%; }
}

/* Thin variant */
.progress-wrap.thin { height: 3px; }

/* ── SECTION LABEL ── */
.section-label {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg3);
  border: 1px solid var(--border2);
  padding: 10px 20px;
  border-radius: var(--r-full);
  font-size: .82rem;
  font-weight: 600;
  z-index: 99999;
  opacity: 0;
  transition: all var(--dur) var(--ease-spring);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 40px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: var(--emerald); color: var(--emerald2); }
.toast.error   { border-color: var(--danger);  color: var(--rose2); }

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.empty-state .empty-text { font-size: .88rem; }

/* ── WORD ARTICLE PILL ── */
.art-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 600;
  flex-shrink: 0;
}
.art-pill.der  { background: rgba(56,196,245,0.12);  color: var(--sky2); }
.art-pill.die  { background: rgba(255,107,138,0.12); color: var(--rose2); }
.art-pill.das  { background: rgba(255,184,48,0.12);  color: var(--amber2); }
.art-pill.verb { background: var(--emerald-dim);     color: var(--emerald2); }
.art-pill.adj  { background: var(--violet-dim);      color: var(--violet2); }

/* ── STAT BOX ── */
.stat-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 10px;
  text-align: center;
}
.stat-num {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  display: block;
  line-height: 1;
  margin-bottom: 5px;
}
.stat-lbl {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text3);
}
