/* Copyright 2026 Renofy Ltd. All rights reserved. */
/* Shared modal chrome — used by all modals site-wide.
   Per-modal decorations live in <name>-modal.css and reference these classes. */

/* === Overlay === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-index-modal);
  padding: 0.75rem;
  opacity: 0;
  animation: modalOverlayIn 0.25s ease-out forwards;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes modalOverlayIn {
  to {
    opacity: 1;
  }
}

/* === Card === */
.modal {
  background: var(--color-white);
  border-radius: var(--radius-2xl);
  max-width: 440px;
  width: 100%;
  max-height: calc(100vh - 1.5rem);
  overflow-y: auto;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 18px 48px rgba(0, 0, 0, 0.14);
  transform: scale(0.96) translateY(8px);
  animation: modalCardIn 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) 0.05s forwards;
  padding: 1.5rem;
  position: relative;
}

@keyframes modalCardIn {
  to {
    transform: scale(1) translateY(0);
  }
}

/* === Close X (top-right) === */
.modal__close-x {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
  z-index: 1;
}

.modal__close-x:hover,
.modal__close-x:focus-visible {
  color: var(--color-text-primary);
  outline: none;
}

/* === Title === */
.modal__title {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  letter-spacing: var(--letter-spacing-tight);
  margin: 0 0 0.5rem 0;
}

/* === Body / message === */
.modal__body,
.modal__message {
  /* Hardcoded 16px on both viewports for readability — matches chat_widget.css
     pattern. --font-size-base shrinks to 14px on mobile, too small here. */
  font-size: 16px;
  color: var(--color-text-secondary);
  line-height: var(--line-height-normal);
  margin: 0 0 1.25rem 0;
}

/* === Dismiss checkbox ("Don't show this again" pattern) === */
.modal__dismiss {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0.25rem 0;
  margin: 0 0 0.5rem 0;
  user-select: none;
}

.modal__dismiss input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-blue);
  cursor: pointer;
  margin: 0;
  flex: 0 0 auto;
}

/* === Actions row === */
.modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal__actions .button {
  width: 100%;
}

/* === Horizontal variant — secondary left, primary right ===
   Keeps the primary CTA on the right edge (under the thumb on mobile).
   A wrapping <form> around a button is made transparent to the flex layout
   via display: contents so the button itself becomes the flex child. */
.modal__actions--horizontal {
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
}

.modal__actions--horizontal > form {
  display: contents;
}

.modal__actions--horizontal .button {
  width: auto;
}

/* Primary CTA flexes to fill the remaining width on the right. */
.modal__actions--horizontal .button--pink {
  flex: 1;
}

/* === Centered variant (e.g. celebrations) === */
.modal--centered {
  text-align: center;
}

.modal--centered .modal__actions {
  align-items: center;
}

/* === Desktop === */
@media (min-width: 821px) {
  .modal {
    max-width: 500px;
    padding: 2rem 2rem;
  }

  .modal__title {
    font-size: var(--font-size-2xl);
  }
}
