/* ============================================================
   HEARTH — COMPONENT STYLES
   Classes consumed by the React primitives. Prefixed `hth-`.
   All visuals derive from tokens. Real hover/focus/active states.
   ============================================================ */

/* ---------------- Button ---------------- */
.hth-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-semibold);
  letter-spacing: -0.005em; line-height: 1;
  border-radius: var(--radius-md); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--dur-fast) var(--ease-soft),
              color var(--dur-fast) var(--ease-soft),
              border-color var(--dur-fast) var(--ease-soft),
              box-shadow var(--dur-fast) var(--ease-soft),
              transform var(--dur-fast) var(--ease-soft);
  user-select: none;
}
.hth-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.hth-btn:active { transform: scale(0.975); }
.hth-btn[disabled], .hth-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.hth-btn svg { width: 18px; height: 18px; flex: none; }

.hth-btn--sm { height: 36px; padding: 0 14px; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.hth-btn--sm svg { width: 16px; height: 16px; }
.hth-btn--lg { height: 52px; padding: 0 26px; font-size: var(--text-md); border-radius: var(--radius-lg); }
.hth-btn--block { width: 100%; }

.hth-btn--primary { background: var(--primary); color: var(--primary-text); box-shadow: var(--shadow-sm); }
.hth-btn--primary:hover { background: var(--primary-hover); box-shadow: var(--shadow-md); }
.hth-btn--primary:active { background: var(--primary-press); }

.hth-btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.hth-btn--secondary:hover { background: var(--surface-2); border-color: var(--slate-300); }

.hth-btn--accent { background: var(--accent); color: var(--text-on-accent); box-shadow: var(--shadow-sm); }
.hth-btn--accent:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.hth-btn--accent:active { background: var(--accent-press); }

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

.hth-btn--text { background: transparent; color: var(--accent); padding-left: 6px; padding-right: 6px; height: auto; }
.hth-btn--text:hover { color: var(--accent-hover); text-decoration: none; background: transparent; }
.hth-btn--text:active { transform: none; }

/* ---------------- Icon button ---------------- */
.hth-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none;
  border-radius: var(--radius-md); border: 1px solid transparent;
  background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-soft), color var(--dur-fast) var(--ease-soft),
              border-color var(--dur-fast) var(--ease-soft), transform var(--dur-fast) var(--ease-soft);
}
.hth-iconbtn:hover { background: var(--surface-2); color: var(--text); }
.hth-iconbtn:active { transform: scale(0.94); }
.hth-iconbtn:focus-visible { outline: none; box-shadow: var(--ring); }
.hth-iconbtn svg { width: 20px; height: 20px; }
.hth-iconbtn--sm { width: 36px; height: 36px; border-radius: var(--radius-sm); }
.hth-iconbtn--sm svg { width: 18px; height: 18px; }
.hth-iconbtn--solid { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-xs); }
.hth-iconbtn--solid:hover { background: var(--surface-2); }

/* ---------------- Badge ---------------- */
.hth-badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-family: var(--font-sans); font-size: var(--text-xs); font-weight: var(--weight-semibold);
  letter-spacing: 0.01em; line-height: 1.4;
}
.hth-badge svg { width: 13px; height: 13px; }
.hth-badge .hth-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.hth-badge--neutral { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }
.hth-badge--accent  { background: var(--accent-soft); color: var(--accent-press); }
.hth-badge--warm    { background: var(--warm-soft); color: var(--bronze); }
.hth-badge--sage    { background: var(--sage-soft); color: var(--sage); }
.hth-badge--success { background: var(--sage-soft); color: var(--success); }
.hth-badge--danger  { background: var(--danger-soft); color: var(--danger); }

/* ---------------- Tag (removable chip) ---------------- */
.hth-tag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: var(--radius-full);
  background: var(--surface); border: 1px solid var(--border-strong);
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text);
  transition: background var(--dur-fast) var(--ease-soft), border-color var(--dur-fast) var(--ease-soft);
}
.hth-tag[data-selected="true"] { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-press); }
.hth-tag button { display: inline-flex; border: 0; background: none; padding: 0; cursor: pointer; color: var(--text-muted); }
.hth-tag button:hover { color: var(--text); }
.hth-tag svg { width: 14px; height: 14px; }

/* ---------------- Avatar ---------------- */
.hth-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 40px; height: 40px; border-radius: var(--radius-full);
  background: var(--accent-soft); color: var(--accent-press);
  font-family: var(--font-sans); font-weight: var(--weight-semibold); font-size: var(--text-sm);
  overflow: hidden; border: 1px solid rgba(0,0,0,0.04); object-fit: cover;
}
.hth-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hth-avatar--sm { width: 30px; height: 30px; font-size: var(--text-xs); }
.hth-avatar--lg { width: 56px; height: 56px; font-size: var(--text-md); }
.hth-avatar--warm { background: var(--warm-soft); color: var(--bronze); }
.hth-avatar--sage { background: var(--sage-soft); color: var(--sage); }

/* ---------------- Card ---------------- */
.hth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.hth-card--flat { box-shadow: none; }
.hth-card--panel { background: var(--surface-2); box-shadow: none; }
.hth-card--glass { background: var(--surface-glass); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); border-color: rgba(255,255,255,0.4); }
.hth-card--pad { padding: var(--space-6); }
.hth-card--interactive { cursor: pointer; transition: transform var(--dur-base) var(--ease-soft), box-shadow var(--dur-base) var(--ease-soft), border-color var(--dur-base) var(--ease-soft); }
.hth-card--interactive:hover { transform: var(--lift); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }

/* ---------------- Field / Label ---------------- */
.hth-field { display: flex; flex-direction: column; gap: 7px; }
.hth-label { font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text); }
.hth-label .hth-req { color: var(--danger); margin-left: 2px; }
.hth-hint { font-size: var(--text-xs); color: var(--text-muted); }
.hth-error { font-size: var(--text-xs); color: var(--danger); }

/* ---------------- Input / Textarea / Select ---------------- */
.hth-input, .hth-textarea, .hth-select {
  width: 100%; font-family: var(--font-sans); font-size: var(--text-base); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); padding: 0 14px; height: 46px;
  transition: border-color var(--dur-fast) var(--ease-soft), box-shadow var(--dur-fast) var(--ease-soft), background var(--dur-fast) var(--ease-soft);
}
.hth-input::placeholder, .hth-textarea::placeholder { color: var(--text-muted); }
.hth-input:hover, .hth-textarea:hover, .hth-select:hover { border-color: var(--slate-400); }
.hth-input:focus, .hth-textarea:focus, .hth-select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.hth-input[aria-invalid="true"] { border-color: var(--danger); }
.hth-textarea { height: auto; padding: 12px 14px; line-height: 1.55; resize: vertical; min-height: 96px; }
.hth-select { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23647585' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.hth-input-wrap { position: relative; display: flex; align-items: center; }
.hth-input-wrap .hth-input { padding-left: 42px; }
.hth-input-icon { position: absolute; left: 14px; color: var(--text-muted); display: flex; pointer-events: none; }
.hth-input-icon svg { width: 18px; height: 18px; }

/* ---------------- Checkbox / Radio ---------------- */
.hth-check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: var(--text-base); color: var(--text); }
.hth-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.hth-check .hth-box {
  width: 20px; height: 20px; flex: none; margin-top: 1px; border-radius: 6px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; color: transparent;
  transition: all var(--dur-fast) var(--ease-soft);
}
.hth-check .hth-box.hth-radio { border-radius: 999px; }
.hth-check input:checked + .hth-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.hth-check input:focus-visible + .hth-box { box-shadow: var(--ring); }
.hth-check .hth-box svg { width: 14px; height: 14px; }
.hth-check .hth-radio-dot { width: 8px; height: 8px; border-radius: 999px; background: #fff; opacity: 0; transition: opacity var(--dur-fast); }
.hth-check input:checked + .hth-radio .hth-radio-dot { opacity: 1; }

/* ---------------- Switch ---------------- */
.hth-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.hth-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.hth-switch .hth-track {
  width: 44px; height: 26px; border-radius: 999px; background: var(--slate-300);
  padding: 3px; transition: background var(--dur-base) var(--ease-soft); flex: none;
}
.hth-switch .hth-thumb { width: 20px; height: 20px; border-radius: 999px; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-base) var(--ease-soft); }
.hth-switch input:checked + .hth-track { background: var(--accent); }
.hth-switch input:checked + .hth-track .hth-thumb { transform: translateX(18px); }
.hth-switch input:focus-visible + .hth-track { box-shadow: var(--ring); }

/* ---------------- Tabs ---------------- */
.hth-tabs { display: inline-flex; gap: 2px; padding: 4px; background: var(--surface-inset); border-radius: var(--radius-md); }
.hth-tab { border: 0; background: transparent; cursor: pointer; padding: 8px 16px; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary);
  transition: background var(--dur-fast) var(--ease-soft), color var(--dur-fast) var(--ease-soft); }
.hth-tab:hover { color: var(--text); }
.hth-tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); font-weight: var(--weight-semibold); }
.hth-tabs--underline { background: transparent; padding: 0; gap: 26px; border-bottom: 1px solid var(--border); border-radius: 0; }
.hth-tabs--underline .hth-tab { border-radius: 0; padding: 12px 0; box-shadow: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.hth-tabs--underline .hth-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); background: none; }

/* ---------------- Tooltip ---------------- */
.hth-tooltip-wrap { position: relative; display: inline-flex; }
.hth-tooltip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  background: var(--ink); color: var(--cream-50); font-size: var(--text-xs); font-weight: var(--weight-medium);
  padding: 7px 11px; border-radius: var(--radius-sm); white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-md); z-index: 50;
}
.hth-tooltip-wrap:hover .hth-tooltip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- Toast ---------------- */
.hth-toast {
  display: flex; align-items: flex-start; gap: 12px; width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 14px 16px;
}
.hth-toast .hth-toast-icon { display: flex; flex: none; margin-top: 1px; }
.hth-toast .hth-toast-icon svg { width: 20px; height: 20px; }
.hth-toast--success .hth-toast-icon { color: var(--success); }
.hth-toast--danger .hth-toast-icon { color: var(--danger); }
.hth-toast--accent .hth-toast-icon { color: var(--accent); }
.hth-toast-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text); }
.hth-toast-body { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; line-height: 1.45; }

/* ---------------- Navbar ---------------- */
.hth-navbar {
  display: flex; align-items: center; gap: 28px; width: 100%;
  padding: 14px 24px; background: var(--surface-glass); backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur)); border-bottom: 1px solid var(--border);
}
.hth-navbar .hth-brand { display: flex; align-items: center; gap: 10px; font-weight: var(--weight-bold); font-size: var(--text-lg); letter-spacing: -0.02em; color: var(--text); }
.hth-navbar .hth-brand svg { width: 26px; height: 26px; color: var(--primary); }
.hth-navbar .hth-navlinks { display: flex; gap: 4px; }
.hth-navbar .hth-navlink { padding: 8px 14px; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary); cursor: pointer; transition: background var(--dur-fast), color var(--dur-fast); }
.hth-navbar .hth-navlink:hover { background: var(--surface-2); color: var(--text); }
.hth-navbar .hth-navlink[aria-current="page"] { color: var(--text); font-weight: var(--weight-semibold); }
