/* Reusable components. All classes are kc- prefixed. Pill buttons, 20px cards with translucent border,
   lime (accent) hover — the same visual language as the main site. */

/* ---------- Buttons ---------- */
.kc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--kc-tap); padding: 8px 24px;
  border: 2px solid transparent; border-radius: var(--kc-r-pill);
  font-weight: 700; font-size: 1rem; line-height: 1.2; text-align: center;
  background: var(--kc-surface-2); color: var(--kc-text-strong);
  transition: background 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.kc-btn--primary { background: var(--kc-accent); color: var(--kc-on-accent); border-color: var(--kc-accent); }
.kc-btn--primary:hover { background: transparent; color: var(--kc-accent-text); box-shadow: 0 0 15px var(--kc-accent-soft); }
.kc-btn--ghost { background: transparent; border-color: var(--kc-accent-text); color: var(--kc-accent-text); }
.kc-btn--ghost:hover { background: var(--kc-accent-soft); }
.kc-btn--danger { background: var(--kc-danger); color: var(--kc-on-danger); border-color: var(--kc-danger); }
.kc-btn--block { display: flex; width: 100%; }
.kc-btn--sm { min-height: 36px; padding: 4px 16px; font-size: 0.9rem; }
.kc-btn[disabled], .kc-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.kc-iconbtn {
  position: relative; display: inline-grid; place-items: center;
  width: var(--kc-tap); height: var(--kc-tap); border: 0; border-radius: 50%;
  background: transparent; color: var(--kc-text); font-size: 1.15rem;
  transition: background 0.2s, color 0.2s;
}
.kc-iconbtn:hover { background: var(--kc-accent-soft); color: var(--kc-accent-text); }
.kc-dot {
  position: absolute; top: 6px; right: 5px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 9px;
  background: var(--kc-danger); color: var(--kc-on-danger);
  font: 700 0.65rem/1 var(--kc-font-en);
}

/* ---------- Cards, tags, chips ---------- */
.kc-card {
  position: relative; display: block;
  background: var(--kc-surface); border: 1px solid var(--kc-border);
  border-radius: var(--kc-r-card); padding: 18px;
  box-shadow: var(--kc-shadow);
}
.kc-card + .kc-card, .kc-stack > * + * { margin-top: 14px; }
@media (hover: hover) {
  .kc-card--lift { transition: transform 0.4s, border-color 0.4s, background 0.4s; }
  .kc-card--lift:hover { transform: translateY(-6px); border-color: var(--kc-accent); background: var(--kc-surface-2); }
}
.kc-tag {
  display: inline-block; padding: 2px 8px; border-radius: var(--kc-r-chip);
  background: var(--kc-accent); color: var(--kc-on-accent);
  font: 700 0.65rem/1.5 var(--kc-font-en); text-transform: uppercase; letter-spacing: 0.02em;
}
.kc-tag--soon { background: var(--kc-surface-3); color: var(--kc-text); }
.kc-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 14px;
  border-radius: var(--kc-r-pill); border: 1px solid var(--kc-border-strong);
  background: var(--kc-surface); color: var(--kc-text); font-size: 0.9rem; font-weight: 500; white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.kc-chip i { color: var(--kc-accent-text); }
.kc-chip:hover { border-color: var(--kc-accent-text); background: var(--kc-accent-soft); }
.kc-chip[aria-current="true"] { background: var(--kc-accent); border-color: var(--kc-accent); color: var(--kc-on-accent); font-weight: 700; }
.kc-chip[aria-current="true"] i { color: var(--kc-on-accent); }
.kc-chips { list-style: none; margin: 0; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }

/* ---------- Tabs (links, not widgets: each tab is a route) ---------- */
.kc-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--kc-border); margin: 0 -4px 14px; }
.kc-tabs a {
  flex: 1; text-align: center; padding: 12px 6px 10px; font-weight: 500; color: var(--kc-muted);
  border-bottom: 3px solid transparent; min-height: var(--kc-tap);
}
.kc-tabs a:hover { color: var(--kc-text-strong); }
.kc-tabs a[aria-current="page"] { color: var(--kc-text-strong); border-bottom-color: var(--kc-accent); font-weight: 700; }

/* ---------- Rows, switches, segmented controls ---------- */
.kc-list { border: 1px solid var(--kc-border); border-radius: var(--kc-r-card); background: var(--kc-surface); overflow: hidden; }
.kc-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 12px 16px;
  background: transparent; border: 0; text-align: left; color: var(--kc-text);
}
.kc-row + .kc-row { border-top: 1px solid var(--kc-border); }
.kc-row-icon { width: 24px; text-align: center; color: var(--kc-accent-text); font-size: 1.1rem; }
.kc-row-body { flex: 1; min-width: 0; }
.kc-row-title { font-weight: 700; color: var(--kc-text-strong); }
.kc-row-sub { font-size: 0.85rem; color: var(--kc-muted); line-height: 1.4; }
a.kc-row:hover { background: var(--kc-accent-soft); }

.kc-switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative;
  width: 52px; height: 30px; margin: 0; border-radius: 15px; cursor: pointer;
  background: var(--kc-surface-3); border: 1px solid var(--kc-border-strong);
  transition: background 0.2s;
}
.kc-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--kc-text-strong); transition: transform 0.2s var(--kc-ease), background 0.2s;
}
.kc-switch:checked { background: var(--kc-accent); border-color: var(--kc-accent); }
.kc-switch:checked::after { transform: translateX(22px); background: var(--kc-on-accent); }
.kc-switch:focus-visible { outline: 3px solid var(--kc-accent-text); outline-offset: 3px; }

.kc-seg { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.kc-seg legend { padding: 0; }
.kc-seg label {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 6px 16px; border-radius: var(--kc-r-pill);
  border: 1px solid var(--kc-border-strong); background: transparent; color: var(--kc-text);
  font-weight: 500; cursor: pointer; transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.kc-seg input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.kc-seg label:has(input:checked) { background: var(--kc-accent); color: var(--kc-on-accent); border-color: var(--kc-accent); font-weight: 700; }
.kc-seg label:has(input:focus-visible) { outline: 3px solid var(--kc-accent-text); outline-offset: 2px; }
.kc-swatch { width: 14px; height: 14px; border-radius: 50%; margin-right: 8px; border: 1px solid rgba(128, 128, 128, 0.5); }
.kc-swatch[data-skin="lime"] { background: #a3e635; }
.kc-swatch[data-skin="gold"] { background: #d4a863; }
.kc-swatch[data-skin="sky"] { background: #38bdf8; }
.kc-swatch[data-skin="rose"] { background: #fb7185; }

.kc-select {
  min-height: 44px; padding: 6px 14px; border-radius: var(--kc-r-md);
  background: var(--kc-surface-2); color: var(--kc-text); border: 1px solid var(--kc-border-strong);
}

/* ---------- Section headings, empty state, banner, back pill ---------- */
.kc-section { margin-top: 22px; }
.kc-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.kc-section-title { font-size: 1.15rem; font-weight: 700; color: var(--kc-text-strong); display: flex; align-items: center; gap: 10px; }
.kc-section-title i { color: var(--kc-accent-text); }
.kc-link { color: var(--kc-accent-text); font-weight: 700; }
.kc-link:hover { text-decoration: underline; }
.kc-muted { color: var(--kc-muted); }

.kc-empty { text-align: center; padding: 36px 20px; color: var(--kc-muted); }
.kc-empty > i { display: block; font-size: 3rem; margin-bottom: 14px; color: var(--kc-accent-text); opacity: 0.85; }
.kc-empty-title { font-size: 1.1rem; font-weight: 700; color: var(--kc-text-strong); margin-bottom: 6px; }
.kc-empty .kc-btn { margin-top: 16px; }

.kc-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px;
  background: var(--kc-surface-2); border: 1px solid var(--kc-border-strong); border-radius: var(--kc-r-md);
}
.kc-banner > i { color: var(--kc-accent-text); font-size: 1.2rem; }
.kc-banner-text { flex: 1; font-size: 0.92rem; }

.kc-backpill {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--kc-tap); padding: 8px 18px;
  border-radius: var(--kc-r-pill); background: var(--kc-glass); color: var(--kc-text-strong);
  border: 1px solid var(--kc-border-strong);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.kc-backpill:hover { border-color: var(--kc-accent-text); color: var(--kc-accent-text); }

/* ---------- Skeleton ---------- */
.kc-skel { display: block; border-radius: 10px; background: linear-gradient(90deg, var(--kc-surface) 25%, var(--kc-surface-2) 50%, var(--kc-surface) 75%); background-size: 200% 100%; animation: kc-shimmer 1.4s linear infinite; }
.kc-skel-line { height: 14px; margin: 10px 0; }
.kc-skel-line:last-child { width: 60%; }
.kc-skel-avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.kc-skel-card { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--kc-border); border-radius: var(--kc-r-card); margin-bottom: 14px; }
.kc-skel-card > div:last-child { flex: 1; }
@keyframes kc-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Avatar + badges ---------- */
.kc-avatar {
  position: relative; flex: none; display: inline-grid; place-items: center;
  width: var(--kc-av, 44px); height: var(--kc-av, 44px); border-radius: 50%;
  background: var(--kc-av-bg, #2d5a27); color: #fff;
  font-weight: 700; font-size: calc(var(--kc-av, 44px) * 0.46); line-height: 1; overflow: visible; user-select: none;
}
.kc-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.kc-avatar-status {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  padding: 1px 8px; border-radius: var(--kc-r-pill); font: 700 0.65rem/1.4 var(--kc-font-en);
  background: #166534; color: #dcfce7; border: 2px solid var(--kc-surface);
}
.kc-badges { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.kc-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--kc-r-pill);
  font-size: 0.72rem; font-weight: 700; line-height: 1.5; white-space: nowrap;
  background: var(--kc-surface-3); color: var(--kc-text-strong);
}
.kc-badge--founder { background: linear-gradient(45deg, #c8a15f, #e0b974); color: #0a1f12; }
.kc-badge--admin { background: linear-gradient(45deg, #c81e3a, #a8146e); color: #fff; }
.kc-badge--verified, .kc-badge--official { background: var(--kc-accent); color: var(--kc-on-accent); }
.kc-badge--staff { background: var(--kc-accent-soft); color: var(--kc-accent-text); border: 1px solid var(--kc-accent-text); }
.kc-badge--expert { background: var(--kc-accent-soft); color: var(--kc-accent-text); border: 1px solid var(--kc-accent-text); }

/* ---------- Overlay: modal + bottom sheet ---------- */
.kc-overlay {
  position: fixed; inset: 0; z-index: var(--kc-z-overlay); display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--kc-overlay);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: kc-fade 0.2s var(--kc-ease);
}
.kc-modal {
  width: 100%; max-width: 440px; max-height: calc(100dvh - 40px); overflow-y: auto;
  background: var(--kc-surface-2); color: var(--kc-text); border: 1px solid var(--kc-border-strong);
  border-radius: var(--kc-r-card); box-shadow: var(--kc-shadow); padding: 20px;
}
.kc-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.kc-modal-title { font-size: 1.2rem; font-weight: 700; color: var(--kc-text-strong); }
.kc-modal-body { line-height: 1.6; }
.kc-modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.kc-overlay--sheet { align-items: flex-end; padding: 0; }
.kc-modal--sheet {
  max-width: 560px; border-radius: 26px 26px 0 0; border-bottom: 0;
  padding-bottom: calc(20px + var(--kc-safe-b)); animation: kc-rise 0.28s var(--kc-ease);
}
.kc-sheet-grab { width: 44px; height: 5px; border-radius: 3px; background: var(--kc-border-strong); margin: 0 auto 14px; }
@keyframes kc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes kc-rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Toasts ---------- */
.kc-toasts {
  position: fixed; z-index: var(--kc-z-toast); left: 12px; right: 12px;
  bottom: calc(var(--kc-nav-h) + 28px + var(--kc-safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.kc-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 460px; width: 100%;
  padding: 10px 12px 10px 16px; border-radius: var(--kc-r-md);
  background: var(--kc-surface-3); color: var(--kc-text-strong); border: 1px solid var(--kc-border-strong);
  box-shadow: var(--kc-shadow); animation: kc-rise 0.25s var(--kc-ease);
}
.kc-toast--success { border-color: var(--kc-accent-text); }
.kc-toast--error { border-color: var(--kc-danger); }
.kc-toast-msg { flex: 1; font-size: 0.95rem; }
.kc-toast-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: inherit; }
.kc-toast-x:hover { background: var(--kc-accent-soft); }
@media (min-width: 992px) { .kc-toasts { bottom: 24px; } }

/* ---------- Tiles (profile hub shortcuts) ---------- */
.kc-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kc-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 112px; padding: 14px 8px; text-align: center; font-weight: 700; color: var(--kc-text-strong);
  background: var(--kc-surface); border: 1px solid var(--kc-border); border-radius: var(--kc-r-card);
  transition: border-color 0.3s, background 0.3s;
}
.kc-tile-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--kc-accent-soft); color: var(--kc-accent-text); font-size: 1.3rem; }
.kc-tile .kc-tag { position: absolute; top: 8px; right: 8px; font-size: 0.6rem; }
.kc-tile:hover { border-color: var(--kc-accent); background: var(--kc-surface-2); }
