/**
 * @file
 * Modal Button component styles.
 */

.layout-container {

  /* ==========================================================================
     Button trigger
     ========================================================================== */

  .modal-button {
    position: relative;
    display: flex;
    justify-content: center;
  }

  .modal-button__trigger-wrap {
    position: relative;
    display: inline-flex;
  }

  .modal-button__trigger {
    position: relative;
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 70px;
    /* left padding creates space for the icon circle which overflows left */
    padding: 8px 40px 8px 45px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 3.884%, #a27cd5 175.08%);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    overflow: hidden;
  }

  /* Gradient border via pseudo-element + mask-composite */
  .modal-button__trigger::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: var(--gradient-brand, linear-gradient(to right, #fa7821, #4f08b0));
    mask:
      linear-gradient(#fff 0 0) content-box,
      linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
  }

  .modal-button__trigger:focus-visible {
    outline: 2px solid var(--color-purple, #4F08B0);
    outline-offset: 2px;
  }

  /* ==========================================================================
     Trigger corner decoration
     ========================================================================== */

  .modal-button__trigger-corner {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 52px;
    height: 52px;
    line-height: 0;
    pointer-events: none;
    z-index: 1;
  }

  .modal-button__trigger-corner svg {
    display: block;
    width: 100%;
    height: 100%;
  }

  /* ==========================================================================
     Circle icon — ring SVG + overlaid media-library image
     ========================================================================== */

  .modal-button__icon-wrap {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 81px;
    height: 81px;
    pointer-events: none;
    flex-shrink: 0;
    z-index: 1;
  }

  .modal-button__circle-svg {
    display: block;
    width: 100%;
    height: 100%;
  }

  .modal-button__icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 55%;
    height: 55%;
    object-fit: contain;
  }

  /* ==========================================================================
     Button label
     ========================================================================== */

  .modal-button__title {
    flex: 1;
    font-family: Poppins, sans-serif;
    font-size: 18px;
    line-height: 1.3;
    color: var(--color-purple, #4F08B0);
  }

  /* ==========================================================================
     Plus icon circle
     ========================================================================== */

  .modal-button__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
  }

  /* ==========================================================================
     Modal dialog
     ========================================================================== */

  .modal-button__dialog {
    width: 100%;
    max-width: min(940px, 90vw);
    max-height: min(842px, 85vh);
    padding: 0;
    border: none;
    border-radius: 44px;
    background: #ffffff;
    overflow: hidden;
  }

  .modal-button__dialog[open] {
    display: flex;
    flex-direction: column;
  }

  /* Safari-only fix: flex: 1 children require a definite height, not just max-height */
  @supports (hanging-punctuation: first) {
    .modal-button__dialog[open] {
      height: min(842px, 85vh);
    }
  }

  /* Backdrop overlay */
  .modal-button__dialog::backdrop {
    background:
      radial-gradient(101.33% 115.04% at 4.61% 88.19%, rgba(243, 215, 223, 0.77) 0%, rgba(216, 212, 248, 0.77) 58.51%, rgba(216, 212, 248, 0.00) 100%),
      radial-gradient(402.23% 104.99% at 25.21% 86.57%, #DBD5FF 0%, #ECE8FA 100%);
  }

  /* ==========================================================================
     Close button
     ========================================================================== */

  .modal-button__close {
    position: absolute;
    top: 43px;
    right: 30px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-shrink: 0;

    svg {
      width: 20px;
      height: 20px;
    }
  }

  .modal-button__close:focus-visible {
    outline: 2px solid var(--color-purple, #4F08B0);
    border-radius: 4px;
  }

  /* ==========================================================================
     Modal heading
     ========================================================================== */

  .modal-button__modal-title {
    flex-shrink: 0;
    padding: 50px 120px 20px;
    margin: 0;
    font-family: Poppins, sans-serif;
    font-size: 24px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--color-purple, #4F08B0);
    text-align: center;
  }

  .modal-button__modal-title strong {
    font-weight: 700;
  }

  /* ==========================================================================
     Scrollable content area
     ========================================================================== */

  .modal-button__scroll {
    flex: 1;
    min-height: 0;
    margin-right: 35px;
    /* bottom padding clears the corner decoration */
    padding: 0 64px 100px;
  }

  /* ==========================================================================
     Corner decoration
     ========================================================================== */

  .modal-button__corner {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 151px;
    height: 151px;
    line-height: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
    border-bottom-right-radius: 44px;
  }

  .modal-button__corner svg {
    display: block;
    width: 100%;
    height: 100%;
  }


  /* ==========================================================================
     Responsive — mobile (≤767px)
     ========================================================================== */

  @media (max-width: 767px) {

    .modal-button__trigger-wrap {
      margin-left: 32px;
    }

    .modal-button__trigger {
      padding-left: 57px;
      padding-right: 16px;
    }

    .modal-button__icon-wrap {
      width: 82px;
      height: 82px;
    }

    .modal-button__title {
      font-size: 14px;
    }

    .modal-button__toggle {
      width: 24px;
      height: 24px;
    }

    .modal-button__toggle svg {
      width: 24px;
      height: 24px;
    }

    .modal-button__dialog {
      max-width: 90vw;
      max-height: 90vh;
      border-radius: 16px;
    }

    @supports (hanging-punctuation: first) {
      .modal-button__dialog[open] {
        height: 90vh;
      }
    }

    .modal-button__close {
      top: 21px;
      right: 10px;

      svg {
        width: 16px;
        height: 16px;
      }
    }

    .modal-button__modal-title {
      padding: 20px 44px 12px 26px;
      font-size: 16px;
    }

    .modal-button__scroll {
      margin-right: 14px;
      padding: 0 24px 80px;
    }

    .modal-button__corner {
      width: 82.88px;
      height: 82.88px;
      border-bottom-right-radius: 16px;
    }

  }

}

/* ── Canvas editor — show dialog so the slot is editable ────────── */
/* Targets both legacy path-canvas class and canvas-api-v0 class pattern */

body.path-canvas .modal-button,
body[class*="canvas-api"] .modal-button {
  flex-direction: column;
  align-items: center;
}

body.path-canvas .modal-button__dialog,
body[class*="canvas-api"] .modal-button__dialog {
  display: flex !important;
  flex-direction: column;
  position: static;
  max-height: none;
  overflow: visible;
  width: 100%;
}

body.path-canvas .modal-button__scroll,
body[class*="canvas-api"] .modal-button__scroll {
  overflow: visible;
  min-height: 100px;
}

/* ── Content area overrides ─────────────────────────────────────── */

.modal-button__dialog .modal-button__scroll-inner .wysiwyg-block:first-child {
  padding-top: 0;
}

/* ── Footer with vertical separator line (TRYN-946, list item 6) ── */

.modal-button__dialog .modal-footer-separator {
  position: relative;
  padding-left: 32px;
  max-width: 747px;
  margin: 0;
  font-family: Poppins, sans-serif;
  font-weight: 600;
  font-size: 16px;
  line-height: 22px;
  letter-spacing: 0.1px;
  color: #4F08B0;
  font-style: normal;
}

.modal-button__dialog .modal-footer-separator::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  width: 2px;
  height: 87px;
  background: linear-gradient(180deg, #FA7821 0%, #4F08B0 100%);
}

@media (max-width: 767px) {
  .modal-button__dialog .modal-footer-separator {
    padding-left: 20px;
    max-width: 268px;
    font-size: 12px;
    line-height: 16px;
  }

  .modal-button__dialog .modal-footer-separator::before {
    height: 100%;
    left: 4px;
  }
}

/* ── SimpleBar scrollbar — override global ISI tray styles ───────── */

.modal-button__dialog .simplebar-track.simplebar-vertical {
  width: 19px;
  margin-right: 0;
  right: 0;
  margin-top: -40px;
  margin-bottom: 60px;
  height: calc(100% - 60px);
  background: rgba(79, 8, 176, 0.1);
  border-radius: 44px;
}

.modal-button__dialog .simplebar-track.simplebar-vertical .simplebar-scrollbar {
  border-radius: 44px;
}
.modal-button__dialog .simplebar-scrollbar.simplebar-visible:before {
  background: var(--color-purple, #4F08B0);
  opacity: 1;
}

@media (max-width: 767px) {
  .modal-button__dialog .simplebar-track.simplebar-vertical {
    margin-top: 0;
    width: 7px;
    border-radius: 16px;
  }
}
