/* ==========================================================================
   FEASIBILITY AUDIT MODAL & LEGAL POPUP STYLES
   Native, Accessible visionOS Glassmorphism Modals for One-Page WebWizBD
   Zero !important specificity rule strictly maintained
   ========================================================================== */

/* --------------------------------------------------------------------------
   01. Feasibility Modal Backdrop & Shell
   -------------------------------------------------------------------------- */
.tp-fe-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 32px);
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);

  &.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    .tp-fe-modal-dialog {
      transform: scale(1) translateY(0);
      opacity: 1;
    }
  }

  .tp-fe-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    cursor: pointer;
  }

  .tp-fe-modal-dialog {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 28px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow:
      0 32px 80px -16px rgba(15, 29, 51, 0.26),
      0 12px 32px -8px rgba(15, 29, 51, 0.10);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.96) translateY(12px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* --------------------------------------------------------------------------
     02. Modal Header
     -------------------------------------------------------------------------- */
  .tp-fe-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 34px 20px 34px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
    flex-shrink: 0;

    .tp-fe-modal-branding {
      max-width: 680px;
    }

    .tp-fe-modal-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 12px;
      border-radius: 999px;
      background: rgba(37, 99, 235, 0.08);
      border: 1px solid rgba(37, 99, 235, 0.16);
      color: #2563eb;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      margin-bottom: 6px;

      svg {
        flex-shrink: 0;
      }
    }

    .tp-fe-modal-title {
      font-family: var(--tp-ff-heading, 'Plus Jakarta Sans', sans-serif);
      font-size: clamp(20px, 2.3vw, 24px);
      font-weight: 800;
      color: #0f172a;
      line-height: 1.25;
      letter-spacing: -0.025em;
      margin: 0;
    }

    .tp-fe-modal-subtitle {
      display: none;
    }

    .tp-fe-modal-close-btn {
      flex-shrink: 0;
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #f1f5f9;
      border: 1px solid rgba(15, 23, 42, 0.08);
      border-radius: 50%;
      color: #475569;
      cursor: pointer;
      transition: all 0.2s ease;
      padding: 0;
      margin-top: 0;

      &:hover {
        background: #e2e8f0;
        color: #0f172a;
        transform: rotate(90deg);
      }
    }
  }

  /* --------------------------------------------------------------------------
     03. Modal Body Container
     -------------------------------------------------------------------------- */
  .tp-fe-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 28px 34px 34px 34px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;

    /* Make the embedded feasibility tool flush inside modal */
    .webwiz-feasibility-app {
      margin: 0 auto;
      max-width: 100%;

      .webwiz-fe-card {
        padding: 0;
        box-shadow: none;
        border: none;
        background: transparent;
      }
    }
  }
}

/* --------------------------------------------------------------------------
   04. Legal Modal (Terms of Service & Privacy Policy)
   -------------------------------------------------------------------------- */
.tp-legal-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 32px);
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);

  &.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    .tp-legal-modal-dialog {
      transform: scale(1) translateY(0);
      opacity: 1;
    }
  }

  .tp-legal-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    cursor: pointer;
  }

  .tp-legal-modal-dialog {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 780px;
    max-height: 85vh;
    background: #ffffff;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow:
      0 24px 64px -12px rgba(15, 29, 51, 0.22),
      0 4px 16px rgba(15, 29, 51, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.96) translateY(12px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .tp-legal-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 28px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;

    .tp-legal-tabs {
      display: inline-flex;
      gap: 6px;
      background: #e2e8f0;
      padding: 4px;
      border-radius: 12px;
    }

    .tp-legal-tab-btn {
      border: none;
      background: transparent;
      padding: 6px 16px;
      border-radius: 8px;
      font-size: 13.5px;
      font-weight: 600;
      color: #64748b;
      cursor: pointer;
      transition: all 0.2s ease;

      &.is-active {
        background: #ffffff;
        color: #0f172a;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
      }
    }

    .tp-legal-close-btn {
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #ffffff;
      border: 1px solid #e2e8f0;
      border-radius: 50%;
      color: #64748b;
      cursor: pointer;
      transition: all 0.2s ease;

      &:hover {
        background: #f1f5f9;
        color: #0f172a;
        transform: rotate(90deg);
      }
    }
  }

  .tp-legal-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 28px 32px;
    font-family: var(--tp-ff-body, 'Inter', sans-serif);
    font-size: 14.5px;
    line-height: 1.7;
    color: #334155;
    -webkit-overflow-scrolling: touch;

    h3 {
      font-size: 18px;
      font-weight: 700;
      color: #0f172a;
      margin-top: 24px;
      margin-bottom: 8px;

      &:first-child {
        margin-top: 0;
      }
    }

    p {
      margin-bottom: 14px;
    }

    ul {
      padding-left: 20px;
      margin-bottom: 16px;

      li {
        margin-bottom: 6px;
      }
    }
  }
}

/* --------------------------------------------------------------------------
   05. Responsive Refinements
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .tp-fe-modal-overlay {
    padding: 10px;

    .tp-fe-modal-dialog {
      border-radius: 20px;
      max-height: 94vh;
    }

    .tp-fe-modal-header {
      padding: 16px 18px;

      .tp-fe-modal-title {
        font-size: 18px;
      }

      .tp-fe-modal-subtitle {
        font-size: 12px;
      }

      .tp-fe-modal-close-btn {
        width: 34px;
        height: 34px;
      }
    }

    .tp-fe-modal-body {
      padding: 14px 12px;
    }
  }

  .tp-legal-modal-overlay {
    padding: 10px;

    .tp-legal-modal-dialog {
      border-radius: 20px;
      max-height: 92vh;
    }

    .tp-legal-modal-header {
      padding: 14px 16px;

      .tp-legal-tab-btn {
        padding: 5px 10px;
        font-size: 12px;
      }
    }

    .tp-legal-modal-body {
      padding: 20px 18px;
      font-size: 13.5px;
    }
  }
}
