/* ============================================================
   BOOKNANDO DESIGN SYSTEM — COMPONENTS
   ============================================================ */

/* -------- Typography utility classes -------- */
.t-display    { font-size: var(--fs-5xl); font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); color: var(--text-primary); }
.t-h1         { font-size: var(--fs-4xl); font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); color: var(--text-primary); }
.t-h2         { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); line-height: var(--lh-snug); letter-spacing: var(--ls-snug); color: var(--text-primary); }
.t-h3         { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); line-height: var(--lh-snug); letter-spacing: var(--ls-snug); color: var(--text-primary); }
.t-h4         { font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: var(--lh-snug); color: var(--text-primary); }
.t-lg         { font-size: var(--fs-lg); line-height: var(--lh-normal); color: var(--text-body); }
.t-md         { font-size: var(--fs-md); line-height: var(--lh-normal); color: var(--text-body); }
.t-sm         { font-size: var(--fs-sm); line-height: var(--lh-normal); color: var(--text-body); }
.t-xs         { font-size: var(--fs-xs); line-height: var(--lh-normal); color: var(--text-secondary); }
.t-eyebrow    { font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--text-muted); }
.t-mono       { font-family: var(--font-mono); font-size: var(--fs-sm); }
.t-muted      { color: var(--text-muted); }
.t-secondary  { color: var(--text-secondary); }
.t-brand      { color: var(--text-brand); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 0 var(--s-4);
  height: 36px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-snug);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--n-100);
  color: var(--text-primary);
  transition: background var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--n-200); }
.btn:active { background: var(--n-200); transform: translateY(0.5px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Primary */
.btn--primary {
  background: var(--bk-600);
  color: var(--text-inverse);
  border-color: var(--bk-700);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), var(--shadow-xs);
}
.btn--primary:hover { background: var(--bk-700); border-color: var(--bk-800); }
.btn--primary:active { background: var(--bk-800); }

/* Secondary (outline) */
.btn--secondary {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
}
.btn--secondary:hover { background: var(--bg-subtle); border-color: var(--border-strong); }

/* Ghost */
.btn--ghost {
  background: transparent;
  color: var(--text-body);
}
.btn--ghost:hover { background: var(--n-100); }

/* Danger */
.btn--danger {
  background: var(--bg-surface);
  color: var(--bk-700);
  border-color: var(--bk-200);
}
.btn--danger:hover { background: var(--bk-50); border-color: var(--bk-300); }

/* Sizes */
.btn--sm { height: 28px; padding: 0 var(--s-3); font-size: var(--fs-xs); gap: var(--s-1); }
.btn--sm .icon { width: 14px; height: 14px; }
.btn--lg { height: 44px; padding: 0 var(--s-5); font-size: var(--fs-md); }
.btn--lg .icon { width: 18px; height: 18px; }

.btn--icon { width: 36px; padding: 0; }
.btn--icon.btn--sm { width: 28px; }
.btn--icon.btn--lg { width: 44px; }

.btn--block { width: 100%; }

/* ============================================================
   INPUTS
   ============================================================ */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
}
.field__label .req { color: var(--bk-600); margin-left: 2px; }
.field__help {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.field__error {
  font-size: var(--fs-xs);
  color: var(--bk-700);
  display: flex;
  align-items: center;
  gap: var(--s-1);
}

.input, .textarea, .select {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 var(--s-3);
  font-size: var(--fs-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}
.input::placeholder, .textarea::placeholder {
  color: var(--text-muted);
}
.input:hover, .textarea:hover, .select:hover {
  border-color: var(--border-strong);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--bk-600);
  box-shadow: var(--shadow-focus);
}
.input:disabled, .textarea:disabled, .select:disabled {
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
}
.input--error, .textarea--error, .select--error {
  border-color: var(--bk-500);
}
.input--error:focus, .textarea--error:focus { box-shadow: 0 0 0 3px rgba(185,69,69,0.2); }

.textarea { height: auto; min-height: 84px; padding: var(--s-2) var(--s-3); resize: vertical; line-height: var(--lh-normal); }

.input--with-icon { padding-left: 36px; }
.input-wrap { position: relative; }
.input-wrap .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Checkbox / radio */
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--text-body);
  user-select: none;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box {
  width: 16px; height: 16px;
  border-radius: var(--r-xs);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all var(--dur-fast) var(--ease-standard);
  flex-shrink: 0;
}
.check--radio .check__box { border-radius: var(--r-full); }
.check:hover .check__box { border-color: var(--bk-600); }
.check input:checked + .check__box {
  background: var(--bk-600);
  border-color: var(--bk-600);
  color: var(--n-0);
}
.check--radio input:checked + .check__box {
  background: var(--bg-surface);
}
.check--radio input:checked + .check__box::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: var(--r-full);
  background: var(--bk-600);
}
.check input:focus-visible + .check__box {
  box-shadow: var(--shadow-focus);
}

/* Switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  font-size: var(--fs-sm);
  user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  width: 32px; height: 18px;
  background: var(--n-300);
  border-radius: var(--r-full);
  position: relative;
  transition: background var(--dur-fast) var(--ease-standard);
  flex-shrink: 0;
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--n-0);
  border-radius: var(--r-full);
  transition: transform var(--dur-normal) var(--ease-standard);
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .switch__track { background: var(--bk-600); }
.switch input:checked + .switch__track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--shadow-focus); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  padding: var(--s-6);
}
.card--muted { background: var(--bg-subtle); }
.card--interactive { transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast); cursor: pointer; }
.card--interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card--interactive:active { transform: translateY(1px); }

.card__header { display: flex; align-items: start; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-4); }
.card__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text-primary); }
.card__body { color: var(--text-body); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 2px var(--s-2);
  height: 20px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border-radius: var(--r-sm);
  letter-spacing: var(--ls-snug);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--neutral  { background: var(--n-100); color: var(--n-700); border-color: var(--n-200); }
.badge--brand    { background: var(--bk-50); color: var(--bk-700); border-color: var(--bk-100); }
.badge--success  { background: var(--success-50); color: var(--success-700); border-color: var(--success-100); }
.badge--warning  { background: var(--warning-50); color: var(--warning-700); border-color: var(--warning-100); }
.badge--info     { background: var(--info-50); color: var(--info-700); border-color: var(--info-100); }
.badge--danger   { background: var(--bk-50); color: var(--bk-700); border-color: var(--bk-100); }
.badge--solid-brand { background: var(--bk-600); color: var(--n-0); border-color: var(--bk-700); }

.badge .dot { width: 6px; height: 6px; border-radius: var(--r-full); background: currentColor; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
}
.alert__icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.alert__body { flex: 1; }
.alert__title { font-weight: var(--fw-semibold); color: var(--text-primary); margin-bottom: 2px; }

.alert--info    { background: var(--info-50); border-color: var(--info-100); color: var(--info-700); }
.alert--info .alert__title { color: var(--info-700); }
.alert--success { background: var(--success-50); border-color: var(--success-100); color: var(--success-700); }
.alert--success .alert__title { color: var(--success-700); }
.alert--warning { background: var(--warning-50); border-color: var(--warning-100); color: var(--warning-700); }
.alert--warning .alert__title { color: var(--warning-700); }
.alert--danger  { background: var(--bk-50); border-color: var(--bk-100); color: var(--bk-700); }
.alert--danger .alert__title { color: var(--bk-700); }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-default);
  padding: 0 2px;
}
.tab {
  padding: var(--s-2) var(--s-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast), border-color var(--dur-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  position: relative;
}
.tab:hover { color: var(--text-primary); }
.tab[aria-selected="true"] {
  color: var(--text-primary);
  border-bottom-color: var(--bk-600);
}
.tab .count {
  background: var(--n-100);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--r-full);
  font-weight: var(--fw-medium);
}
.tab[aria-selected="true"] .count { background: var(--bk-50); color: var(--bk-700); }

/* Pill tabs variant */
.tabs--pill { border-bottom: none; background: var(--bg-subtle); padding: 4px; border-radius: var(--r-md); gap: 2px; display: inline-flex; }
.tabs--pill .tab { border: none; margin: 0; border-radius: var(--r-sm); padding: 6px var(--s-3); }
.tabs--pill .tab[aria-selected="true"] { background: var(--bg-surface); box-shadow: var(--shadow-xs); color: var(--text-primary); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 14, 13, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--s-4);
  animation: fadeIn var(--dur-normal) var(--ease-standard);
}
.modal {
  background: var(--bg-surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  animation: slideUp var(--dur-normal) var(--ease-emphasized);
}
.modal__header { padding: var(--s-5) var(--s-6) var(--s-3); display: flex; align-items: start; justify-content: space-between; gap: var(--s-4); }
.modal__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text-primary); }
.modal__body  { padding: 0 var(--s-6) var(--s-5); color: var(--text-body); flex: 1; overflow: auto; }
.modal__footer{ padding: var(--s-4) var(--s-6); display: flex; gap: var(--s-2); justify-content: end; border-top: 1px solid var(--border-subtle); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ============================================================
   TOOLTIP (static demo)
   ============================================================ */
.tooltip {
  display: inline-block;
  padding: var(--s-1) var(--s-2);
  font-size: var(--fs-xs);
  background: var(--n-900);
  color: var(--n-0);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

/* ============================================================
   KBD
   ============================================================ */
.kbd {
  display: inline-flex;
  align-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
}

/* ============================================================
   PROGRESS
   ============================================================ */
.progress {
  height: 6px;
  width: 100%;
  background: var(--n-100);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: var(--bk-600);
  border-radius: inherit;
  transition: width var(--dur-slow) var(--ease-standard);
}

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  background: var(--bk-100);
  color: var(--bk-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-snug);
  flex-shrink: 0;
  user-select: none;
}
.avatar--sm { width: 24px; height: 24px; font-size: var(--fs-xs); }
.avatar--lg { width: 40px; height: 40px; font-size: var(--fs-md); }

/* ============================================================
   DIVIDER
   ============================================================ */
.divider { height: 1px; background: var(--border-default); border: none; margin: 0; }

/* ============================================================
   MENU (list rows)
   ============================================================ */
.menu {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: var(--s-1);
  min-width: 200px;
}
.menu__item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px var(--s-2);
  width: 100%;
  font-size: var(--fs-sm);
  color: var(--text-body);
  border-radius: var(--r-sm);
  text-align: left;
  justify-content: space-between;
}
.menu__item:hover, .menu__item:focus { background: var(--bg-hover); color: var(--text-primary); }
.menu__item .icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.menu__item--danger { color: var(--bk-700); }
.menu__item--danger:hover { background: var(--bk-50); color: var(--bk-800); }
.menu__sep { height: 1px; background: var(--border-subtle); margin: var(--s-1) 0; }
