/* ============================================================
   BEAMCOVE — component kit (V2)
   ============================================================
   shadcn/ui component vocabulary, Beamcove palette.
   Every value resolves to a SEMANTIC token from colors_and_type.css.
   Nothing here references a raw palette hue directly — recolor the
   system by editing tokens, not this file.
   Prefix: .bc-*
   ============================================================ */

/* ============================================================
   BUTTON
   ============================================================ */
.bc-btn {
  --_h: 40px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1;
  height: var(--_h);
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; cursor: pointer; user-select: none;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-instant) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.bc-btn:active { transform: translateY(0.5px) scale(0.99); }
.bc-btn:disabled, .bc-btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.bc-btn svg, .bc-btn [data-lucide] { width: 16px; height: 16px; }

.bc-btn--primary   { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-lifted); }
.bc-btn--primary:hover   { background: var(--primary-hover); }
.bc-btn--secondary { background: var(--secondary); color: var(--secondary-foreground); border-color: var(--border); box-shadow: var(--shadow-xs); }
.bc-btn--secondary:hover { background: var(--tide-100); }
.bc-btn--outline   { background: var(--card); color: var(--foreground); border-color: var(--input); box-shadow: var(--shadow-xs); }
.bc-btn--outline:hover    { background: var(--secondary); border-color: var(--border-strong); }
.bc-btn--ghost     { background: transparent; color: var(--foreground); }
.bc-btn--ghost:hover      { background: var(--secondary); }
.bc-btn--destructive { background: var(--destructive); color: var(--destructive-foreground); box-shadow: var(--shadow-lifted); }
.bc-btn--destructive:hover { background: var(--destructive-hover); }
.bc-btn--pop       { background: var(--pop); color: var(--pop-foreground); box-shadow: var(--shadow-lifted); }
.bc-btn--pop:hover        { background: var(--pop-strong); }
.bc-btn--link      { background: transparent; color: var(--link); height: auto; padding: 0; border-radius: 0;
                     text-decoration: underline; text-decoration-color: var(--link-underline); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.bc-btn--link:hover       { color: var(--link-hover); text-decoration-color: var(--pop-strong); }

.bc-btn--sm   { --_h: 32px; font-size: var(--text-xs); padding: 0 12px; border-radius: var(--r-sm); gap: 6px; }
.bc-btn--lg   { --_h: 46px; font-size: var(--text-md); padding: 0 22px; }
.bc-btn--icon { --_h: 40px; width: 40px; padding: 0; }
.bc-btn--icon.bc-btn--sm { width: 32px; }

/* ============================================================
   FORM FIELD — label / input / textarea / select / hint
   ============================================================ */
.bc-field { display: flex; flex-direction: column; gap: 7px; }
.bc-label { font-size: var(--text-sm); font-weight: 600; color: var(--foreground); line-height: 1.2; }
.bc-label .req { color: var(--destructive); margin-left: 2px; }
.bc-hint  { font-size: var(--text-xs); color: var(--muted-foreground); line-height: 1.4; }
.bc-hint--error { color: var(--danger-foreground); }

.bc-input, .bc-textarea, .bc-select {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--foreground);
  background: var(--card);
  border: 1px solid var(--input);
  border-radius: var(--r-sm);
  padding: 0 12px;
  height: 40px;
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-xs);
}
.bc-textarea { height: auto; min-height: 88px; padding: 10px 12px; line-height: var(--leading-normal); resize: vertical; }
.bc-input::placeholder, .bc-textarea::placeholder { color: var(--muted-foreground); }
.bc-input:focus, .bc-textarea:focus, .bc-select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 28%, transparent);
}
.bc-input:disabled, .bc-textarea:disabled, .bc-select:disabled { opacity: 0.55; cursor: not-allowed; background: var(--muted); }
.bc-field--error .bc-input,
.bc-field--error .bc-textarea,
.bc-field--error .bc-select { border-color: var(--destructive); }
.bc-field--error .bc-input:focus { box-shadow: 0 0 0 3px color-mix(in oklab, var(--destructive) 22%, transparent); }

.bc-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23627172' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 34px;
  cursor: pointer;
}

/* Input with leading icon */
.bc-input-group { position: relative; }
.bc-input-group .bc-input { padding-left: 36px; }
.bc-input-group .bc-input-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted-foreground); pointer-events: none;
}

/* ============================================================
   SELECTION CONTROLS — checkbox / radio / switch
   ============================================================ */
.bc-control { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: var(--text-sm); color: var(--foreground); }
.bc-control input { position: absolute; opacity: 0; width: 0; height: 0; }

/* Checkbox */
.bc-checkbox {
  width: 18px; height: 18px; flex: none;
  border: 1.5px solid var(--input);
  border-radius: var(--r-xs);
  background: var(--card);
  display: grid; place-items: center;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.bc-checkbox svg { width: 12px; height: 12px; stroke: var(--primary-foreground); stroke-width: 3.5; opacity: 0; transform: scale(0.6); transition: opacity var(--dur-fast), transform var(--dur-fast) var(--ease-spring); }
.bc-control input:checked ~ .bc-checkbox { background: var(--primary); border-color: var(--primary); }
.bc-control input:checked ~ .bc-checkbox svg { opacity: 1; transform: scale(1); }
.bc-control input:focus-visible ~ .bc-checkbox { outline: 2px solid var(--ring); outline-offset: 2px; }
.bc-control input:disabled ~ .bc-checkbox { opacity: 0.5; }
.bc-control:has(input:disabled) { opacity: 0.6; cursor: not-allowed; }

/* Radio */
.bc-radio {
  width: 18px; height: 18px; flex: none;
  border: 1.5px solid var(--input);
  border-radius: var(--r-pill);
  background: var(--card);
  display: grid; place-items: center;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.bc-radio::after { content: ""; width: 9px; height: 9px; border-radius: var(--r-pill); background: var(--primary); transform: scale(0); transition: transform var(--dur-fast) var(--ease-spring); }
.bc-control input:checked ~ .bc-radio { border-color: var(--primary); }
.bc-control input:checked ~ .bc-radio::after { transform: scale(1); }
.bc-control input:focus-visible ~ .bc-radio { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Switch */
.bc-switch {
  width: 38px; height: 22px; flex: none;
  border-radius: var(--r-pill);
  background: var(--tide-200);
  padding: 2px;
  display: flex; align-items: center;
  transition: background var(--dur-base) var(--ease-out);
}
.bc-switch::after { content: ""; width: 18px; height: 18px; border-radius: var(--r-pill); background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-base) var(--ease-spring); }
.bc-control input:checked ~ .bc-switch { background: var(--primary); }
.bc-control input:checked ~ .bc-switch::after { transform: translateX(16px); }
.bc-control input:focus-visible ~ .bc-switch { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ============================================================
   SLIDER (native range) + PROGRESS + SKELETON
   ============================================================ */
.bc-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: var(--r-pill); background: var(--tide-150); outline: none; }
.bc-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: var(--r-pill); background: var(--card); border: 2px solid var(--primary); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform var(--dur-fast); }
.bc-slider::-webkit-slider-thumb:hover { transform: scale(1.12); }
.bc-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: var(--r-pill); background: var(--card); border: 2px solid var(--primary); cursor: pointer; }
.bc-slider::-moz-range-progress { background: var(--primary); height: 6px; border-radius: var(--r-pill); }

.bc-progress { height: 8px; width: 100%; background: var(--tide-150); border-radius: var(--r-pill); overflow: hidden; }
.bc-progress__bar { height: 100%; background: var(--primary); border-radius: var(--r-pill); transition: width var(--dur-slow) var(--ease-out); }

.bc-skeleton { background: linear-gradient(90deg, var(--tide-100) 25%, var(--tide-50) 37%, var(--tide-100) 63%); background-size: 400% 100%; border-radius: var(--r-sm); animation: bc-shimmer 1.4s ease infinite; }
@keyframes bc-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ============================================================
   BADGE
   ============================================================ */
.bc-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-sans); font-weight: 600; font-size: var(--text-xs); line-height: 1;
  padding: 4px 9px; border-radius: var(--r-pill); border: 1px solid transparent;
}
.bc-badge .dot { width: 6px; height: 6px; border-radius: var(--r-pill); background: currentColor; }
.bc-badge--primary   { background: var(--primary); color: var(--primary-foreground); }
.bc-badge--secondary { background: var(--tide-100); color: var(--tide-700); border-color: var(--tide-200); }
.bc-badge--outline   { background: var(--tide-50); color: var(--tide-700); border-color: var(--tide-300); }
.bc-badge--success { background: var(--palm-100);  color: var(--palm-600); border: 1px solid color-mix(in oklab, var(--success) 25%, transparent); }
.bc-badge--warning { background: var(--buoy-100);  color: var(--buoy-500); border: 1px solid color-mix(in oklab, var(--warning) 30%, transparent); }
.bc-badge--danger  { background: var(--coral-100); color: var(--coral-700); border: 1px solid color-mix(in oklab, var(--danger) 25%, transparent); }
.bc-badge--info    { background: var(--harbor-100); color: var(--harbor-700); border: 1px solid color-mix(in oklab, var(--info) 25%, transparent); }

/* ============================================================
   ALERT
   ============================================================ */
.bc-alert {
  display: grid; grid-template-columns: 20px 1fr; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--card);
}
.bc-alert__icon { width: 20px; height: 20px; color: var(--foreground); margin-top: 1px; }
.bc-alert__title { font-weight: 700; font-size: var(--text-sm); margin: 0 0 2px; }
.bc-alert__body  { font-size: var(--text-sm); color: var(--muted-foreground); margin: 0; line-height: var(--leading-snug); }
.bc-alert--info    { background: var(--info-soft);    border-color: color-mix(in oklab, var(--info) 28%, transparent); }
.bc-alert--info    .bc-alert__icon, .bc-alert--info .bc-alert__title { color: var(--info-foreground); }
.bc-alert--success { background: var(--success-soft); border-color: color-mix(in oklab, var(--success) 30%, transparent); }
.bc-alert--success .bc-alert__icon, .bc-alert--success .bc-alert__title { color: var(--success-foreground); }
.bc-alert--warning { background: var(--warning-soft); border-color: color-mix(in oklab, var(--warning) 36%, transparent); }
.bc-alert--warning .bc-alert__icon, .bc-alert--warning .bc-alert__title { color: var(--warning-foreground); }
.bc-alert--danger  { background: var(--danger-soft);  border-color: color-mix(in oklab, var(--danger) 30%, transparent); }
.bc-alert--danger  .bc-alert__icon, .bc-alert--danger .bc-alert__title { color: var(--danger-foreground); }

/* ============================================================
   CARD
   ============================================================ */
.bc-card {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.bc-card__header  { padding: 20px 20px 0; display: flex; flex-direction: column; gap: 5px; }
.bc-card__title   { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; line-height: 1.2; }
.bc-card__desc    { font-size: var(--text-sm); color: var(--muted-foreground); line-height: var(--leading-snug); }
.bc-card__content { padding: 16px 20px; }
.bc-card__footer  { padding: 0 20px 20px; display: flex; gap: 10px; align-items: center; }
.bc-card--interactive { cursor: pointer; transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.bc-card--interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ============================================================
   TABS
   ============================================================ */
.bc-tabs__list { display: inline-flex; gap: 2px; padding: 4px; background: var(--tide-150); border-radius: var(--r-md); }
.bc-tab {
  font-family: var(--font-sans); font-weight: 600; font-size: var(--text-sm);
  color: var(--muted-foreground); background: transparent; border: 0; cursor: pointer;
  padding: 7px 14px; border-radius: var(--r-sm);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.bc-tab:hover { color: var(--foreground); }
.bc-tab[aria-selected="true"] { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-xs); }
.bc-tab__panel { padding-top: 16px; font-size: var(--text-sm); color: var(--muted-foreground); }
.bc-tab__panel[hidden] { display: none; }

/* ============================================================
   ACCORDION
   ============================================================ */
.bc-accordion { border-top: 1px solid var(--border); }
.bc-accordion__item { border-bottom: 1px solid var(--border); }
.bc-accordion__trigger {
  width: 100%; text-align: left; background: transparent; border: 0; cursor: pointer;
  font-family: var(--font-sans); font-weight: 600; font-size: var(--text-sm); color: var(--foreground);
  padding: 16px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.bc-accordion__trigger .chev { width: 16px; height: 16px; color: var(--muted-foreground); transition: transform var(--dur-base) var(--ease-out); flex: none; }
.bc-accordion__trigger[aria-expanded="true"] .chev { transform: rotate(180deg); }
.bc-accordion__panel { overflow: hidden; height: 0; transition: height var(--dur-base) var(--ease-out); }
.bc-accordion__panel-inner { padding-bottom: 16px; font-size: var(--text-sm); color: var(--muted-foreground); line-height: var(--leading-normal); }

/* ============================================================
   DIALOG / MODAL  (static representation)
   ============================================================ */
.bc-dialog-scrim {
  position: absolute; inset: 0;
  background: color-mix(in oklab, var(--inverse) 42%, transparent);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  border-radius: inherit;
}
.bc-dialog {
  width: min(420px, 90%);
  background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  padding: 22px;
}
.bc-dialog__title { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; margin: 0 0 6px; }
.bc-dialog__desc  { font-size: var(--text-sm); color: var(--muted-foreground); margin: 0 0 20px; line-height: var(--leading-snug); }
.bc-dialog__footer { display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================
   DROPDOWN MENU / POPOVER
   ============================================================ */
.bc-menu {
  min-width: 200px;
  background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 5px;
}
.bc-menu__label { font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-allcaps); color: var(--muted-foreground); padding: 8px 10px 4px; }
.bc-menu__item {
  display: flex; align-items: center; gap: 10px;
  font-size: var(--text-sm); color: var(--foreground);
  padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer;
  border: 0; background: transparent; width: 100%; text-align: left;
}
.bc-menu__item svg { width: 16px; height: 16px; color: var(--muted-foreground); }
.bc-menu__item .kbd { margin-left: auto; font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--muted-foreground); }
.bc-menu__item:hover { background: var(--secondary); }
.bc-menu__item--danger { color: var(--danger-foreground); }
.bc-menu__item--danger svg { color: var(--danger-foreground); }
.bc-menu__item--danger:hover { background: var(--danger-soft); }
.bc-menu__sep { height: 1px; background: var(--border); margin: 5px 0; }

/* ============================================================
   TOOLTIP  (static representation)
   ============================================================ */
.bc-tooltip {
  position: relative; display: inline-flex;
  background: var(--inverse); color: var(--inverse-foreground);
  font-size: var(--text-xs); font-weight: 500;
  padding: 6px 10px; border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
}
.bc-tooltip::after {
  content: ""; position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%) rotate(45deg);
  width: 9px; height: 9px; background: var(--inverse);
}

/* ============================================================
   TABLE
   ============================================================ */
.bc-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.bc-table thead th {
  text-align: left; font-weight: 600; color: var(--muted-foreground);
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.bc-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--rule); color: var(--foreground); }
.bc-table tbody tr:last-child td { border-bottom: 0; }
.bc-table tbody tr { transition: background var(--dur-fast); }
.bc-table tbody tr:hover { background: var(--secondary); }
.bc-table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* ============================================================
   AVATAR
   ============================================================ */
.bc-avatar {
  width: 40px; height: 40px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-foreground);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--text-sm);
  overflow: hidden; flex: none;
  box-shadow: 0 0 0 1.5px var(--border);
}
.bc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bc-avatar--sm { width: 28px; height: 28px; font-size: var(--text-xs); }
.bc-avatar--lg { width: 56px; height: 56px; font-size: var(--text-lg); }
.bc-avatar-stack { display: flex; }
.bc-avatar-stack .bc-avatar { margin-left: -10px; box-shadow: 0 0 0 2px var(--card); }
.bc-avatar-stack .bc-avatar:first-child { margin-left: 0; }

/* ============================================================
   BREADCRUMB + PAGINATION
   ============================================================ */
.bc-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--muted-foreground); }
.bc-breadcrumb a { color: var(--muted-foreground); text-decoration: none; }
.bc-breadcrumb a:hover { color: var(--foreground); }
.bc-breadcrumb .sep { color: var(--tide-300); }
.bc-breadcrumb .current { color: var(--foreground); font-weight: 600; }

.bc-pagination { display: inline-flex; align-items: center; gap: 4px; }
.bc-page {
  min-width: 36px; height: 36px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); font-weight: 600; color: var(--foreground);
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
  cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast);
}
.bc-page:hover { background: var(--secondary); }
.bc-page[aria-current="page"] { background: var(--primary); color: var(--primary-foreground); }
.bc-page--ghost { color: var(--muted-foreground); }

/* ============================================================
   TOAST  (static representation)
   ============================================================ */
.bc-toast {
  display: grid; grid-template-columns: 18px 1fr auto; gap: 12px; align-items: start;
  width: min(360px, 100%);
  background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 14px 14px;
}
.bc-toast__icon { width: 18px; height: 18px; color: var(--primary); margin-top: 1px; }
.bc-toast__title { font-size: var(--text-sm); font-weight: 700; margin: 0; }
.bc-toast__body  { font-size: var(--text-xs); color: var(--muted-foreground); margin: 3px 0 0; line-height: var(--leading-snug); }
.bc-toast__close { background: transparent; border: 0; color: var(--muted-foreground); cursor: pointer; padding: 2px; }
