/* Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-6);
  background: rgb(23 23 23 / 0.55);
  backdrop-filter: blur(5px);
  box-sizing: border-box;
}

.modal-overlay-enter-active,
.modal-overlay-leave-active {
  transition: opacity 0.25s ease;
}

.modal-overlay-enter-from,
.modal-overlay-leave-to {
  opacity: 0;
}

/* Painel do modal — sombra 3D (mesmo espírito dos botões) */
.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 2 * var(--spacing-6));
  background: linear-gradient(
    180deg,
    var(--color-white) 0%,
    var(--color-neutral-50) 100%
  );
  border-radius: 12px;
  border: 1px solid var(--color-neutral-300);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.95),
    inset 0 -1px 0 rgb(0 0 0 / 0.04),
    0 8px 16px rgb(0 0 0 / 0.12),
    0 20px 40px rgb(0 0 0 / 0.16);
  box-sizing: border-box;
  overflow: hidden;
  transform-origin: center center;
  position: relative;
}

.modal::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--color-neutral-50),
    var(--color-neutral-50)
  );
  pointer-events: none;
  z-index: 1;
}

.modal--md {
  max-width: 40rem;
  height: auto;
}

.modal--lg {
  max-width: 90rem;
}

/* Header */
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-4);
  width: 100%;
  flex-shrink: 0;
  padding: var(--spacing-5) var(--spacing-6);
  min-height: 5rem; /* 80px — padrão único (md e lg) */
  border-bottom: 1px solid var(--color-neutral-200);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.9),
    0 1px 0 rgb(0 0 0 / 0.04);
  box-sizing: border-box;
  background: var(--color-white);
  margin-bottom: var(--spacing-4);
}

.modal__title {
  margin: 0;
  flex: 1;
  min-width: 0;
  color: var(--color-neutral-900);
}

.modal__header:not(:has(.modal__title)) {
  justify-content: flex-end;
}

/* Botão fechar — estilo 3D leve */
.modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--color-neutral-300);
  border-radius: 8px;
  background: linear-gradient(
    180deg,
    var(--color-white) 0%,
    var(--color-neutral-50) 100%
  );
  color: var(--color-neutral-500);
  cursor: pointer;
  transform: translateY(0);
  filter: brightness(1);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.9),
    inset 0 -1px 0 rgb(0 0 0 / 0.06),
    0 2px 4px rgb(0 0 0 / 0.08);
  transition:
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal__close:hover {
  color: var(--color-red-500);
  filter: brightness(0.98);
  transform: translateY(-1px);
  border-color: var(--color-red-500);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.95),
    inset 0 -1px 0 rgb(255 0 0 / 0.08),
    0 4px 8px rgb(255 0 0 / 0.1);
}

.modal__close:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 2px rgb(255 0 0 / 0.12),
    0 1px 2px rgb(255 0 0 / 0.08);
  transition-duration: 0.1s;
}

/* Corpo — scroll interno */
.modal__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 var(--spacing-6) var(--spacing-6);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  background: var(--color-white);
}
