/*
 * Support Modal — Destiny Planners
 * Self-contained; all selectors namespaced under #sp-modal-* / .sp-*
 * No collisions with existing .modal / .close / .modal-content rules.
 */

/* ── Overlay ─────────────────────────────────────────────────────────────── */
#sp-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(10, 20, 50, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow-y: auto;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#sp-modal-overlay.sp-visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

#sp-modal-overlay.sp-fade-in {
  opacity: 1;
}

/* ── Dialog card ─────────────────────────────────────────────────────────── */
#sp-modal-dialog {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(26, 45, 98, 0.2);
  width: 100%;
  max-width: 420px;           /* narrower — was 520px */
  padding: 32px 28px 24px;   /* tighter — was 44px 40px 36px */
  font-family: 'Mulish', sans-serif;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.36, 0.64, 1),
              opacity   0.3s ease;
}

#sp-modal-overlay.sp-fade-in #sp-modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ── Top accent stripe ───────────────────────────────────────────────────── */
#sp-modal-dialog::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #1a2d62 0%, #5dc722 60%, #2eca7f 100%);
  border-radius: 16px 16px 0 0;
}

/* ── Close button ────────────────────────────────────────────────────────── */
#sp-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #f0f3fa;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #1a2d62;
  font-size: 15px;
  line-height: 1;
  transition: background 0.2s, color 0.2s, transform 0.2s;
  z-index: 2;
}

#sp-modal-close:hover,
#sp-modal-close:focus {
  background: #1a2d62;
  color: #fff;
  transform: rotate(90deg);
  outline: none;
}

#sp-modal-close:focus-visible {
  outline: 3px solid #5dc722;
  outline-offset: 2px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#sp-modal-header {
  margin-bottom: 16px;
  padding-right: 24px; /* keep text clear of close btn */
}

#sp-modal-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 5px;
}

#sp-modal-label .sp-icon {
  width: 34px;
  height: 34px;
  background: rgba(93, 199, 34, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

#sp-modal-title {
  font-size: 18px;        /* was 22px */
  font-weight: 800;
  color: #1a2d62;
  margin: 0;
  line-height: 1.25;
}

#sp-modal-subtitle {
  font-size: 13px;        /* was 14px */
  color: #999;
  line-height: 1.5;
  margin: 0;
  padding-left: 43px;     /* icon width + gap */
}

/* ── Divider ─────────────────────────────────────────────────────────────── */
.sp-divider {
  border: none;
  border-top: 1px solid #ededed;
  margin: 0 0 16px;       /* was 22px */
}

/* ── Two-column row for Name + Phone ─────────────────────────────────────── */
#sp-support-form .sp-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Form fields ─────────────────────────────────────────────────────────── */
#sp-support-form .sp-field {
  margin-bottom: 10px;    /* was 16px */
}

#sp-support-form label {
  display: block;
  font-size: 12px;        /* was 13px */
  font-weight: 700;
  color: #1a2d62;
  margin-bottom: 4px;
  letter-spacing: 0.2px;
}

#sp-support-form label .sp-required {
  color: #9a1a08;
  margin-left: 2px;
}

#sp-support-form input,
#sp-support-form textarea {
  width: 100%;
  padding: 8px 12px;      /* was 10px 14px */
  border: 1.5px solid #e0e4ef;
  border-radius: 8px;
  font-family: 'Mulish', sans-serif;
  font-size: 13px;        /* was 14px */
  font-weight: 500;
  color: #2e3970;
  background: #fafbff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

#sp-support-form input::placeholder,
#sp-support-form textarea::placeholder {
  color: #b0b8cc;
  font-weight: 400;
}

#sp-support-form input:focus,
#sp-support-form textarea:focus {
  border-color: #5dc722;
  box-shadow: 0 0 0 3px rgba(93, 199, 34, 0.12);
  background: #fff;
}

#sp-support-form input.sp-invalid,
#sp-support-form textarea.sp-invalid {
  border-color: #9a1a08;
  box-shadow: 0 0 0 3px rgba(154, 26, 8, 0.08);
}

#sp-support-form textarea {
  resize: vertical;
  min-height: 68px;       /* was 88px */
}

/* ── Inline field errors ─────────────────────────────────────────────────── */
.sp-field-error {
  display: none;
  font-size: 11px;        /* was 12px */
  color: #9a1a08;
  font-weight: 600;
  margin-top: 3px;
}

.sp-field-error.sp-show {
  display: block;
}

/* ── Actions row ─────────────────────────────────────────────────────────── */
#sp-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;       /* was 24px */
}

/* Submit — green, pill, matches site .btn_one */
#sp-btn-submit {
  flex: 1;
  background: #5dc722;
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 10px 22px;     /* was 12px 28px */
  font-family: 'Mulish', sans-serif;
  font-size: 13px;        /* was 14px */
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#sp-btn-submit:hover,
#sp-btn-submit:focus {
  background: #1a2d62;
  box-shadow: 0 6px 18px rgba(26, 45, 98, 0.2);
  outline: none;
}

#sp-btn-submit:active  { transform: scale(0.97); }

#sp-btn-submit:focus-visible {
  outline: 3px solid #5dc722;
  outline-offset: 3px;
}

#sp-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Spinner */
#sp-btn-submit .sp-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sp-spin 0.7s linear infinite;
  flex-shrink: 0;
}

#sp-btn-submit.sp-loading .sp-spinner { display: block; }

@keyframes sp-spin { to { transform: rotate(360deg); } }

/* Dismiss — outline style, matches site .btn_two feel */
#sp-btn-dismiss {
  background: none;
  border: 1.5px solid #d0d6ea;
  border-radius: 100px;
  padding: 9px 16px;      /* was 11px 20px */
  font-family: 'Mulish', sans-serif;
  font-size: 12px;        /* was 13px */
  font-weight: 700;
  color: #1a2d62;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

#sp-btn-dismiss:hover,
#sp-btn-dismiss:focus {
  background: #1a2d62;
  border-color: #1a2d62;
  color: #fff;
  outline: none;
}

#sp-btn-dismiss:focus-visible {
  outline: 3px solid #5dc722;
  outline-offset: 3px;
}

/* ── Privacy note ────────────────────────────────────────────────────────── */
#sp-privacy-note {
  font-size: 10.5px;
  color: #bbb;
  text-align: center;
  margin-top: 10px;
  line-height: 1.5;
}

#sp-privacy-note .sp-wa-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #25d366;
  font-weight: 700;
}

/* ── Success panel ───────────────────────────────────────────────────────── */
#sp-success-panel {
  display: none;
  text-align: center;
  padding: 8px 0 4px;
}

#sp-success-panel .sp-success-icon {
  width: 52px;            /* was 64px */
  height: 52px;
  background: rgba(93, 199, 34, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 24px;
  color: #5dc722;
  animation: sp-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes sp-pop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

#sp-success-panel h3 {
  font-size: 17px;        /* was 20px */
  font-weight: 800;
  color: #1a2d62;
  margin-bottom: 8px;
}

#sp-success-panel p {
  font-size: 13px;
  color: #888;
  line-height: 1.6;
  max-width: 300px;
  margin: 0 auto 16px;
}

/* WhatsApp CTA inside success — secondary fallback link */
#sp-success-panel .sp-wa-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #25d366;
  color: #fff;
  border-radius: 100px;
  padding: 9px 22px;      /* was 11px 26px */
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

#sp-success-panel .sp-wa-link:hover {
  background: #1da851;
  color: #fff;
  transform: translateY(-1px);
}

/* ── Responsive: stack two-column row on small screens ───────────────────── */
@media (max-width: 480px) {
  #sp-modal-dialog {
    padding: 28px 18px 20px;
    border-radius: 14px;
    max-width: 100%;
  }

  #sp-modal-title   { font-size: 16px; }

  #sp-modal-subtitle { padding-left: 0; margin-top: 4px; }

  #sp-modal-label {
    flex-direction: row;
    align-items: center;
  }

  /* Stack the two-column row */
  #sp-support-form .sp-row {
    grid-template-columns: 1fr;
  }

  #sp-modal-actions {
    flex-direction: column;
  }

  #sp-btn-submit,
  #sp-btn-dismiss {
    width: 100%;
    justify-content: center;
  }
}

/* ── Reduced-motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #sp-modal-overlay,
  #sp-modal-dialog,
  #sp-modal-close,
  #sp-btn-submit,
  #sp-success-panel .sp-success-icon {
    transition: none !important;
    animation: none !important;
  }
}
