/* ─────────────────────────────────────────────────────────────────────────
   VINAR Life OS — Component Library
   Requires: tokens.css
   ───────────────────────────────────────────────────────────────────────── */

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  transition: border-color var(--ease), background var(--ease);
}

.card-sm { padding: var(--sp-3); border-radius: var(--r-sm); }
.card-lg { padding: var(--sp-5); border-radius: var(--r-lg); }

.card-hover:hover {
  border-color: var(--border-md);
  background: var(--s2);
  cursor: pointer;
}

.card-teal  { border-color: rgba(15, 212, 160, 0.25); background: var(--teal-dim); }
.card-violet{ border-color: rgba(123, 97, 255, 0.25); background: var(--violet-dim); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-5);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--ease);
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--teal);
  color: #0B1520;
  box-shadow: 0 0 16px rgba(15, 212, 160, 0.3);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 24px rgba(15, 212, 160, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--violet);
  color: #fff;
  box-shadow: 0 0 16px rgba(123, 97, 255, 0.3);
}

.btn-secondary:hover:not(:disabled) {
  box-shadow: 0 0 24px rgba(123, 97, 255, 0.45);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-md);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--s2);
  color: var(--text-1);
  border-color: var(--border-md);
}

.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--r-xs); }
.btn-lg { padding: 14px var(--sp-6); font-size: 15px; }
.btn-full { width: 100%; }

/* ── Archetype badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-gold   { background: rgba(245,200,66,0.15);  color: #F5C842;  border: 1px solid rgba(245,200,66,0.3); }
.badge-red    { background: rgba(239,68,68,0.15);   color: #EF4444;  border: 1px solid rgba(239,68,68,0.3); }
.badge-green  { background: rgba(16,185,129,0.15);  color: #10B981;  border: 1px solid rgba(16,185,129,0.3); }
.badge-blue   { background: rgba(59,130,246,0.15);  color: #3B82F6;  border: 1px solid rgba(59,130,246,0.3); }
.badge-orange { background: rgba(249,115,22,0.15);  color: #F97316;  border: 1px solid rgba(249,115,22,0.3); }
.badge-purple { background: rgba(139,92,246,0.15);  color: #8B5CF6;  border: 1px solid rgba(139,92,246,0.3); }

/* ── Tags / chips ────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--s2);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.tag-teal   { background: var(--teal-dim);   color: var(--teal);   border-color: rgba(15,212,160,0.2); }
.tag-violet { background: var(--violet-dim); color: var(--violet); border-color: rgba(123,97,255,0.2); }
.tag-amber  { background: rgba(245,158,11,0.12); color: var(--amber); border-color: rgba(245,158,11,0.2); }

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

/* ── Skeleton loading ────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--s2) 25%,
    var(--s3) 50%,
    var(--s2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--r-md);
}

@keyframes shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Input ───────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  background: var(--s2);
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-1);
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
  box-sizing: border-box;
}

.input::placeholder { color: var(--text-3); }

.input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 212, 160, 0.12);
}

.input-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--sp-1);
  display: block;
}

/* ── Insight row ─────────────────────────────────────────────────────────── */
.insight-row {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  transition: border-color var(--ease);
}

.insight-row:hover { border-color: var(--border-md); }

/* ── Score ring helpers ──────────────────────────────────────────────────── */
.ring-track {
  fill: none;
  stroke: var(--s2);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 364.42;
  stroke-dashoffset: 364.42;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1),
              stroke 0.4s ease;
}

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

.progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: var(--r-full);
  transition: width 0.6s ease;
}

/* ── Toggle switch ───────────────────────────────────────────────────────── */
.toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--s3);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background var(--ease);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--text-2);
  border-radius: 50%;
  transition: transform var(--ease), background var(--ease);
}

.toggle input:checked + .toggle-slider { background: var(--teal-dim); border: 1px solid var(--teal); }
.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--teal);
}

/* ── Toast (XP notification) ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--nav-safe) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--s1);
  border: 1px solid var(--teal);
  border-radius: var(--r-full);
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
  box-shadow: var(--shadow-teal);
  z-index: 200;
  animation: toast-in 0.3s ease forwards;
  white-space: nowrap;
}

.toast.toast-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

/* ── Page fade-in ────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--text-3);
}

.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: var(--sp-3);
  opacity: 0.5;
}

.empty-state p { font-size: 13px; line-height: 1.6; }

/* ── Row list item ───────────────────────────────────────────────────────── */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--sp-4);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--ease);
  text-decoration: none;
  color: inherit;
}

.list-row:hover { background: var(--s2); }
.list-row:last-child { border-bottom: none; }

.list-row-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* ── Sparkline bar ───────────────────────────────────────────────────────── */
.sbar {
  flex: 1;
  min-width: 6px;
  max-width: 12px;
  border-radius: 3px 3px 0 0;
  transition: height 0.4s ease;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.sr-only  { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.w-full { width: 100%; }
.text-center { text-align: center; }
