/* ─────────────────────────────────────────────────────────────
   glp1.party // Enterprise UI Primitives
   Atomic Form Controls · Steppers · Standardized Heights & Radii
   ───────────────────────────────────────────────────────────── */

/* ── Form Controls & Discipline ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
}

.form-label {
  font-size: var(--font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-helper {
  font-size: var(--font-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.form-error {
  font-size: var(--font-xs);
  color: var(--status-rose-text);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-base,
.select-base,
.textarea-base {
  width: 100%;
  height: var(--input-height-md);
  padding: 0 var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--font-sm);
  color: var(--text-primary);
  line-height: normal;
  box-sizing: border-box;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-base:hover,
.select-base:hover,
.textarea-base:hover {
  border-color: var(--border-hover);
}

.input-base:focus,
.select-base:focus,
.textarea-base:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--pink-ring);
}

.input-base[disabled],
.select-base[disabled],
.textarea-base[disabled] {
  background: var(--surface-subtle);
  color: var(--text-subtle);
  cursor: not-allowed;
  border-color: var(--border-subtle);
}

/* Semantic Size Variants */
.input-sm,
.select-sm {
  height: var(--input-height-sm);
  font-size: var(--font-xs);
  padding: 0 var(--space-2);
}

.input-lg,
.select-lg {
  height: var(--input-height-lg);
  font-size: var(--font-base);
  padding: 0 var(--space-4);
}

.textarea-base {
  height: auto;
  min-height: 88px;
  padding: var(--space-2) var(--space-3);
  resize: vertical;
}

/* Semantic Constrained Widths */
.input-qty {
  width: var(--input-qty-width);
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.input-zip {
  width: var(--input-zip-width);
  letter-spacing: 0.05em;
  text-align: center;
}

.input-currency {
  width: var(--input-cur-width);
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
}

/* Addon Input Containers */
.input-addon-wrap {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

.input-addon-wrap .input-base {
  padding-left: 28px;
}

.input-addon-prefix {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--font-sm);
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}

/* Stepper Quantity Widget */
.stepper-control {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: var(--input-height-sm);
}

.stepper-btn {
  width: 28px;
  height: 100%;
  border: none;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
}

.stepper-btn:hover:not(:disabled) {
  background: var(--pink-bg);
  color: var(--pink);
}

.stepper-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.stepper-input {
  width: 44px;
  height: 100%;
  border: none;
  background: var(--surface);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--font-xs);
  font-weight: 700;
  color: var(--text-primary);
  box-shadow: none;
  padding: 0;
  -moz-appearance: textfield;
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--input-height-md);
  padding: 0 var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--font-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--pink);
  color: var(--text-inverse);
  border-color: var(--pink);
  box-shadow: 0 1px 2px rgba(225, 29, 72, 0.16);
}

.btn-primary:hover {
  background: var(--pink-hover);
  border-color: var(--pink-hover);
}

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

.btn-secondary:hover {
  background: var(--surface-subtle);
  border-color: var(--border-hover);
}

.btn-success {
  background: var(--status-emerald-bg);
  color: var(--status-emerald-text);
  border-color: var(--status-emerald-border);
}

.btn-success:hover {
  background: #d1fae5;
}

.btn-danger {
  background: var(--status-rose-bg);
  color: var(--status-rose-text);
  border-color: var(--status-rose-border);
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
}

.btn-sm {
  height: var(--input-height-sm);
  padding: 0 var(--space-3);
  font-size: var(--font-xs);
}

.btn-lg {
  height: var(--input-height-lg);
  padding: 0 var(--space-6);
  font-size: var(--font-base);
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

/* ── Badges & Status Chips ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--font-2xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-emerald {
  background: var(--status-emerald-bg);
  border: 1px solid var(--status-emerald-border);
  color: var(--status-emerald-text);
}

.badge-amber {
  background: var(--status-amber-bg);
  border: 1px solid var(--status-amber-border);
  color: var(--status-amber-text);
}

.badge-rose {
  background: var(--status-rose-bg);
  border: 1px solid var(--status-rose-border);
  color: var(--status-rose-text);
}

.badge-indigo {
  background: var(--status-indigo-bg);
  border: 1px solid var(--status-indigo-border);
  color: var(--status-indigo-text);
}

.badge-neutral {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* ── Cards & Containers ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}

.card-body {
  padding: var(--space-5);
}

.card-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--canvas);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* ── Tables & Data Grids ── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.table-base {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
  text-align: left;
}

.table-base th {
  background: #fafbfc;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  font-size: var(--font-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.table-base td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table-base tr:last-child td {
  border-bottom: none;
}

/* ── Empty States ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.empty-state__icon {
  font-size: 32px;
  margin-bottom: var(--space-2);
  color: var(--text-muted);
}

.empty-state__title {
  font-size: var(--font-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.empty-state__desc {
  font-size: var(--font-sm);
  color: var(--text-muted);
  max-width: 380px;
  line-height: 1.5;
}

/* ── Modals & Dialogs ── */
.modal-overlay,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--surface-overlay);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: modalFadeIn 0.15s ease-out;
}

.modal-overlay.is-open,
.modal-overlay.is-active,
.modal-backdrop.is-open,
.modal-backdrop.is-active {
  display: flex !important;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
}

.modal-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.modal-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--canvas);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Clinical Toast Notifications ── */
#clinical-toast-viewport {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  max-width: 380px;
  width: 100%;
}

.clinical-toast {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  transform: translateY(12px);
  opacity: 0;
  transition: transform var(--transition-smooth), opacity var(--transition-smooth);
}

.clinical-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.clinical-toast.is-dismissing {
  transform: translateY(-8px);
  opacity: 0;
}

.clinical-toast__icon {
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  margin-top: 2px;
}

.clinical-toast__content {
  flex: 1;
  font-size: var(--font-sm);
  color: var(--text-primary);
}

.clinical-toast__title {
  display: block;
  font-weight: 700;
  margin-bottom: 2px;
}

.clinical-toast__message {
  font-size: var(--font-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.clinical-toast__close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.clinical-toast--success {
  border-left: 4px solid var(--status-emerald-dot);
}
.clinical-toast--success .clinical-toast__icon {
  color: var(--status-emerald-dot);
}

.clinical-toast--error {
  border-left: 4px solid var(--status-rose-dot);
}
.clinical-toast--error .clinical-toast__icon {
  color: var(--status-rose-dot);
}

.clinical-toast--warning {
  border-left: 4px solid var(--status-amber-dot);
}
.clinical-toast--warning .clinical-toast__icon {
  color: var(--status-amber-dot);
}

.clinical-toast--info {
  border-left: 4px solid var(--pink);
}
.clinical-toast--info .clinical-toast__icon {
  color: var(--pink);
}
