/* A4 WAYPOINT shared components: buttons, chips, cards, forms, tabs, states, toast. */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s var(--ease-out);
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 2px 6px rgba(207, 74, 12, 0.25), 0 8px 18px rgba(207, 74, 12, 0.18);
}

.btn-primary:hover {
  background: var(--orange-hover);
}

.btn-dark {
  background: var(--navy);
  color: #fff;
}

.btn-dark:hover {
  background: var(--navy-700);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  border-color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.875rem;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  color: var(--ink-3);
  transition: background-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--danger-tint);
  color: var(--danger);
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--orange);
  text-decoration: none;
}

.link-arrow .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s var(--ease-out);
}

.link-arrow:hover .icon {
  transform: translateX(3px);
}

/* Badges and chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-sample {
  background: var(--orange-tint);
  color: #9a3412;
  letter-spacing: 0.04em;
}

.badge-lime {
  background: var(--lime-tint);
  color: var(--lime-ink);
}

.badge-blue {
  background: var(--blue-tint);
  color: var(--blue);
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip-row .chip,
.tabs .tab {
  scroll-snap-align: start;
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.875rem;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.chip[aria-pressed="true"],
.chip[aria-selected="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.chip .count {
  font-size: 0.75rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.chip[aria-pressed="true"] .count,
.chip[aria-selected="true"] .count {
  color: rgba(255, 255, 255, 0.82);
}

/* Scrolling rows clip outlines, so their focus ring sits inside the control. */
.chip-row .chip:focus-visible,
.tabs .tab:focus-visible {
  outline-offset: -3px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad {
  padding: var(--space-5);
}

.icon-tile {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--orange-tint);
  color: var(--orange);
  flex: none;
}

.icon-tile .icon {
  width: 22px;
  height: 22px;
}

.icon-tile.is-lime {
  background: var(--lime-tint);
  color: var(--lime-ink);
}

.icon-tile.is-blue {
  background: var(--blue-tint);
  color: var(--blue);
}

.icon-tile.is-navy {
  background: var(--navy);
  color: var(--lime);
}

/* Forms */
.field {
  display: grid;
  gap: 6px;
}

.field label,
.field-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink);
}

.field .hint {
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23454d6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.input::placeholder,
.textarea::placeholder {
  color: #687089;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--ink-3);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(11, 99, 196, 0.2);
}

.search-field {
  position: relative;
}

.search-field .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

.search-field .input {
  padding-left: 44px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.tab .icon {
  width: 18px;
  height: 18px;
}

/* Progress */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

/* The bar scales from the left: set --p between 0 and 1. Transform keeps it off the layout path. */
.progress-bar {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--lime);
  transform: scaleX(var(--p, 0));
  transform-origin: left center;
  transition: transform 0.45s var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar {
    transition: none;
  }
}

/* Loading, error, and empty states */
.state {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-7) var(--space-5);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink-2);
}

.state h3 {
  font-size: var(--step-1);
  color: var(--ink);
}

.state p {
  max-width: 44ch;
}

.state .icon-tile {
  margin-bottom: var(--space-2);
}

.state-error .icon-tile {
  background: var(--danger-tint);
  color: var(--danger);
}

.skeleton-grid {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .skeleton-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.skeleton {
  height: 180px;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--surface-2) 0%, #f8f9fc 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

/* Toast */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 200;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-weight: 500;
  font-size: 0.9375rem;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.35s var(--ease-out);
}

.toast .icon {
  color: var(--lime);
  width: 18px;
  height: 18px;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }
}

/* Toolbar used by the tools */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Notice */
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--blue-tint);
  color: #0a4a93;
  font-size: 0.9375rem;
}

.notice .icon {
  margin-top: 2px;
}

/* Contact actions on resource cards */
.contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.8125rem;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.contact-btn:hover {
  border-color: var(--ink);
  text-decoration: none;
}

.contact-btn .icon {
  width: 16px;
  height: 16px;
}

.contact-btn.is-whatsapp .icon {
  color: #128c4a;
}

.contact-btn.is-call .icon {
  color: var(--blue);
}

.contact-btn.is-mail .icon {
  color: var(--orange);
}

/* Highlighted prompt placeholders */
.ph {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--orange-tint);
  color: #9a3412;
  font-weight: 600;
}

.ph.is-filled {
  background: var(--lime-tint);
  color: var(--lime-ink);
}
