/* ==========================================================================
   IL MODAL CENTRALE CONDIVISO (shared/_modal + modal_controller): una scheda bianca su un
   velo navy sfocato, testata con titolo e X, corpo che scorre. Entra con una piccola salita.
   ========================================================================== */

.app-modal {
  width: min(720px, 94vw);
  max-height: 88vh;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  overflow: visible;
}

.app-modal[open] {
  animation: app-modal-entra 0.18s ease-out;
}

.app-modal::backdrop {
  background: rgba(29, 38, 97, 0.45);
  backdrop-filter: blur(3px);
}

.app-modal-scheda {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}

.app-modal-testa {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.3rem 0.9rem;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(120deg, var(--azure-soft), var(--surface) 70%);
}

.app-modal-titolo {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 750;
  color: var(--navy-dark);
}

.app-modal-sottotitolo {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--gray-text);
}

.app-modal-chiudi {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.app-modal-chiudi .icon {
  width: 1rem;
  height: 1rem;
}

.app-modal-corpo {
  padding: 1rem 1.3rem 1.3rem;
  overflow-y: auto;
}

/* I risultati della ricerca fanno parte del corpo e non vengono tagliati dal modal. */
.app-modal.is-ricerca {
  width: min(820px, 94vw);
}

.app-modal.is-ricerca .app-modal-corpo {
  min-height: min(24rem, 55dvh);
}

.app-modal.is-ricerca .picker-results {
  position: static;
}

.app-modal.is-ricerca .picker-list {
  max-height: none;
}

@keyframes app-modal-entra {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 48rem) {
  .app-modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 92vh;
    margin: auto 0 0;
  }

  .app-modal-scheda {
    max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
}
