/* ==========================================================================
   Vitta Agenda — Modal (componente js/modal.js)
   Celular: folha que sobe da parte de baixo. Telas maiores: janela central.
   ========================================================================== */

.modal {
  position: fixed; inset: 0; z-index: 250;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 34, 41, .52);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .22s var(--ease);
}
.modal__panel {
  position: relative; width: 100%;
  max-height: calc(100dvh - 24px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(28px);
  transition: opacity .22s var(--ease), transform .26s var(--ease);
}
.modal__panel:focus-visible { box-shadow: var(--shadow-lg), var(--ring); }
.modal.is-open .modal__backdrop { opacity: 1; }
.modal.is-open .modal__panel { opacity: 1; transform: none; }

/* "alça" visual da folha no celular */
.modal__panel::before {
  content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px;
  border-radius: 4px; background: var(--line-2);
}

.modal__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.5rem 1.25rem .875rem;
}
.modal__titles { min-width: 0; }
.modal__title { font-size: var(--fs-xl); letter-spacing: -.02em; }
.modal__desc { margin-top: .25rem; font-size: var(--fs-sm); color: var(--ink-2); }
.modal__close {
  flex-shrink: 0; display: grid; place-items: center; width: 40px; height: 40px; margin: -4px -4px 0 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-2);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.modal__close:hover { background: var(--petrol-50); color: var(--ink); }
.modal__close:focus-visible { border-radius: 50%; }

.modal__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 1.25rem 1.25rem; }
.modal__foot {
  display: flex; flex-direction: column-reverse; gap: .5rem;
  padding: .875rem 1.25rem calc(.875rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.modal__message { color: var(--ink-2); display: grid; gap: .875rem; }
.modal__message strong { color: var(--ink); }

/* Aviso dentro de modais (ex.: política de cancelamento) */
.notice {
  display: flex; gap: .625rem; align-items: flex-start;
  padding: .75rem .875rem; border-radius: var(--radius-sm);
  background: var(--petrol-50); color: var(--petrol-800); font-size: var(--fs-sm); line-height: 1.5;
}
.notice svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; }
.notice--warning { background: var(--amber-100); color: #6e470c; }
.notice--danger { background: var(--red-100); color: var(--red-700); }

/* Botão vermelho sólido para confirmações destrutivas */
.btn--danger-solid { --btn-bg: var(--red-700); --btn-fg: #fff; --btn-bd: var(--red-700); }
.btn--danger-solid:hover { --btn-bg: #951f18; --btn-bd: #951f18; }

@media (min-width: 480px) {
  .modal__foot { flex-direction: row; justify-content: flex-end; }
}
@media (min-width: 640px) {
  .modal { align-items: center; padding: 24px; }
  .modal__panel { width: min(560px, 100%); max-height: calc(100dvh - 48px); border-radius: var(--radius-xl); transform: translateY(12px) scale(.98); }
  .modal__panel::before { display: none; }
  .modal__panel--sm { width: min(440px, 100%); }
  .modal__panel--lg { width: min(720px, 100%); }
  .modal__head { padding: 1.5rem 1.5rem 1rem; }
  .modal__body { padding: 0 1.5rem 1.5rem; }
  .modal__foot { padding: 1rem 1.5rem; }
}
