/* Reusable components */

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  user-select: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-hi); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn.primary {
  background: var(--grad-brand);
  border: none;
  color: #fff;
  font-weight: 600;
  box-shadow: var(--sh-glow);
}
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 0 60px rgba(236,72,153,0.5); }

.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface); }

.btn.danger { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.35); color: #fca5a5; }
.btn.danger:hover { background: rgba(239,68,68,0.2); }

.btn.sm { padding: 6px 12px; font-size: 0.78rem; }
.btn.lg { padding: 14px 24px; font-size: 1rem; }

.btn.icon { padding: 8px; aspect-ratio: 1; }

.btn.full { width: 100%; }

/* ─── Inputs ─── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.field .hint { font-size: 0.75rem; color: var(--text-dim); }

.input, .select, .textarea {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  background: rgba(0,0,0,0.45);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.18);
}
.textarea { resize: vertical; min-height: 70px; font-family: inherit; line-height: 1.5; }
.select { appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%238b92a8' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

/* ─── Cards / Panels ─── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--sh);
}
.panel.raised { background: var(--surface-raised); }
.panel.hi { background: var(--surface-hi); }

.card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-5);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }

/* ─── Chips / Tags ─── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}
.chip.brand { background: rgba(139,92,246,0.15); border-color: rgba(139,92,246,0.3); color: #c4b5fd; }
.chip.pink { background: rgba(236,72,153,0.15); border-color: rgba(236,72,153,0.3); color: #f9a8d4; }
.chip.amber { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.chip.success { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.chip.error { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); color: #fca5a5; }
.chip.cyan { background: rgba(34,211,238,0.15); border-color: rgba(34,211,238,0.3); color: #67e8f9; }

/* ─── Modal / Sheet ─── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-6);
  animation: fadeIn var(--dur) var(--ease-out);
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  max-width: 640px;
  width: 100%;
  max-height: 86vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--sh-lg);
}
.modal-header {
  padding: var(--s-5) var(--s-6);
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
}
.modal-body { padding: var(--s-6); overflow-y: auto; flex: 1; }
.modal-footer { padding: var(--s-5) var(--s-6); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--s-3); }

@media (max-width: 720px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-height: 90dvh;
  }
}

/* ─── Progress ─── */
.progress-track {
  height: 6px; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  position: relative;
}
.progress-bar {
  height: 100%;
  background: var(--grad-brand);
  border-radius: 999px;
  transition: width var(--dur-slow) var(--ease-out);
}

/* ─── Dropzone ─── */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: var(--s-8);
  text-align: center;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--brand);
  background: rgba(139,92,246,0.08);
}
.dropzone .dz-icon { font-size: 2.2rem; margin-bottom: var(--s-3); opacity: 0.7; }
.dropzone .dz-title { font-weight: 600; margin-bottom: 4px; }
.dropzone .dz-hint { font-size: 0.8rem; color: var(--text-muted); }

/* ─── Toast ─── */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 900;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 14px 18px;
  border-radius: var(--r);
  background: var(--surface-hi);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--sh-lg);
  min-width: 260px;
  max-width: 380px;
  animation: fadeIn var(--dur) var(--ease-out);
  font-size: 0.88rem;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--error); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }

@media (max-width: 720px) {
  .toast-container { right: 10px; left: 10px; top: 10px; }
  .toast { min-width: 0; max-width: 100%; }
}

/* ─── Switch ─── */
.switch {
  position: relative;
  display: inline-block;
  width: 40px; height: 22px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  transition: var(--dur);
  cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute;
  height: 16px; width: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  transition: var(--dur);
}
.switch input:checked + .slider { background: var(--grad-brand); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ─── Status Dot ─── */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.ok { background: var(--success); box-shadow: 0 0 10px var(--success); }
.status-dot.warn { background: var(--warning); }
.status-dot.err { background: var(--error); }
.status-dot.idle { background: var(--text-dim); }
.status-dot.run { background: var(--brand); animation: pulse-glow 1.6s infinite; }
