/* ============================================================
   Components — buttons, cards, nav, badges, inputs, tabs, etc.
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 0 var(--sp-5); height: 44px;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  border: 1px solid transparent; border-radius: var(--r-md);
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand-600); color: var(--text-invert); box-shadow: var(--sh-brand); }
.btn--primary:hover { background: var(--brand-700); }
.btn--ghost { background: transparent; color: var(--brand-700); border-color: var(--brand-200); }
.btn--ghost:hover { background: var(--brand-50); }
.btn--soft { background: var(--brand-50); color: var(--brand-700); }
.btn--soft:hover { background: var(--brand-100); }
.btn--neutral { background: var(--gray-100); color: var(--gray-700); }
.btn--neutral:hover { background: var(--gray-200); }
.btn--success { background: var(--success); color: #fff; }
.btn--sm { height: 36px; padding: 0 var(--sp-4); font-size: var(--fs-xs); }
.btn--lg { height: 52px; padding: 0 var(--sp-8); font-size: var(--fs-md); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--bg-surface); color: var(--gray-700);
  cursor: pointer; transition: all var(--t-fast);
}
.icon-btn:hover { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
.icon-btn.is-active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.icon-btn--sm { width: 36px; height: 36px; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.card--hover:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); border-color: var(--brand-200); }
.card__body { padding: var(--sp-6); }
.card__pad { padding: var(--sp-6); }

/* ---------- Badges / Tags ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 1.4;
}
.badge--brand { background: var(--brand-50); color: var(--brand-700); }
.badge--sky   { background: #e0f2fe; color: var(--sky-600); }
.badge--success { background: var(--success-soft); color: #047857; }
.badge--warning { background: var(--warning-soft); color: #b45309; }
.badge--danger  { background: var(--danger-soft); color: #b91c1c; }
.badge--neutral { background: var(--gray-100); color: var(--gray-600); }

.tag {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  background: var(--gray-100); color: var(--gray-600);
  border: 1px solid var(--border);
}

/* ---------- Progress ---------- */
.progress { width: 100%; height: 8px; background: var(--gray-200); border-radius: var(--r-full); overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-500), var(--sky-500)); border-radius: var(--r-full); transition: width var(--t-slow); }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.input, .textarea, .select {
  width: 100%; padding: var(--sp-3) var(--sp-4);
  font-family: inherit; font-size: var(--fs-base); color: var(--text-base);
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 4px var(--brand-100);
}
.textarea { resize: vertical; min-height: 140px; line-height: var(--lh-normal); }

/* ---------- Tabs (module nav) ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--gray-600);
  background: transparent; border: 1px solid transparent; cursor: pointer;
  transition: all var(--t-fast); white-space: nowrap;
}
.tab:hover { background: var(--gray-100); color: var(--gray-800); }
.tab.is-active { background: var(--brand-600); color: #fff; box-shadow: var(--sh-sm); }
.tab__num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: var(--r-full);
  background: var(--brand-100); color: var(--brand-700); font-size: var(--fs-xs);
}
.tab.is-active .tab__num { background: rgba(255,255,255,.25); color: #fff; }

/* ---------- Segmented control ---------- */
.segmented { display: inline-flex; background: var(--gray-100); border-radius: var(--r-md); padding: 4px; gap: 4px; }
.segmented button {
  border: none; background: transparent; padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  color: var(--gray-600); cursor: pointer; transition: all var(--t-fast);
}
.segmented button.is-active { background: var(--bg-surface); color: var(--brand-700); box-shadow: var(--sh-sm); }

/* ---------- Audio player (custom) ---------- */
.player {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); background: var(--gray-50);
  border: 1px solid var(--border); border-radius: var(--r-md);
}
.player__btn {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-full);
  background: var(--brand-600); color: #fff; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-brand); transition: transform var(--t-fast), background var(--t-fast);
}
.player__btn:hover { background: var(--brand-700); }
.player__btn:active { transform: scale(.94); }
.player__btn.is-playing { background: var(--success); box-shadow: 0 10px 24px rgba(16,185,129,.3); }
.player__wave { flex: 1; height: 36px; display: flex; align-items: center; gap: 3px; overflow: hidden; }
.player__wave span {
  flex: 1; min-width: 2px; max-width: 5px; background: var(--brand-200); border-radius: var(--r-full);
  transition: height var(--t-fast), background var(--t-fast);
}
.player.is-playing .player__wave span { background: var(--brand-400); animation: wave 1s ease-in-out infinite; }
.player__time { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }

@keyframes wave { 0%,100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--gray-900); color: #fff; padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md); font-size: var(--fs-sm); box-shadow: var(--sh-lg);
  opacity: 0; transform: translateY(10px); transition: all var(--t-base);
}
.toast.is-show { opacity: 1; transform: translateY(0); }
.toast--success { background: #047857; }
.toast--error { background: #b91c1c; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 900; padding: var(--sp-4);
}
.modal-backdrop.is-open { display: flex; }
.modal {
  background: var(--bg-surface); border-radius: var(--r-xl); max-width: 520px; width: 100%;
  box-shadow: var(--sh-xl); padding: var(--sp-8); animation: pop .24s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
