/* RobertsFurz — Shared component & utility styles */

/* ─────────────────────────────────────────────────────────
   Buttons
───────────────────────────────────────────────────────────*/
.btn {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  height: 42px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease),
              background var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
  user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary {
  background: var(--accent-grad);
  color: var(--on-accent);
  box-shadow: var(--glow-accent);
}
.btn-primary:hover { box-shadow: var(--glow-accent-strong); filter: brightness(1.04); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-elevated); }

.btn-soft {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}
.btn-soft:hover { border-color: var(--border-strong); background: var(--bg-hover); }

.btn-danger {
  background: var(--danger-soft);
  color: #ff6b6b;
  border-color: var(--danger-line);
}
.btn-danger:hover { background: rgba(239,68,68,0.18); }

.btn-lg { height: 52px; font-size: var(--fs-lg); padding: 0 26px; border-radius: var(--r-lg); }
.btn-xl { height: 60px; font-size: 19px; padding: 0 40px; border-radius: var(--r-lg); font-weight: 700; }
.btn-sm { height: 34px; font-size: var(--fs-sm); padding: 0 13px; border-radius: var(--r-sm); }
.btn-icon { width: 42px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Play button — the hero CTA, glowing */
.btn-play {
  height: 60px;
  padding: 0 44px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--r-lg);
  background: var(--accent-grad);
  color: var(--on-accent);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--glow-accent-strong), inset 0 1px 0 rgba(255,255,255,0.25);
  position: relative;
  transition: transform var(--dur-fast) var(--ease), filter var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn-play::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: inherit;
  background: var(--accent-glow);
  filter: blur(20px);
  opacity: 0.55; z-index: -1;
  animation: playpulse 2.6s var(--ease) infinite;
}
@keyframes playpulse { 0%,100%{opacity:.45;} 50%{opacity:.8;} }
.btn-play:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-play:active { transform: translateY(1px); }
.btn-play svg { width: 22px; height: 22px; }
@media (prefers-reduced-motion: reduce) { .btn-play::after, .btn-play { animation: none; } }

/* ─────────────────────────────────────────────────────────
   Chips / Tags
───────────────────────────────────────────────────────────*/
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: var(--fs-sm);
  font-weight: 550;
  white-space: nowrap;
}
.chip svg { width: 14px; height: 14px; opacity: 0.8; }
.chip strong { color: var(--text); font-weight: 650; }
.chip-accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.chip-accent strong { color: var(--accent-2); }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  border-radius: var(--r-xs);
  font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.02em;
}
.tag-required { background: var(--accent-soft); color: var(--accent-2); border: 1px solid var(--accent-line); }
.tag-optional { background: var(--bg-elevated); color: var(--text-dim); border: 1px solid var(--border); }
.tag-neutral  { background: var(--bg-elevated); color: var(--text-dim); border: 1px solid var(--border); }

/* ─────────────────────────────────────────────────────────
   Status indicators
───────────────────────────────────────────────────────────*/
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-dim);
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; position: relative; }
.dot-online { background: var(--online); box-shadow: 0 0 0 0 rgba(52,208,88,0.6); animation: livepulse 2.2s ease-out infinite; }
.dot-offline { background: var(--offline); }
@keyframes livepulse {
  0% { box-shadow: 0 0 0 0 rgba(52,208,88,0.55); }
  70% { box-shadow: 0 0 0 7px rgba(52,208,88,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,208,88,0); }
}
@media (prefers-reduced-motion: reduce){ .dot-online { animation: none; } }
.status-online { color: var(--online); }

/* ─────────────────────────────────────────────────────────
   Cards
───────────────────────────────────────────────────────────*/
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }

/* ─────────────────────────────────────────────────────────
   Toggle switch
───────────────────────────────────────────────────────────*/
.toggle {
  --w: 42px; --h: 24px;
  position: relative; width: var(--w); height: var(--h);
  border-radius: var(--r-pill);
  background: var(--border-strong);
  border: none; cursor: pointer; flex: none;
  transition: background var(--dur) var(--ease);
  padding: 0;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease-out);
}
.toggle[data-on="true"] { background: var(--accent-grad); box-shadow: 0 0 12px rgba(34,197,94,0.4); }
.toggle[data-on="true"]::after { transform: translateX(18px); }
.toggle:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─────────────────────────────────────────────────────────
   Slider
───────────────────────────────────────────────────────────*/
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px;
  background: var(--border-strong);
  outline: none; cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 4px rgba(34,197,94,0.14);
  cursor: grab;
}
.slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent);
  cursor: grab;
}

/* ─────────────────────────────────────────────────────────
   Progress bar
───────────────────────────────────────────────────────────*/
.progress {
  height: 8px; width: 100%;
  border-radius: 999px;
  background: var(--bg-base);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 999px;
  background: var(--accent-grad);
  box-shadow: 0 0 14px rgba(34,197,94,0.5);
  transition: width var(--dur) var(--ease);
  position: relative; overflow: hidden;
}
.progress-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.35) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.progress-indeterminate .progress-fill { width: 35% !important; animation: indeter 1.4s var(--ease) infinite; }
@keyframes indeter { 0%{margin-left:-35%;} 100%{margin-left:100%;} }
@media (prefers-reduced-motion: reduce){ .progress-fill::after { animation: none; } }

/* ─────────────────────────────────────────────────────────
   Striped image placeholder
───────────────────────────────────────────────────────────*/
.ph {
  position: relative;
  background:
    repeating-linear-gradient(135deg,
      rgba(255,255,255,0.018) 0 14px,
      rgba(255,255,255,0.045) 14px 28px),
    var(--ph-tint, linear-gradient(160deg, #1b2430, #131922));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  color: var(--text-muted);
}
.ph-label {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.46);
  background: rgba(0,0,0,0.32);
  border: 1px solid rgba(255,255,255,0.10);
  padding: 5px 10px; border-radius: 6px;
  backdrop-filter: blur(2px);
  text-align: center; max-width: 86%;
}

/* ─────────────────────────────────────────────────────────
   Pixel avatar (procedural Minecraft-style head)
───────────────────────────────────────────────────────────*/
.avatar {
  display: inline-block; flex: none;
  border-radius: 5px;
  image-rendering: pixelated;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  overflow: hidden;
}
.avatar-ring { box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 3px var(--border-strong); }

/* ─────────────────────────────────────────────────────────
   Toasts
───────────────────────────────────────────────────────────*/
.toast-layer {
  position: fixed; right: 18px; bottom: 18px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9000; pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 280px; max-width: 360px;
  display: flex; align-items: center; gap: 13px;
  padding: 13px 15px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  animation: toastin var(--dur-slow) var(--ease-out);
}
@keyframes toastin { from { opacity: 0; transform: translateX(20px) translateY(4px); } }
.toast-leaving { animation: toastout var(--dur) var(--ease) forwards; }
@keyframes toastout { to { opacity: 0; transform: translateX(20px); } }
.toast-icon {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2);
}
.toast-icon svg { width: 19px; height: 19px; }
.toast-icon.is-error { background: var(--danger-soft); color: #ff6b6b; }
.toast-icon.is-thumb { padding: 0; overflow: hidden; background: var(--bg-base); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: var(--fs-sm); font-weight: 700; color: var(--text); }
.toast-sub { font-size: var(--fs-xs); color: var(--text-dim); margin-top: 1px; }

/* ─────────────────────────────────────────────────────────
   Modal / overlay
───────────────────────────────────────────────────────────*/
.scrim {
  position: absolute; inset: 0;
  background: var(--bg-scrim);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  z-index: 200;
  animation: fade var(--dur) var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: min(540px, 92%);
  max-height: 88%;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalin var(--dur-slow) var(--ease-out);
}
@keyframes modalin { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-title { font-size: var(--fs-h3); font-weight: 750; letter-spacing: -0.01em; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  padding: 16px 22px; border-top: 1px solid var(--border-soft);
  background: var(--bg-base);
}

/* ─────────────────────────────────────────────────────────
   Utility
───────────────────────────────────────────────────────────*/
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.spacer { flex: 1; }
.muted { color: var(--text-dim); }
.dim { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.eyebrow {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent-2);
}
.divider { height: 1px; background: var(--border-soft); border: none; margin: 0; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: transparent; border: 1px solid transparent;
  color: var(--text-dim); cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--bg-elevated); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }

.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-up { animation: fadeUp var(--dur-slow) var(--ease-out) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

/* ─────────────────────────────────────────────────────────
   Form controls (shared)
───────────────────────────────────────────────────────────*/
.input, .select, .textarea {
  height: 44px; padding: 0 14px; border-radius: var(--r-md);
  background: var(--bg-base); border: 1px solid var(--border); color: var(--text);
  font-family: var(--font-sans); font-size: 14.5px; outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.textarea { height: auto; padding: 12px 14px; resize: vertical; min-height: 90px; line-height: var(--lh-base); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa7b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px;
}
.search-box {
  display: flex; align-items: center; gap: 9px;
  height: 42px; padding: 0 14px; min-width: 200px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.search-box svg { width: 17px; height: 17px; color: var(--text-muted); flex: none; }
.search-box input {
  background: none; border: none; outline: none; color: var(--text);
  font-family: var(--font-sans); font-size: 14.5px; width: 100%;
}
