/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: var(--color-background);
  color: var(--color-foreground);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1;
  box-shadow: var(--shadow-xs);
}

.btn:hover {
  background-color: var(--color-accent);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(163, 163, 163, 0.5);
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

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

.btn--primary:hover {
  background-color: var(--color-primary);
  opacity: 0.9;
}

.btn--danger {
  background-color: var(--color-destructive);
  color: #ffffff;
  border-color: var(--color-destructive);
}

.btn--danger:hover {
  background-color: var(--color-destructive);
  opacity: 0.9;
}

.btn--ghost {
  border-color: transparent;
  background-color: transparent;
  box-shadow: none;
}

.btn--ghost:hover {
  background-color: var(--color-accent);
}

.btn--small {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  gap: 6px;
  border-radius: var(--radius-md);
}

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

/* Solid near-black and soft white buttons used on landing pages */

.btn--dark {
  background-color: #111111;
  color: #ffffff;
  border-color: #111111;
}

.btn--dark:hover {
  background-color: #2a2a2a;
  border-color: #2a2a2a;
}

.btn--light {
  background-color: #ffffff;
  color: #111111;
  border-color: #e5e7eb;
}

.btn--light:hover {
  background-color: #f5f5f5;
}

/* ============================================================
   Tables
   ============================================================ */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.table__head {
  border-bottom: 1px solid var(--color-border);
}

.table__th {
  height: 40px;
  padding: 0 12px;
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  color: var(--color-foreground);
  white-space: nowrap;
}

.table__body .table__row {
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.15s;
}

.table__body .table__row:last-child {
  border-bottom: none;
}

.table__body .table__row:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.table__row--muted {
  opacity: 0.6;
}

.table__td {
  padding: 12px;
  vertical-align: middle;
}

.table__link {
  color: var(--color-foreground);
  font-weight: 500;
}

.table__link:hover {
  text-decoration: underline;
}

/* Grouped list tables: section heading row, category sub-heading row, and the
   square thumbnail that fronts each record. */
.table__group-cell {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-foreground);
  background-color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.table__group--for-him .table__group-cell {
  box-shadow: inset 3px 0 0 #1e40af;
}

.table__group--for-her .table__group-cell {
  box-shadow: inset 3px 0 0 #9d174d;
}

.table__group-title {
  margin-right: 8px;
}

.table__group-count {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-muted-foreground);
}

.table__subgroup-cell {
  padding: 8px 12px 8px 20px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-muted-foreground);
  background-color: var(--color-background);
  border-bottom: 1px solid var(--color-border);
}

.table__subgroup-count {
  margin-left: 8px;
  font-weight: 400;
  color: var(--color-muted-foreground);
}

.table__td--thumb {
  width: 56px;
  padding-right: 0;
}

.table__thumb {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: var(--color-muted);
}

.table__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-muted-foreground);
}

.table__meta {
  margin-top: 4px;
}

.table__td--empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--color-muted-foreground);
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.4;
}

.badge--success {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
}

.badge--warning {
  background-color: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.badge--danger {
  background-color: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.badge--muted {
  background-color: var(--color-muted);
  color: var(--color-muted-foreground);
}

.badge--info {
  background-color: var(--color-info-bg);
  color: var(--color-info-text);
}

/* Storefront section badges — the cue that separates the For Him / For Her
   twins that share a product or category name. */
.badge--for-him {
  background-color: #e0edff;
  color: #1e40af;
}

.badge--for-her {
  background-color: #fce7f3;
  color: #9d174d;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}

.card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.card__header strong {
  font-weight: 600;
}

.card__meta {
  font-size: 12px;
  color: var(--color-muted-foreground);
  margin-left: auto;
}

.card__body {
  padding: 16px 24px;
}

.card__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.card__item:last-child {
  border-bottom: none;
}

/* ============================================================
   Detail View
   ============================================================ */

.detail {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.detail__row {
  display: flex;
  padding: 12px 24px;
  border-bottom: 1px solid var(--color-border);
  gap: 16px;
}

.detail__row:last-child {
  border-bottom: none;
}

.detail__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-muted-foreground);
  min-width: 140px;
  flex-shrink: 0;
}

.detail__value {
  font-size: 14px;
  color: var(--color-foreground);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   Flash Messages
   ============================================================ */

/* ---- Toasts ---- */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
  pointer-events: auto;
  transform: translateX(calc(100% + 20px));
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: 420px;
}

.toast--visible {
  transform: translateX(0);
  opacity: 1;
}

.toast--notice {
  background: #ffffff;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.toast--alert {
  background: #ffffff;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.toast__message {
  flex: 1;
  line-height: 1.4;
}

.toast__close {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
  padding: 0 2px;
}

.toast__close:hover {
  opacity: 1;
}

@media (max-width: 480px) {
  .toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .toast {
    max-width: 100%;
  }
}

/* ============================================================
   Prose (content preview)
   ============================================================ */

.prose {
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-foreground);
}

.prose p {
  margin-bottom: 16px;
}

.prose h1, .prose h2, .prose h3 {
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: 24px;
}

.prose ul, .prose ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.prose a {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ============================================================
   Confirm Modal
   ============================================================ */

.confirm-modal {
  border: none;
  border-radius: var(--radius-xl);
  padding: 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  max-width: 400px;
  width: calc(100% - 32px);
  margin: auto;
}

.confirm-modal::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.confirm-modal__content {
  padding: 24px;
}

.confirm-modal__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-foreground);
  margin-bottom: 8px;
}

.confirm-modal__message {
  font-size: 14px;
  color: var(--color-muted-foreground);
  line-height: 1.5;
  margin-bottom: 20px;
}

.confirm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---- Scroll Reveal ---- */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Reduced motion: skip animations */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   Dropdown (custom select)
   ============================================================ */

.dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
}

.dropdown--inline {
  width: auto;
}

.dropdown__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--color-foreground);
  background-color: var(--color-background);
  border: 1px solid var(--color-input);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  text-align: left;
  line-height: 1;
}

.dropdown__trigger:focus,
.dropdown__trigger:focus-visible {
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px rgba(163, 163, 163, 0.3);
}

.dropdown__trigger[aria-expanded="true"] {
  border-color: var(--color-ring);
}

.dropdown__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.dropdown__label--placeholder {
  color: var(--color-muted-foreground);
}

.dropdown__chevron {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  color: var(--color-muted-foreground);
  transition: transform 0.2s;
}

.dropdown__trigger[aria-expanded="true"] .dropdown__chevron {
  transform: rotate(180deg);
}

.dropdown__menu {
  display: none;
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.dropdown__menu--open {
  display: block;
  animation: dropdown-in 0.12s ease-out;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown__option {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--color-foreground);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.1s;
  user-select: none;
}

.dropdown__option:hover,
.dropdown__option--focused {
  background-color: var(--color-accent);
}

.dropdown__option[aria-selected="true"] {
  font-weight: 500;
}

.dropdown__option[aria-selected="true"]::after {
  content: "";
  display: block;
  margin-left: auto;
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%231a1a1a'%3e%3cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3e%3c/svg%3e");
  background-size: contain;
  background-repeat: no-repeat;
}

/* Search within dropdown */
.dropdown__search {
  position: sticky;
  top: 0;
  padding: 4px;
  background-color: var(--color-background);
  list-style: none;
}

.dropdown__search-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--color-foreground);
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
}

.dropdown__search-input:focus {
  border-color: var(--color-ring);
}

.dropdown__search-input::placeholder {
  color: var(--color-muted-foreground);
}

/* Small variant for compact layouts */
.dropdown--small .dropdown__trigger {
  height: 32px;
  font-size: 13px;
  padding: 0 10px;
}

.dropdown--small .dropdown__option {
  padding: 6px 10px;
  font-size: 13px;
}

/* ============================================
   Form Steps (multi-panel forms with progress)
   ============================================ */

/* Keeps the form clear of the sticky site header when a panel change scrolls it into view. */
.form-steps {
  scroll-margin-top: 96px;
}

.form-steps__panel {
  display: none;
}

.form-steps__panel--active {
  display: block;
  animation: form-steps-in 0.25s ease;
}

@keyframes form-steps-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.form-steps__progress {
  margin-bottom: 28px;
}

.form-steps__progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-muted-foreground, #6b7280);
  margin-bottom: 8px;
}

.form-steps__progress-track {
  height: 6px;
  background: #e5e7eb;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.form-steps__progress-fill {
  height: 100%;
  width: 0;
  background: var(--theme-accent, var(--color-primary, #111827));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.form-steps__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.form-steps__nav-primary {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.form-steps__nav-primary .btn {
  max-width: 320px;
}

.form-steps [hidden] {
  display: none !important;
}

@media (max-width: 639px) {
  .form-steps__nav {
    position: sticky;
    bottom: 0;
    padding: 12px 0;
    background: #ffffff;
    border-top: 1px solid #f3f4f6;
  }

  .form-steps__nav-primary .btn {
    max-width: none;
  }
}
