.modal {
  display: none;
  position: fixed;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  z-index: 3000;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  pointer-events: none;

  &.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .modal__overlay {
    background-color: rgba(0, 0, 0, 0.6);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    backdrop-filter: blur(2px);
    box-sizing: border-box;
  }

  .modal__content {
    background-color: var(--bg-primary, white);
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease-in-out;
    z-index: 3001;
    min-width: 60vw;

    @media (min-width: 768px) {
      max-width: 80%;
    }

    @media (min-width: 1024px) {
      max-width: 2200px;
    }
  }

  &.active .modal__content {
    transform: scale(1);
  }

  .modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background-color: var(--bg-primary, white);
    flex-shrink: 0;
  }

  .modal__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary, #212121);
  }

  .modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary, #616161);
    padding: 0.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    min-height: 2rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;

    &:hover {
      background-color: var(--bg-secondary, #ebebeb);
      color: var(--text-primary, #212121);
    }

    &:focus {
      outline: 2px solid var(--primary, #2196F3);
      outline-offset: 2px;
    }
  }

  .modal__body {
    overflow-y: auto;
    flex: 1;
    color: var(--text-primary, #212121);
    margin-inline: auto;
    width: calc(100% - 6rem);
    border-radius: .5rem;
    margin-bottom: .75rem;
    background-color: white;
    padding: 1rem;
    border: 1px solid var(--border, #E0E0E0);
  }

  .modal__footer {
    display: grid;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
    background-color: var(--bg-primary, white);
    flex-shrink: 0;

    @media (max-width: 768px) {
      flex-direction: column-reverse;

      button,
      .button {
        width: 100%;
      }
    }
  }

  /* Scrollbar personalizada para o body do modal */
  .modal__body::-webkit-scrollbar {
    width: 8px;
  }

  .modal__body::-webkit-scrollbar-track {
    background: var(--bg-secondary, #ebebeb);
    border-radius: 4px;
  }

  .modal__body::-webkit-scrollbar-thumb {
    background: var(--text-light, #9E9E9E);
    border-radius: 4px;

    &:hover {
      background: var(--text-secondary, #616161);
    }
  }

  /* Estilos para conteúdo rich text dentro do modal */
  .modal__body .richtext {
    line-height: 1.6;
    color: var(--text-primary, #212121);

    h1, h2, h3, h4, h5, h6 {
      margin-top: 1em;
      margin-bottom: 0.5em;
      font-weight: 600;
    }

    p {
      margin-bottom: 1em;
    }

    ul, ol {
      margin-bottom: 1em;
      padding-left: 2em;
    }

    li {
      margin-bottom: 0.5em;
    }

    a {
      color: var(--primary, #2196F3);
      text-decoration: underline;
    }

    strong, b {
      font-weight: 600;
    }

    img {
      max-width: 100%;
      height: auto;
    }
  }
}