/* ═══════════════════════════════════════════════════════════════════
   ATOMS — Indivisible UI building blocks
   Buttons · Inputs · Badges · Chips · Avatars · Dots · Dividers · Tags
   ═══════════════════════════════════════════════════════════════════ */

/* ── BUTTON ─────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--navy-800);
  --btn-fg: var(--paper-0);
  --btn-bd: transparent;
  --btn-hover-bg: var(--navy-700);
  --btn-shadow: transparent;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 10px 16px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--w-semi);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--btn-hover-bg); transform: translateY(-1px); box-shadow: 0 6px 20px var(--btn-shadow); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn-sm { padding: 6px 12px; font-size: var(--text-sm); border-radius: var(--r-md); }
.btn-lg { padding: 13px 22px; font-size: var(--text-md); }
.btn-icon-only { padding: 9px; }
.btn-block { width: 100%; }

/* Variants */
.btn-primary  { --btn-bg: var(--navy-800); --btn-fg: var(--paper-0); --btn-hover-bg: var(--navy-700); --btn-shadow: rgba(13,21,38,0.16); }
.btn-secondary{ --btn-bg: transparent; --btn-fg: var(--fg); --btn-bd: var(--border); --btn-hover-bg: var(--surface-sunken); }
.btn-ghost    { --btn-bg: transparent; --btn-fg: var(--fg-muted); --btn-hover-bg: var(--surface-sunken); }

.btn-purple   { --btn-bg: var(--purple); --btn-fg: white; --btn-hover-bg: var(--purple-d); --btn-shadow: rgba(155,89,182,0.30); }
.btn-coral    { --btn-bg: var(--coral);  --btn-fg: white; --btn-hover-bg: var(--coral-d);  --btn-shadow: rgba(232,97,58,0.30); }
.btn-teal     { --btn-bg: var(--teal);   --btn-fg: white; --btn-hover-bg: var(--teal-d);   --btn-shadow: rgba(46,196,160,0.30); }
.btn-amber    { --btn-bg: var(--amber);  --btn-fg: white; --btn-hover-bg: var(--amber-d);  --btn-shadow: rgba(245,166,35,0.30); }
.btn-blue     { --btn-bg: var(--blue);   --btn-fg: white; --btn-hover-bg: var(--blue-d);   --btn-shadow: rgba(76,124,222,0.30); }

.btn-success  { --btn-bg: var(--green); --btn-fg: white; --btn-hover-bg: #1a8a59; --btn-shadow: rgba(34,168,110,0.30); }
.btn-danger   { --btn-bg: var(--red);   --btn-fg: white; --btn-hover-bg: #c63838; --btn-shadow: rgba(232,69,69,0.30); }

/* Google sign-in button */
.btn-google { --btn-bg: var(--paper-0); --btn-fg: var(--fg); --btn-bd: var(--border); --btn-hover-bg: var(--paper-50); }

/* ── INPUT ──────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--border);
  background: var(--surface-sunken);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--fg);
  outline: none;
  transition: border-color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast);
}
.input::placeholder { color: var(--fg-faint); }
.input:hover { border-color: var(--border-strong); }
.input:focus { border-color: var(--blue); background: var(--surface); box-shadow: var(--shadow-focus-blue); }
.input.error { border-color: var(--red); background: #fff8f8; }
.input.error:focus { box-shadow: 0 0 0 3px rgba(232,69,69,0.16); }
.input[readonly] { background: var(--surface-sunken); color: var(--fg-muted); cursor: default; }
.input-sm { padding: 7px 10px; font-size: var(--text-sm); border-radius: var(--r-md); }
.input-lg { padding: 14px 16px; font-size: var(--text-md); }

/* Input wrappers */
.input-wrap { position: relative; }
.input-icon-left  { padding-left: 36px; }
.input-icon-right { padding-right: 38px; }
.input-icon {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
  display: flex;
}
.input-icon.left  { left: 12px; }
.input-icon.right { right: 12px; }

.input-action {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-muted);
  transition: color var(--dur-fast), background var(--dur-fast);
}
.input-action:hover { color: var(--fg); background: var(--surface-sunken); }

/* ── CHECKBOX & TOGGLE ─────────────────────────────────────────── */
.checkbox {
  width: 18px; height: 18px;
  border-radius: var(--r-xs);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
  flex-shrink: 0;
}
.checkbox svg { opacity: 0; transition: opacity var(--dur-fast); color: white; }
.checkbox.checked, .checkbox[data-checked="true"] { background: var(--teal); border-color: var(--teal); }
.checkbox.checked svg, .checkbox[data-checked="true"] svg { opacity: 1; }

.toggle {
  position: relative;
  width: 36px; height: 20px;
  border-radius: var(--r-full);
  background: var(--paper-300);
  cursor: pointer;
  transition: background var(--dur-fast);
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  left: 2px; top: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform var(--dur-base) var(--ease-out);
}
.toggle.on { background: var(--teal); }
.toggle.on::after { transform: translateX(16px); }

/* ── BADGE ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: var(--text-2xs);
  font-weight: var(--w-bold);
  letter-spacing: 0.02em;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  white-space: nowrap;
}
.badge-purple { background: var(--purple-l); border-color: transparent; color: var(--purple-d); }
.badge-coral  { background: var(--coral-l);  border-color: transparent; color: var(--coral-d); }
.badge-teal   { background: var(--teal-l);   border-color: transparent; color: var(--teal-d); }
.badge-amber  { background: var(--amber-l);  border-color: transparent; color: var(--amber-d); }
.badge-blue   { background: var(--blue-l);   border-color: transparent; color: var(--blue-d); }
.badge-green  { background: var(--green-l);  border-color: transparent; color: var(--green); }
.badge-red    { background: var(--red-l);    border-color: transparent; color: var(--red); }
.badge-solid-navy  { background: var(--navy-800); border-color: transparent; color: white; }
.badge-count {
  min-width: 18px; height: 18px;
  padding: 0 6px;
  justify-content: center;
  font-size: var(--text-2xs);
  font-weight: var(--w-bold);
}

/* ── CHIP (interactive badge) ──────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 12px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  font-weight: var(--w-semi);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  user-select: none;
}
.chip:hover { border-color: var(--border-strong); color: var(--fg); }
.chip-active-purple { border-color: var(--purple); background: var(--purple-l); color: var(--purple); }
.chip-active-coral  { border-color: var(--coral);  background: var(--coral-l);  color: var(--coral-d); }
.chip-active-teal   { border-color: var(--teal);   background: var(--teal-l);   color: var(--teal-d); }
.chip-active-green  { border-color: var(--green);  background: var(--green-l);  color: var(--green); }
.chip-active-amber  { border-color: var(--amber);  background: var(--amber-l);  color: var(--amber-d); }
.chip-active-blue   { border-color: var(--blue);   background: var(--blue-l);   color: var(--blue-d); }

.chip-count {
  font-size: var(--text-2xs);
  font-weight: var(--w-bold);
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: var(--surface-sunken);
  color: var(--fg-muted);
}
.chip-active-purple .chip-count { background: rgba(155,89,182,0.18); color: var(--purple); }
.chip-active-coral  .chip-count { background: rgba(232,97,58,0.18);  color: var(--coral-d); }
.chip-active-teal   .chip-count { background: rgba(46,196,160,0.18); color: var(--teal-d); }
.chip-active-green  .chip-count { background: rgba(34,168,110,0.18); color: var(--green); }
.chip-active-amber  .chip-count { background: rgba(245,166,35,0.18); color: var(--amber-d); }

/* ── DOT (status indicator) ────────────────────────────────────── */
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-purple { background: var(--purple); }
.dot-coral  { background: var(--coral); }
.dot-teal   { background: var(--teal); }
.dot-amber  { background: var(--amber); }
.dot-blue   { background: var(--blue); }
.dot-green  { background: var(--green); }
.dot-red    { background: var(--red); }
.dot-muted  { background: var(--fg-faint); }
.dot-ring   { box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }
.dot-pulse  { animation: dotPulse 1.6s var(--ease-inout) infinite; }
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  50%      { box-shadow: 0 0 0 6px rgba(0,0,0,0); opacity: 0.8; }
}

/* ── AVATAR ────────────────────────────────────────────────────── */
.avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--w-bold);
  color: white;
  background: var(--navy-600);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.avatar-xs { width: 22px; height: 22px; border-radius: var(--r-md); font-size: 9.5px; }
.avatar-sm { width: 26px; height: 26px; border-radius: var(--r-md); font-size: 10px; }
.avatar-md { width: 32px; height: 32px; }
.avatar-lg { width: 40px; height: 40px; border-radius: var(--r-xl); font-size: var(--text-sm); }
.avatar-xl { width: 56px; height: 56px; border-radius: var(--r-2xl); font-size: var(--text-md); }
.avatar-round { border-radius: 50% !important; }

.avatar-purple { background: linear-gradient(135deg, var(--purple), var(--purple-d)); }
.avatar-coral  { background: linear-gradient(135deg, var(--coral),  var(--coral-d)); }
.avatar-teal   { background: linear-gradient(135deg, var(--teal),   var(--teal-d)); }
.avatar-amber  { background: linear-gradient(135deg, var(--amber),  var(--amber-d)); }
.avatar-blue   { background: linear-gradient(135deg, var(--blue),   var(--blue-d)); }

.avatar-stack { display: inline-flex; }
.avatar-stack > * + * { margin-left: -7px; border: 2px solid var(--surface); }

/* ── DIVIDER ───────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); border: none; width: 100%; }
.divider-dark { background: var(--border-dark); }
.divider-vertical { width: 1px; height: 100%; background: var(--border); }
.divider-with-text {
  display: flex; align-items: center; gap: var(--s-3);
  color: var(--fg-muted);
  font-size: var(--text-xs);
  font-weight: var(--w-medium);
}
.divider-with-text::before,
.divider-with-text::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── LOGO ──────────────────────────────────────────────────────── */
.logo-mark {
  display: inline-flex; align-items: center; gap: var(--s-2);
  text-decoration: none;
}
/* Image-based brand mark — sized by height; width auto */
.logo-img {
  display: block;
  height: 26px;
  width: auto;
}
.logo-img-sm { height: 22px; }
.logo-img-lg { height: 32px; }
.logo-img-xl { height: 40px; }

/* Legacy text wordmark kept for places that compose word + mark separately */
.logo-word {
  font-size: var(--text-xl);
  font-weight: var(--w-black);
  letter-spacing: var(--tracking-tight);
  color: var(--fg);
}
.logo-word-light { color: white; }

/* ── KEY (keyboard shortcut) ───────────────────────────────────── */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-xs);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-bottom-width: 1.5px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--w-semi);
  color: var(--fg-muted);
}

/* ── TAG (subtle, non-interactive) ─────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  font-size: var(--text-2xs);
  font-weight: var(--w-semi);
  color: var(--fg-muted);
}

/* ── SPINNER ────────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ICON BUTTON ───────────────────────────────────────────────── */
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--border);
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-muted);
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
  position: relative;
}
.icon-btn:hover { color: var(--fg); border-color: var(--border-strong); }
.icon-btn-sm { width: 28px; height: 28px; border-radius: var(--r-md); }
.icon-btn-ghost { border-color: transparent; background: transparent; }
.icon-btn-ghost:hover { background: var(--surface-sunken); }
