/* ============================================================
   SmartRepost — Component primitives
   Depends on tokens.css
   ============================================================ */

/* ---------------- Button ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  user-select: none;
}
.btn:active { transform: translateY(0.5px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn .ic { width: 1.05em; height: 1.05em; }

/* sizes */
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-md { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 16px; border-radius: var(--r-lg); }

/* variants */
.btn-primary   { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn-primary:hover   { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active  { background: var(--accent-active); }

.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-3); border-color: var(--text-subtle); }

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

.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.08); }

.btn-block { width: 100%; }

/* loading */
.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin 0.6s linear infinite; color: var(--accent-contrast);
}
.btn-secondary.btn-loading::after, .btn-ghost.btn-loading::after { color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Input ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.input {
  height: 40px; width: 100%;
  padding: 0 12px;
  font-family: var(--font-sans); font-size: 14px;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.input::placeholder { color: var(--text-subtle); }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }
.input.is-error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.field-error { font-size: 12px; color: var(--danger); }
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }

/* ---------------- Card ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--sp-6); }
.card-hover { transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.card-hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

/* ---------------- Badge ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px;
  font-size: 12px; font-weight: 600; line-height: 1;
  border-radius: var(--r-full);
  border: 1px solid transparent;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-neutral { background: var(--surface-3); color: var(--text-muted); border-color: var(--border); }
.badge-brand   { background: var(--accent-soft); color: var(--accent); }
.badge-info    { background: var(--info-soft); color: var(--info); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }

/* ---------------- Toggle ---------------- */
.toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
  width: 40px; height: 23px; border-radius: var(--r-full);
  background: var(--surface-3); border: 1px solid var(--border-strong);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.toggle .thumb {
  position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; border-radius: 50%; background: var(--text-subtle);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.toggle input:checked + .track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .track + .thumb { transform: translateY(-50%) translateX(17px); background: #fff; }

/* ---------------- Spinner ---------------- */
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.6s linear infinite;
}

/* ---------------- Empty state ---------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--sp-3); padding: var(--sp-12) var(--sp-6);
}
.empty .empty-ic {
  display: grid; place-items: center; width: 52px; height: 52px;
  border-radius: var(--r-lg); background: var(--surface-3); color: var(--text-subtle);
  border: 1px solid var(--border);
}
.empty h4 { margin: 0; font-size: 16px; font-weight: 600; }
.empty p { margin: 0; max-width: 320px; font-size: 14px; color: var(--text-muted); }

/* ---------------- Price w/ promo ---------------- */
.price { display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price .now { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; font-family: var(--font-sans); }
.price .per { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.price .was { font-size: 15px; color: var(--text-subtle); text-decoration: line-through; }
.promo-badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 9px; font-size: 11.5px; font-weight: 700;
  border-radius: var(--r-full); color: var(--accent); background: var(--accent-soft);
}

/* ---------------- Wallet pill ---------------- */
.wallet-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-full);
  cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.wallet-pill:hover { border-color: var(--border-strong); background: var(--surface-3); }
.wallet-pill .ic { width: 15px; height: 15px; color: var(--accent); }

/* ---------------- Toast ---------------- */
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  width: 340px; padding: 13px 14px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.toast .toast-ic { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-title { font-size: 14px; font-weight: 600; margin: 0 0 1px; }
.toast .toast-msg { font-size: 13px; color: var(--text-muted); margin: 0; }
.toast-success .toast-ic { color: var(--success); }
.toast-error   .toast-ic { color: var(--danger); }
.toast-info    .toast-ic { color: var(--info); }

/* ---------------- Modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay);
  display: grid; place-items: center; padding: 20px; z-index: 50;
  backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 440px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); background: var(--bg-subtle); }

/* ---------------- Icon button ---------------- */
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: var(--r-md); border: 1px solid transparent;
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .ic { width: 18px; height: 18px; }

/* ---------------- Brand logo mark (split-disc) ---------------- */
.logo-mark-svg { width: 100%; height: 100%; display: block; color: var(--text); }
.logo-arc-a { stroke: var(--accent); }        /* accent arc (top) */
.logo-arc-b { stroke: var(--text-subtle); }   /* theme-adaptive gray arc (bottom) */
