/* ==========================================================================
   CONTACT FORM MODAL STYLES
   Native, Accessible Modal Component for WebWizBD FSE Theme
   Strictly following 2026 FSE standard & zero !important specificity rule
   ========================================================================== */

.tp-contact-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  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-contact-modal-dialog {
      transform: scale(1) translateY(0);
      opacity: 1;
    }
  }

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

  .tp-contact-modal-dialog {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 660px;
    max-height: calc(100vh - 48px);
    background: #ffffff;
    border-radius: 28px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow:
      0 32px 80px -16px rgba(15, 29, 51, 0.28),
      0 12px 32px -8px rgba(15, 29, 51, 0.12);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    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);
    padding: clamp(24px, 4vw, 36px);
    box-sizing: border-box;

    /* Custom smooth scrollbar inside dialog */
    &::-webkit-scrollbar {
      width: 6px;
    }
    &::-webkit-scrollbar-track {
      background: transparent;
    }
    &::-webkit-scrollbar-thumb {
      background: rgba(15, 23, 42, 0.15);
      border-radius: 999px;
    }
  }

  /* Close Button */
  .tp-contact-modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #f8fafc;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    z-index: 5;

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

  /* Header */
  .tp-contact-modal-header {
    margin-bottom: 22px;
    padding-right: 32px;

    .tp-contact-modal-badge {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      padding: 4px 12px;
      border-radius: 999px;
      background: rgba(16, 185, 129, 0.08);
      border: 1px solid rgba(16, 185, 129, 0.2);
      color: #059669;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      margin-bottom: 10px;

      .tp-contact-modal-badge-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #10b981;
        box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
        animation: tpPulseDot 2s infinite ease-in-out;
      }
    }

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

    .tp-contact-modal-subtitle {
      font-family: var(--tp-ff-body, 'Inter', sans-serif);
      font-size: 13.5px;
      color: #64748b;
      line-height: 1.55;
      margin: 0;
    }
  }

  /* Error Alert */
  .tp-contact-modal-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 18px;

    &.tp-contact-modal-alert--error {
      background: #fef2f2;
      border: 1px solid #fecaca;
      color: #b91c1c;

      svg {
        flex-shrink: 0;
      }
    }
  }

  /* Form Layout */
  .tp-contact-modal-form {
    display: flex;
    flex-direction: column;
    gap: 14px;

    .tp-contact-modal-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 14px;

      @media (max-width: 600px) {
        grid-template-columns: 1fr;
      }
    }

    .tp-contact-form-group {
      display: flex;
      flex-direction: column;
      gap: 5px;

      label {
        font-family: var(--tp-ff-body, 'Inter', sans-serif);
        font-size: 12.5px;
        font-weight: 600;
        color: #334155;
        display: flex;
        align-items: center;
        gap: 3px;

        .tp-required {
          color: #ef4444;
          font-weight: 700;
        }
      }

      input[type="text"],
      input[type="email"],
      input[type="tel"],
      select,
      textarea {
        width: 100%;
        box-sizing: border-box;
        font-family: var(--tp-ff-body, 'Inter', sans-serif);
        font-size: 13.5px;
        color: #0f172a;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 9px 13px;
        outline: none;
        transition: all 0.2s ease;

        &::placeholder {
          color: #94a3b8;
        }

        &:focus {
          background: #ffffff;
          border-color: #2563eb;
          box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
        }
      }

      textarea {
        resize: vertical;
        min-height: 75px;
      }

      .tp-select-wrap {
        position: relative;

        &::after {
          content: "";
          position: absolute;
          right: 14px;
          top: 50%;
          transform: translateY(-50%);
          width: 0;
          height: 0;
          border-left: 4.5px solid transparent;
          border-right: 4.5px solid transparent;
          border-top: 5px solid #64748b;
          pointer-events: none;
        }

        select {
          appearance: none;
          -webkit-appearance: none;
          padding-right: 32px;
          cursor: pointer;
        }
      }
    }

    .tp-contact-modal-footer {
      display: flex;
      flex-direction: column;
      gap: 12px;
      margin-top: 4px;

      .tp-contact-modal-submit-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 13px 24px;
        font-family: var(--tp-ff-body, 'Inter', sans-serif);
        font-size: 14.5px;
        font-weight: 700;
        color: #ffffff;
        background: #2563eb;
        border: none;
        border-radius: 12px;
        cursor: pointer;
        box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
        transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);

        &:hover {
          background: #1d4ed8;
          box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
          transform: translateY(-1px);
        }

        &:active {
          transform: translateY(0);
        }

        &.is-loading {
          opacity: 0.75;
          pointer-events: none;
          cursor: not-allowed;
        }

        .tp-btn-submit__icon svg {
          transition: transform 0.2s ease;
        }

        &:hover .tp-btn-submit__icon svg {
          transform: translateX(3px) translateY(-1px);
        }
      }

      .tp-contact-modal-direct {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: 12px;
        color: #64748b;
        text-align: center;

        a {
          color: #2563eb;
          font-weight: 600;
          text-decoration: underline;
          transition: color 0.2s ease;

          &:hover {
            color: #1d4ed8;
          }
        }
      }
    }
  }

  /* Success View */
  .tp-contact-modal-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 12px;

    .tp-contact-modal-success__icon {
      width: 72px;
      height: 72px;
      border-radius: 50%;
      background: #ecfdf5;
      border: 2px solid #a7f3d0;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 20px;
      animation: tpPopIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);

      svg {
        stroke: #10b981;
      }
    }

    .tp-contact-modal-success__title {
      font-family: var(--tp-ff-heading, 'Plus Jakarta Sans', sans-serif);
      font-size: 24px;
      font-weight: 800;
      color: #0f172a;
      letter-spacing: -0.02em;
      margin: 0 0 10px 0;
    }

    .tp-contact-modal-success__desc {
      font-family: var(--tp-ff-body, 'Inter', sans-serif);
      font-size: 14.5px;
      color: #64748b;
      line-height: 1.6;
      max-width: 480px;
      margin: 0 0 24px 0;
    }

    .tp-contact-modal-success__actions {
      .tp-contact-modal-done-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 160px;
        padding: 11px 28px;
        font-size: 14px;
        font-weight: 700;
        border-radius: 12px;
        background: #0f172a;
        color: #ffffff;
        border: none;
        cursor: pointer;
        transition: all 0.2s ease;

        &:hover {
          background: #1e293b;
          transform: translateY(-1px);
        }
      }
    }
  }
}

/* Keyframes */
@keyframes tpPulseDot {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.25);
    opacity: 0.7;
  }
}

@keyframes tpPopIn {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
