/* James Travel Planner — Core Components */

/* ── Button ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-snug);
  line-height: 1;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast), box-shadow var(--dur-fast), color var(--dur-fast);
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring-focus); }

.btn-primary {
  background: var(--brand-500);
  color: var(--text-inverse);
  border-color: var(--brand-600);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 1px 2px rgba(11,27,43,0.15);
}
.btn-primary:hover { background: var(--brand-600); color: var(--text-inverse); }
.btn-primary:active { background: var(--brand-700); }

.btn-secondary {
  background: var(--surface-1);
  color: var(--text-primary);
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

.btn-accent {
  background: var(--accent-500);
  color: var(--text-inverse);
  border-color: var(--accent-600);
}
.btn-accent:hover { background: var(--accent-600); color: var(--text-inverse); }

.btn-danger {
  background: var(--surface-1);
  color: var(--danger-500);
  border-color: var(--border-default);
}
.btn-danger:hover { background: var(--danger-50); border-color: var(--danger-500); }

.btn-sm { padding: 6px 10px; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 20px; font-size: var(--text-lg); border-radius: var(--radius-md); }
.btn-icon {
  width: 28px; height: 28px; padding: 0;
  border-radius: var(--radius-sm);
}
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ── Input ──────────────────────────────────────────────────── */
.input, .textarea, .select {
  width: 100%;
  padding: 8px 12px;
  min-height: 44px;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-md);
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--ring-focus);
}
.input::placeholder, .textarea::placeholder { color: var(--text-disabled); }
.input-sm { padding: 6px 10px; font-size: var(--text-sm); }

.label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-pad { padding: var(--space-6); }
.card-head {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin: 0;
}

/* ── Badge ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-snug);
  border: 1px solid transparent;
  line-height: 1.5;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge-neutral { background: var(--surface-2); color: var(--text-secondary); border-color: var(--border-subtle); }
.badge-brand { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.badge-accent { background: var(--accent-50); color: var(--accent-700); border-color: var(--accent-100); }
.badge-success { background: var(--success-50); color: var(--success-700); }
.badge-warning { background: var(--warning-50); color: var(--warning-700); }
.badge-danger { background: var(--danger-50); color: var(--danger-700); }
.badge-sand { background: var(--sand-50); color: var(--sand-500); border-color: var(--sand-100); }

/* ── Tab ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
}
.tab {
  padding: 10px 14px;
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--text-tertiary);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--dur-fast);
}
.tab:hover { color: var(--text-secondary); }
.tab.active {
  color: var(--brand-600);
  border-bottom-color: var(--brand-500);
}

/* ── Divider ────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-subtle); border: none; margin: 0; }
.divider-v { width: 1px; background: var(--border-subtle); align-self: stretch; }

/* ── Progress / Meter ──────────────────────────────────────── */
.meter {
  width: 100%;
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.meter-bar {
  height: 100%;
  background: var(--brand-500);
  border-radius: var(--radius-full);
  transition: width var(--dur-med) var(--ease-out);
}
.meter-bar.accent { background: var(--accent-500); }
.meter-bar.warning { background: var(--warning-500); }
.meter-bar.danger { background: var(--danger-500); }

/* ── Avatar ─────────────────────────────────────────────────── */
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  border: 2px solid var(--surface-1);
  flex-shrink: 0;
}
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar + .avatar { margin-left: -8px; }

/* ── Kbd ────────────────────────────────────────────────────── */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 1px 5px;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

/* ── Tooltip utility (visual only) ──────────────────────────── */
.tooltip {
  position: absolute;
  padding: 4px 8px;
  background: var(--text-primary);
  color: var(--text-inverse);
  font-size: var(--text-xs);
  border-radius: var(--radius-xs);
  white-space: nowrap;
  pointer-events: none;
}

/* ── Segment control ────────────────────────────────────────── */
.segment {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.segment-item {
  padding: 6px 12px;
  min-height: 32px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all var(--dur-fast);
}
.segment-item.active {
  background: var(--surface-1);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
/* Trip-type chooser — 4 narrow cells need tighter padding + no wrap so labels fit one line. */
.segment--trip-type .segment-item {
  padding: 6px 4px;
  font-size: 13px;
  white-space: nowrap;
  text-align: center;
  min-width: 0;
}
/* Suppress the persistent browser focus ring after click; keep it for keyboard users only. */
.segment-item:focus { outline: none; }
.segment-item:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
@media (max-width: 420px) {
  .segment--trip-type { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* ── Icon sizing ────────────────────────────────────────────── */
.icon { width: 16px; height: 16px; stroke-width: 1.75; flex-shrink: 0; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }

/* ── Photo placeholder ──────────────────────────────────────── */
.photo-ph {
  background:
    linear-gradient(135deg, var(--brand-100) 0%, var(--accent-100) 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-700);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.photo-ph::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0 12px,
    rgba(255,255,255,0.15) 12px 13px
  );
}
