/* ═══════════════════════════════════════════════
   WORKOUTPAL — components.css
   Reusable UI components
   ═══════════════════════════════════════════════ */

/* ── Buttons ─────────────────────────────────────────────── */

/* Base button (min 56px height for sport use) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 56px;
  padding: 0 var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  transition:
    background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.btn:active {
  transform: scale(0.96);
}

/* Primary (accent) */
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
  width: 100%;
}
.btn-primary:active {
  background: var(--accent-hover);
  box-shadow: none;
}

/* Secondary (outlined) */
.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1.5px solid var(--border-strong);
  width: 100%;
}
.btn-secondary:active {
  background: var(--surface-2);
}

/* Ghost (transparent) */
.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 0 var(--space-4);
}
.btn-ghost:active {
  background: var(--accent-muted);
}

/* Icon button (square) */
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
  touch-action: manipulation;
  cursor: pointer;
}
.btn-icon:active {
  transform: scale(0.90);
  background: var(--border);
}
.btn-icon.accent {
  background: var(--accent-muted);
  color: var(--accent);
}

/* Small button */
.btn-sm {
  height: 40px;
  font-size: 14px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
}

/* Danger */
.btn-danger {
  background: var(--danger);
  color: #fff;
  width: 100%;
}

/* Disabled state */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.40;
  pointer-events: none;
}

/* Full width utility */
.btn-full { width: 100%; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.card-accent {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-accent);
}

.card-subtle {
  background: var(--surface-2);
  border-color: transparent;
  box-shadow: none;
}

.card + .card {
  margin-top: var(--space-3);
}

.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 1.1;
  margin-bottom: var(--space-2);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.card-accent .card-subtitle {
  color: rgba(255,255,255,0.75);
}

/* Tappable card */
.card-tappable {
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
  touch-action: manipulation;
}
.card-tappable:active {
  transform: scale(0.98);
  box-shadow: none;
}

/* ── Stat Block ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.stat-block {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.5px;
  line-height: 1;
  color: var(--text-primary);
}

.stat-value.accent { color: var(--accent); }

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ── Badge / Tag ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-accent {
  background: var(--accent-muted);
  color: var(--accent);
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-neutral {
  background: var(--surface-2);
  color: var(--text-secondary);
}

/* Tags (pills) */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background var(--dur-fast),
    border-color var(--dur-fast),
    color var(--dur-fast);
  touch-action: manipulation;
}

.tag.selected,
.tag:active {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

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

.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
}
.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider-label span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

/* ── List rows (settings-style) ──────────────────────────── */
.list-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity var(--dur-fast);
  touch-action: manipulation;
}
.list-row:last-child { border-bottom: none; }
.list-row:active { opacity: 0.6; }

.list-row-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-muted);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.list-row-content {
  flex: 1;
  min-width: 0;
}

.list-row-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.list-row-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.list-row-chevron {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ── Progress bar ────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--dur-slow) var(--ease-out);
}

/* ── Skeleton loading ────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--border) 50%,
    var(--surface-2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Toast notification ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--nav-safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--text-primary);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--dur-mid) var(--ease-out),
    transform var(--dur-mid) var(--ease-out);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger);  }
.toast.accent  { background: var(--accent);  }
