/* ==========================================================================
   COMPONENTS — buttons, cards, chips, badges, toast, command palette
   ========================================================================== */

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.4rem;
  font-family: var(--font-body); font-size: .9rem; font-weight: 600;
  border-radius: var(--radius-md); border: 1px solid transparent;
  cursor: pointer; transition: all var(--duration-fast) var(--ease);
  white-space: nowrap; text-decoration: none;
  min-height: 44px; /* touch target */
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-light); border-color: var(--accent-light);
  box-shadow: 0 0 28px var(--accent-glow); transform: translateY(-1px);
}
.btn-outline {
  background: transparent; color: var(--text); border-color: var(--border-strong);
}
.btn-outline:hover {
  border-color: var(--accent); color: var(--accent); transform: translateY(-1px);
}
.btn-ghost {
  background: transparent; color: var(--text-muted); border-color: transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--accent-subtle); }
.btn-sm { padding: .4rem .9rem; font-size: .8rem; min-height: 40px; }
.btn-icon { padding: .6rem; border-radius: var(--radius-md); }

/* ── Cards ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-xl);
  position: relative; overflow: hidden;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); }

/* Spotlight hover effect */
.card-spotlight::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  opacity: 0; transition: opacity .4s;
  background: radial-gradient(320px circle at var(--mouse-x,50%) var(--mouse-y,50%),
    rgba(99,102,241,.08) 0%, transparent 70%);
  pointer-events: none;
}
.card-spotlight:hover::after { opacity: 1; }

/* ── Tech chips ── */
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .7rem;
  background: var(--accent-subtle); color: var(--accent-light);
  border: 1px solid rgba(99,102,241,.15); border-radius: var(--radius-full);
  font-family: var(--font-mono); font-size: .75rem; font-weight: 500; white-space: nowrap;
}
[data-theme="light"] .chip { background: rgba(79,70,229,.06); color: var(--accent); }
.chip-tech { font-size: .72rem; padding: .2rem .55rem; }

/* ── Filter tabs ── */
.filter-tabs { display: flex; flex-wrap: wrap; gap: .5rem; }
.filter-tab {
  padding: .4rem 1rem; font-size: .82rem; font-weight: 500;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-full); color: var(--text-muted);
  cursor: pointer; transition: all var(--duration-fast);
  min-height: 36px;
}
.filter-tab:hover  { border-color: var(--accent); color: var(--accent); }
.filter-tab.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .65rem; border-radius: var(--radius-full);
  font-size: .72rem; font-weight: 600; font-family: var(--font-mono);
}
.badge-live {
  background: var(--green-glow); color: var(--green);
  border: 1px solid rgba(34,197,94,.2);
}
.badge-progress {
  background: rgba(245,158,11,.1); color: #f59e0b;
  border: 1px solid rgba(245,158,11,.2);
}
.badge-featured {
  background: rgba(99,102,241,.15); color: var(--accent-light);
  border: 1px solid rgba(99,102,241,.3);
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: .5; transform: scale(.85); }
}

/* ── Section tag ── */
.section-tag {
  font-family: var(--font-mono); font-size: .78rem; color: var(--accent);
  letter-spacing: .06em; margin-bottom: .75rem; display: block;
}

/* ── Toast ── */
#toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9000;
  display: flex; flex-direction: column; gap: .5rem;
  pointer-events: none;
}
.toast-msg {
  padding: .75rem 1.2rem;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  font-size: .875rem; color: var(--text);
  animation: toast-in .3s var(--ease) forwards;
  pointer-events: all;
}
.toast-msg.out { animation: toast-out .25s ease forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }

/* ── Command palette ── */
#cmd-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: min(12vh, 120px);
  opacity: 0; visibility: hidden;
  transition: opacity .2s, visibility 0s linear .2s;
}
#cmd-overlay[aria-hidden="false"] {
  opacity: 1; visibility: visible; transition-delay: 0s;
}
#cmd-palette {
  width: min(600px, calc(100vw - 2rem));
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); overflow: hidden;
  box-shadow: 0 25px 60px rgba(0,0,0,.6);
  transform: translateY(-8px);
  transition: transform .2s var(--ease);
}
#cmd-overlay[aria-hidden="false"] #cmd-palette { transform: translateY(0); }
#cmd-input-wrap {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
#cmd-input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--font-body); font-size: 1rem; color: var(--text);
}
#cmd-input::placeholder { color: var(--text-faint); }
#cmd-results {
  max-height: min(420px, 60vh); overflow-y: auto;
  padding: .5rem;
}
.cmd-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1rem; border-radius: var(--radius-md);
  font-size: .9rem; color: var(--text-muted); cursor: pointer;
  transition: all var(--duration-fast);
}
.cmd-item:hover, .cmd-item.active { background: var(--accent-subtle); color: var(--text); }
.cmd-item-icon {
  width: 28px; height: 28px; display: grid; place-items: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); flex-shrink: 0; color: var(--text-muted);
}
.cmd-item-label { flex: 1; }
.cmd-item-tag { font-family: var(--font-mono); font-size: .7rem; color: var(--text-faint); }
#cmd-footer {
  display: flex; gap: 1.25rem; padding: .6rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: .7rem; color: var(--text-faint);
}
#cmd-footer kbd {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 4px; padding: .1rem .35rem;
  font-size: .65rem; margin-right: .25rem;
}
