/**
 * 22 HUES — Form Modal
 *
 * Branded, namespaced modal for form-submission feedback. Replaces the native
 * alert() / confirm() popups that ship from older flows. All selectors live
 * under #tt-form-modal so the dashboard's global typography and form rules
 * cannot bleed in.
 *
 * @package 22Hues
 */

#tt-form-modal,
#tt-form-modal *,
#tt-form-modal *::before,
#tt-form-modal *::after {
  box-sizing: border-box;
}

#tt-form-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 20px 32px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #191919;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#tt-form-modal.tt-fm-open {
  display: flex;
}

#tt-form-modal .tt-fm__scrim {
  position: fixed;
  inset: 0;
  background: rgba(25, 25, 25, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 220ms ease;
  z-index: 1;
}

#tt-form-modal.tt-fm-visible .tt-fm__scrim {
  opacity: 1;
}

#tt-form-modal .tt-fm__card {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: #FAF8F5;
  color: #191919;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(25, 25, 25, 0.25), 0 8px 24px rgba(25, 25, 25, 0.12);
  z-index: 2;
  overflow: hidden;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 200ms ease;
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
  letter-spacing: 0;
  text-transform: none;
}

#tt-form-modal .tt-fm__card.tt-fm__card--wide {
  max-width: min(640px, 100vw - 40px);
}

#tt-form-modal.tt-fm-visible .tt-fm__card {
  transform: translateY(0);
  opacity: 1;
}

#tt-form-modal .tt-fm__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(25, 25, 25, 0.1);
  background: rgba(255, 255, 255, 0.85);
  color: #191919;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font: inherit;
  transition: background 150ms ease, transform 150ms ease;
  z-index: 3;
}

#tt-form-modal .tt-fm__close:hover {
  background: #fff;
  transform: scale(1.04);
}

#tt-form-modal .tt-fm__close:focus-visible {
  outline: 2px solid #A37E2C;
  outline-offset: 2px;
}

#tt-form-modal .tt-fm__close svg {
  width: 16px;
  height: 16px;
}

#tt-form-modal .tt-fm__head {
  padding: 28px 32px 18px;
  border-bottom: 1px solid rgba(25, 25, 25, 0.07);
  background: #fff;
}

#tt-form-modal .tt-fm__icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  flex: 0 0 auto;
}

#tt-form-modal .tt-fm--success .tt-fm__icon {
  background: rgba(45, 125, 70, 0.12);
  color: #2D7D46;
}

#tt-form-modal .tt-fm--error .tt-fm__icon {
  background: rgba(192, 57, 43, 0.12);
  color: #C0392B;
}

#tt-form-modal .tt-fm--info .tt-fm__icon,
#tt-form-modal .tt-fm--confirm .tt-fm__icon,
#tt-form-modal .tt-fm--warning .tt-fm__icon {
  background: rgba(163, 126, 44, 0.14);
  color: #A37E2C;
}

#tt-form-modal .tt-fm__icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

#tt-form-modal .tt-fm__eyebrow {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #A37E2C;
  margin-bottom: 8px;
  text-align: left;
}

#tt-form-modal .tt-fm__title {
  margin: 0 0 6px;
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 500;
  font-size: 30px;
  line-height: 1.15;
  color: #191919;
  letter-spacing: -0.005em;
  text-transform: none;
}

#tt-form-modal .tt-fm__summary {
  margin: 4px 0 0;
  color: #4A4A4A;
  font-size: 14px;
  line-height: 1.55;
}

#tt-form-modal .tt-fm__body {
  padding: 22px 32px 4px;
  background: #FAF8F5;
  max-height: calc(100vh - 320px);
  overflow-y: auto;
}

#tt-form-modal .tt-fm__section {
  margin-bottom: 22px;
}

#tt-form-modal .tt-fm__section:last-child {
  margin-bottom: 4px;
}

#tt-form-modal .tt-fm__section-heading {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6B6B6B;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  text-align: left;
}

#tt-form-modal .tt-fm__rows {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1.3fr);
  gap: 10px 18px;
  border-top: 1px solid rgba(25, 25, 25, 0.06);
  padding-top: 12px;
}

#tt-form-modal .tt-fm__row-label {
  font-size: 12px;
  font-weight: 500;
  color: #6B6B6B;
  letter-spacing: 0.04em;
  text-transform: none;
  align-self: start;
  padding-top: 2px;
}

#tt-form-modal .tt-fm__row-value {
  font-size: 14px;
  color: #191919;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  line-height: 1.5;
}

#tt-form-modal .tt-fm__row-value--mono,
#tt-form-modal .tt-fm__row-value code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace;
  font-size: 13px;
  background: rgba(25, 25, 25, 0.04);
  padding: 2px 6px;
  border-radius: 4px;
}

#tt-form-modal .tt-fm__row-value a {
  color: #A37E2C;
  text-decoration: none;
  border-bottom: 1px solid rgba(163, 126, 44, 0.4);
}

#tt-form-modal .tt-fm__row-value a:hover {
  color: #8A6A24;
  border-bottom-color: #8A6A24;
}

#tt-form-modal .tt-fm__note {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
  background: rgba(163, 126, 44, 0.08);
  border: 1px solid rgba(163, 126, 44, 0.18);
  color: #4A4A4A;
}

#tt-form-modal .tt-fm--success .tt-fm__note {
  background: rgba(45, 125, 70, 0.08);
  border-color: rgba(45, 125, 70, 0.2);
}

#tt-form-modal .tt-fm--error .tt-fm__note {
  background: rgba(192, 57, 43, 0.08);
  border-color: rgba(192, 57, 43, 0.2);
}

#tt-form-modal .tt-fm__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  padding: 18px 32px 24px;
  background: #FAF8F5;
  border-top: 1px solid rgba(25, 25, 25, 0.07);
  position: sticky;
  bottom: 0;
}

#tt-form-modal .tt-fm__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 150ms ease;
  line-height: 1;
}

#tt-form-modal .tt-fm__btn:focus-visible {
  outline: 2px solid #A37E2C;
  outline-offset: 2px;
}

#tt-form-modal .tt-fm__btn--primary {
  background: #191919;
  color: #FFFFFF;
  border-color: #191919;
}

#tt-form-modal .tt-fm__btn--primary:hover {
  background: #2a2a2a;
  border-color: #2a2a2a;
  color: #FFFFFF;
}

#tt-form-modal .tt-fm__btn--danger {
  background: #C0392B;
  color: #FFFFFF;
  border-color: #C0392B;
}

#tt-form-modal .tt-fm__btn--danger:hover {
  background: #a52f24;
  border-color: #a52f24;
  color: #FFFFFF;
}

#tt-form-modal .tt-fm__btn--ghost {
  background: transparent;
  color: #191919;
  border-color: rgba(25, 25, 25, 0.18);
}

#tt-form-modal .tt-fm__btn--ghost:hover {
  border-color: #191919;
  background: rgba(25, 25, 25, 0.04);
  color: #191919;
}

#tt-form-modal .tt-fm__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.tt-fm-locked {
  overflow: hidden;
}

@media (max-width: 600px) {
  #tt-form-modal {
    padding: 0;
    align-items: stretch;
  }

  #tt-form-modal .tt-fm__card--wide {
    max-width: none;
  }

  #tt-form-modal .tt-fm__card {
    border-radius: 0;
    max-width: none;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  #tt-form-modal .tt-fm__head {
    padding: 56px 22px 18px;
  }

  #tt-form-modal .tt-fm__title {
    font-size: 26px;
  }

  #tt-form-modal .tt-fm__body {
    padding: 18px 22px 4px;
    flex: 1 1 auto;
    max-height: none;
  }

  #tt-form-modal .tt-fm__rows {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }

  #tt-form-modal .tt-fm__row-label {
    font-size: 11px;
    padding-top: 0;
  }

  #tt-form-modal .tt-fm__row-value {
    margin-bottom: 10px;
  }

  #tt-form-modal .tt-fm__foot {
    padding: 14px 18px 18px;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
    position: sticky;
    bottom: 0;
  }

  #tt-form-modal .tt-fm__btn {
    width: 100%;
  }

  #tt-form-modal .tt-fm__close {
    top: 10px;
    right: 10px;
  }
}
