/* ─────────────────────────────────────────────
   SahaPay — Frontend Stylesheet
   Accent colour injected by PHP via --sahapay-accent
───────────────────────────────────────────── */
:root {
  --sahapay-accent:       #2563eb;
  --sahapay-accent-rgb:   37,99,235;
  --sahapay-radius:       18px;
  --sahapay-shadow:       0 8px 32px rgba(0,0,0,.13), 0 2px 8px rgba(0,0,0,.07);
  --sahapay-t:            .26s cubic-bezier(.4,0,.2,1);
}

/* ── Trigger button ───────────────────────────────────────────── */
.sahapay-trigger-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 13px 26px; border: none; border-radius: 50px;
  cursor: pointer; font-size: 14px; font-weight: 600;
  letter-spacing: .02em; transition: all var(--sahapay-t);
  position: relative; overflow: hidden;
}
.sahapay-btn-filled {
  background: var(--sahapay-accent); color: #fff;
  box-shadow: 0 4px 16px rgba(var(--sahapay-accent-rgb),.38);
}
.sahapay-btn-filled:hover { filter: brightness(1.08); transform: translateY(-2px); }
.sahapay-btn-outline {
  background: transparent; color: var(--sahapay-accent);
  border: 2px solid var(--sahapay-accent);
}
.sahapay-btn-outline:hover { background: var(--sahapay-accent); color: #fff; transform: translateY(-2px); }

/* ── Overlay ──────────────────────────────────────────────────── */
.sahapay-overlay {
  position: fixed; inset: 0;
  background: rgba(10,18,35,.65);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 999999;
  display: flex !important; align-items: center; justify-content: center;
  padding: 12px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--sahapay-t);
  overflow-y: auto;
}
.sahapay-overlay.is-open { opacity: 1; pointer-events: all; }

/* ── Modal wrapper ────────────────────────────────────────────── */
.sahapay-modal-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 860px;
  margin: auto;
}

/* ── Two-card row ─────────────────────────────────────────────── */
.sahapay-modal {
  display: flex;
  gap: 10px;
  width: 100%;
  transform: scale(.94) translateY(18px);
  transition: transform var(--sahapay-t);
}
.sahapay-overlay.is-open .sahapay-modal { transform: scale(1) translateY(0); }

/* ── Left card ────────────────────────────────────────────────── */
.sahapay-panel--left {
  flex: 0 0 300px;
  display: flex; flex-direction: column;
  background: #fff;
  border-radius: var(--sahapay-radius);
  box-shadow: var(--sahapay-shadow);
  overflow: hidden;
}
.sahapay-hero-image { flex: 0 0 200px; overflow: hidden; }
.sahapay-hero-img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s ease; display: block;
}
.sahapay-hero-img:hover { transform: scale(1.04); }
.sahapay-hero-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  display: flex; align-items: center; justify-content: center; color: #94a3b8;
}
.sahapay-hero-placeholder svg { width: 44px; height: 44px; }
.sahapay-org-info { flex: 1; padding: 16px 18px 14px; overflow-y: auto; }
.sahapay-org-logo-row { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.sahapay-org-logo { height: 32px; max-width: 110px; object-fit: contain; }
.sahapay-org-logo-placeholder { width: 32px; height: 32px; color: var(--sahapay-accent); flex-shrink: 0; }
.sahapay-org-logo-placeholder svg { width: 32px; height: 32px; }
.sahapay-org-name { font-size: 12.5px; font-weight: 800; color: #0f172a; text-transform: uppercase; letter-spacing: .07em; line-height: 1.2; }
.sahapay-org-desc { font-size: 12.5px; line-height: 1.62; color: #475569; }
.sahapay-org-desc p { margin: 0 0 6px; }
.sahapay-org-desc strong { color: #1e293b; }
.sahapay-legal-links { display: flex; gap: 7px; align-items: center; margin-top: 12px; font-size: 11px; color: #94a3b8; flex-wrap: wrap; }
.sahapay-legal-dot { color: #cbd5e1; }
.sahapay-legal-link { color: #64748b; text-decoration: underline; text-underline-offset: 2px; transition: color .15s; }
.sahapay-legal-link:hover { color: var(--sahapay-accent); }

/* ── Right card ───────────────────────────────────────────────── */
.sahapay-panel--right {
  flex: 1; min-width: 0;
  background: #fff;
  border-radius: var(--sahapay-radius);
  box-shadow: var(--sahapay-shadow);
  padding: 22px 22px 20px;
  overflow-y: auto;
  max-height: 90vh;
}

/* ── Step transitions ─────────────────────────────────────────── */
.sahapay-step { animation: sp-in .25s ease; }
.sahapay-step--hidden { display: none !important; }
@keyframes sp-in {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Secure badge ─────────────────────────────────────────────── */
.sahapay-secure-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: #16a34a;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 50px; padding: 4px 12px; margin-bottom: 14px;
}
.sahapay-secure-badge svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── Frequency toggle ─────────────────────────────────────────── */
.sahapay-frequency-toggle {
  display: flex; background: #f1f5f9; border-radius: 9px;
  padding: 3px; margin-bottom: 12px; gap: 2px;
}
.sahapay-freq-btn {
  flex: 1; padding: 6px 8px; border: none; background: transparent;
  border-radius: 7px; font-size: 12px; font-weight: 600; color: #64748b;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  white-space: nowrap; letter-spacing: .01em;
}
.sahapay-freq-btn.active {
  background: var(--sahapay-accent); color: #fff;
  box-shadow: 0 2px 7px rgba(var(--sahapay-accent-rgb),.35);
}
.sahapay-heart-icon { font-size: 10px; }

/* ── Amount grid ──────────────────────────────────────────────── */
.sahapay-amounts-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 6px; margin-bottom: 10px;
}
.sahapay-amount-btn {
  padding: 7px 4px; border: 1.5px solid #e2e8f0; border-radius: 9px;
  background: #fff; font-size: 13px; font-weight: 600; color: #374151;
  cursor: pointer; transition: all .2s; line-height: 1;
}
.sahapay-amount-btn:hover {
  border-color: var(--sahapay-accent); color: var(--sahapay-accent);
  transform: translateY(-1px); box-shadow: 0 3px 9px rgba(0,0,0,.07);
}
.sahapay-amount-btn.active {
  border-color: var(--sahapay-accent);
  background: var(--sahapay-accent); color: #fff;
  box-shadow: 0 3px 10px rgba(var(--sahapay-accent-rgb),.38);
}

/* ── Custom amount — premium field ───────────────────────────── */
.sahapay-custom-field {
  display: flex; align-items: center;
  border: 2px solid #e2e8f0; border-radius: 14px;
  background: #fff; margin-bottom: 12px; height: 52px;
  transition: border-color .2s, box-shadow .2s; overflow: hidden;
}
.sahapay-custom-field:focus-within {
  border-color: var(--sahapay-accent);
  box-shadow: 0 0 0 3px rgba(var(--sahapay-accent-rgb),.12);
}
.sahapay-custom-sym {
  flex-shrink: 0; padding: 0 13px;
  font-size: 17px; font-weight: 700; color: #374151;
  background: #f8fafc; border-right: 1.5px solid #e8ecf0;
  height: 100%; display: flex; align-items: center; user-select: none;
}
.sahapay-custom-input {
  flex: 1; min-width: 0;
  border: none !important; outline: none !important; box-shadow: none !important;
  padding: 0 12px; font-size: 16px; font-weight: 600;
  color: #0f172a; background: transparent; height: 100%;
}
.sahapay-custom-input::placeholder { color: #b0bac4; font-weight: 400; font-size: 13px; }
.sahapay-currency-wrap {
  flex-shrink: 0; display: flex; align-items: center; gap: 3px;
  padding: 0 10px 0 8px; height: 100%;
  border-left: 1.5px solid #e8ecf0; background: #f8fafc;
}
.sahapay-currency-select {
  appearance: none; -webkit-appearance: none;
  border: none; background: transparent;
  font-size: 12.5px; font-weight: 700; color: #374151;
  cursor: pointer; outline: none; letter-spacing: .02em;
}
.sahapay-currency-chevron { width: 10px; height: 6px; color: #94a3b8; pointer-events: none; flex-shrink: 0; }

/* ── Gateway pills ────────────────────────────────────────────── */
.sahapay-gw-section { margin-bottom: 12px; }
.sahapay-gw-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #94a3b8; margin-bottom: 7px; }
.sahapay-gw-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.sahapay-gw-pill { position: relative; cursor: pointer; }
.sahapay-gw-pill input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.sahapay-gw-pill-inner {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 1.5px solid #e2e8f0; border-radius: 50px;
  font-size: 13px; font-weight: 600; color: #374151;
  background: #fff; transition: all .2s; white-space: nowrap;
}
.sahapay-gw-pill-check {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--sahapay-accent); display: none;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.sahapay-gw-pill-check svg { width: 8px; height: 8px; stroke: #fff; }
.sahapay-gw-pill input:checked + .sahapay-gw-pill-inner {
  border-color: var(--sahapay-accent);
  background: rgba(var(--sahapay-accent-rgb),.06);
  color: var(--sahapay-accent);
}
.sahapay-gw-pill input:checked + .sahapay-gw-pill-inner .sahapay-gw-pill-check { display: flex; }

/* ── Card icons ───────────────────────────────────────────────── */
.sahapay-card-icons { display: flex; gap: 6px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.sahapay-card-icon { width: 42px; height: 27px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.1); display: block; }

/* ── Continue / primary button ────────────────────────────────── */
.sahapay-continue-btn {
  width: 100%; padding: 14px 20px;
  background: var(--sahapay-accent); color: #fff;
  border: none; border-radius: 12px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: all var(--sahapay-t); position: relative; overflow: hidden;
  box-shadow: 0 4px 16px rgba(var(--sahapay-accent-rgb),.38);
}
.sahapay-continue-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 35%, rgba(255,255,255,.18) 50%, transparent 65%);
  transform: translateX(-100%); transition: transform .5s ease;
}
.sahapay-continue-btn:hover::before { transform: translateX(100%); }
.sahapay-continue-btn:hover { filter: brightness(1.07); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(var(--sahapay-accent-rgb),.48); }
.sahapay-continue-btn:active { transform: translateY(0); }
.sahapay-continue-btn svg { width: 17px; height: 17px; transition: transform .2s; flex-shrink: 0; }
.sahapay-continue-btn:hover svg { transform: translateX(3px); }
.sahapay-continue-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; filter: none; }

/* ── Spinner ──────────────────────────────────────────────────── */
.sahapay-spinner {
  width: 17px; height: 17px;
  border: 2px solid rgba(255,255,255,.38); border-top-color: #fff;
  border-radius: 50%; animation: sp-spin .7s linear infinite; flex-shrink: 0;
}
@keyframes sp-spin { to { transform: rotate(360deg); } }

/* ── Step 2 ───────────────────────────────────────────────────── */
.sahapay-back-btn {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  color: #64748b; font-size: 13px; font-weight: 500;
  margin-bottom: 14px; padding: 4px 0; transition: color .2s;
}
.sahapay-back-btn:hover { color: var(--sahapay-accent); }
.sahapay-back-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.sahapay-step-title { font-size: 18px; font-weight: 700; color: #0f172a; margin: 0 0 14px; }
.sahapay-donation-summary {
  background: rgba(var(--sahapay-accent-rgb),.07);
  border: 1px solid rgba(var(--sahapay-accent-rgb),.18);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
  font-size: 13px; color: #1e293b;
}
.sahapay-donation-summary strong { color: var(--sahapay-accent); font-size: 17px; }
.sahapay-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.sahapay-form-field { margin-bottom: 10px; }
.sahapay-label { display: block; font-size: 12.5px; font-weight: 600; color: #374151; margin-bottom: 5px; }
.sahapay-optional { color: #94a3b8; font-weight: 400; }
.sahapay-text-input {
  width: 100%; padding: 10px 12px; box-sizing: border-box;
  border: 1.5px solid #e2e8f0; border-radius: 9px;
  font-size: 13.5px; color: #1e293b; background: #fff; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.sahapay-text-input:focus {
  border-color: var(--sahapay-accent);
  box-shadow: 0 0 0 3px rgba(var(--sahapay-accent-rgb),.12);
}
.sahapay-text-input.sp-error { border-color: #ef4444; }
.sahapay-text-input::placeholder { color: #94a3b8; }

/* ── Phone + country picker ───────────────────────────────────── */
.sahapay-phone-wrap { position: relative; display: flex; align-items: center; }
.sahapay-country-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 0 10px; height: 42px; flex-shrink: 0;
  background: #f8fafc; border: 1.5px solid #e2e8f0;
  border-right: none; border-radius: 9px 0 0 9px;
  cursor: pointer; font-size: 13px; color: #374151;
  transition: background .15s; white-space: nowrap;
}
.sahapay-country-btn:hover { background: #f1f5f9; }
.sahapay-country-flag { font-size: 16px; line-height: 1; }
.sahapay-country-code { font-size: 12px; font-weight: 600; color: #475569; }
.sahapay-chevron { width: 10px; height: 10px; fill: #94a3b8; transition: transform .2s; flex-shrink: 0; }
.sahapay-country-btn[aria-expanded="true"] .sahapay-chevron { transform: rotate(180deg); }
.sahapay-phone-num { flex: 1; border-radius: 0 9px 9px 0 !important; min-width: 0; }
.sahapay-country-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0;
  width: 280px; background: #fff;
  border: 1.5px solid #e2e8f0; border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14); z-index: 100; overflow: hidden;
  animation: sp-in .18s ease;
}
.sahapay-country-search-wrap { padding: 10px 10px 6px; border-bottom: 1px solid #f1f5f9; }
.sahapay-country-search {
  width: 100%; padding: 7px 10px; box-sizing: border-box;
  border: 1.5px solid #e2e8f0; border-radius: 7px;
  font-size: 13px; outline: none; transition: border-color .2s;
}
.sahapay-country-search:focus { border-color: var(--sahapay-accent); }
.sahapay-country-list { list-style: none; margin: 0; padding: 4px 0; max-height: 200px; overflow-y: auto; }
.sahapay-country-list::-webkit-scrollbar { width: 4px; }
.sahapay-country-list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }
.sahapay-country-list li { display: flex; align-items: center; gap: 9px; padding: 8px 14px; cursor: pointer; font-size: 13px; color: #374151; transition: background .15s; }
.sahapay-country-list li:hover { background: #f8fafc; }
.sahapay-country-list li.selected { background: rgba(var(--sahapay-accent-rgb),.07); color: var(--sahapay-accent); font-weight: 600; }
.sahapay-country-list .sp-flag { font-size: 16px; }
.sahapay-country-list .sp-dial { margin-left: auto; font-size: 11.5px; color: #94a3b8; }

/* ── TOS checkbox ─────────────────────────────────────────────── */
.sahapay-tos-label { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: #475569; cursor: pointer; margin: 12px 0; }
.sahapay-checkbox-wrapper { position: relative; flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.sahapay-checkbox { position: absolute; opacity: 0; width: 0; height: 0; }
.sahapay-checkmark { position: absolute; inset: 0; background: #fff; border: 1.5px solid #d1d5db; border-radius: 4px; transition: all .18s; }
.sahapay-checkbox:checked + .sahapay-checkmark { background: var(--sahapay-accent); border-color: var(--sahapay-accent); }
.sahapay-checkbox:checked + .sahapay-checkmark::after {
  content: ''; position: absolute; left: 3px; top: 0px; width: 4px; height: 8px;
  border: 2px solid #fff; border-top: none; border-left: none; transform: rotate(45deg);
}
.sahapay-tos-link { color: var(--sahapay-accent); text-decoration: underline; }

/* ── Stripe element ───────────────────────────────────────────── */
.sahapay-stripe-element { padding: 11px 12px; border: 1.5px solid #e2e8f0; border-radius: 9px; transition: border-color .2s; margin-bottom: 7px; }
.sahapay-stripe-element.StripeElement--focus { border-color: var(--sahapay-accent); }
.sahapay-card-errors { color: #ef4444; font-size: 12px; min-height: 16px; }

.sahapay-security-note { display: flex; align-items: center; gap: 5px; justify-content: center; font-size: 11.5px; color: #94a3b8; margin-top: 9px; }
.sahapay-security-note svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ── Error banner ─────────────────────────────────────────────── */
.sahapay-error-msg {
  background: #fef2f2; border: 1px solid #fecaca; color: #dc2626;
  padding: 9px 13px; border-radius: 8px; font-size: 13px;
  margin-bottom: 11px; animation: sp-in .2s;
}

/* ── Step 3 success ───────────────────────────────────────────── */
.sahapay-success-anim { display: flex; justify-content: center; margin: 16px 0 20px; }
.sahapay-success-circle { width: 72px; height: 72px; animation: sp-bounce .5s cubic-bezier(.175,.885,.32,1.275) forwards; }
@keyframes sp-bounce { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.sahapay-checkmark-svg { width: 72px; height: 72px; }
.sahapay-checkmark-circle { stroke: var(--sahapay-accent); stroke-width: 2; stroke-dasharray: 166; stroke-dashoffset: 166; animation: sp-stroke .6s .3s ease forwards; }
.sahapay-checkmark-check { stroke: var(--sahapay-accent); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: sp-stroke .4s .9s ease forwards; }
@keyframes sp-stroke { to { stroke-dashoffset: 0; } }
.sahapay-success-title { text-align: center; font-size: 22px; font-weight: 700; color: #0f172a; margin: 0 0 8px; }
.sahapay-success-msg { text-align: center; color: #64748b; font-size: 14px; line-height: 1.6; margin: 0 0 20px; }

/* ══════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 820px)
══════════════════════════════════════════ */
@media (max-width: 820px) {
  .sahapay-panel--left { flex: 0 0 260px; }
  .sahapay-hero-image  { flex: 0 0 170px; }
  .sahapay-panel--right { padding: 18px 16px 16px; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — Mobile landscape / large phone (≤ 680px)
   Stack panels vertically; hide the left card image to save space
══════════════════════════════════════════ */
@media (max-width: 680px) {
  .sahapay-overlay { padding: 0; align-items: flex-end; }

  .sahapay-modal-wrapper { max-width: 100%; }

  .sahapay-modal {
    flex-direction: column;
    gap: 0;
    /* Remove card gap — they sit flush in a sheet */
    border-radius: 20px 20px 0 0;
    overflow: hidden;
  }

  /* On mobile the left card becomes a compact header strip */
  .sahapay-panel--left {
    flex: none;
    flex-direction: row;
    border-radius: 20px 20px 0 0;
    max-height: none;
  }
  .sahapay-hero-image {
    flex: 0 0 100px;
    height: 100px;
  }
  .sahapay-org-info { padding: 12px 14px; }
  .sahapay-org-name  { font-size: 11px; }
  .sahapay-org-desc  { display: none; } /* hide on mobile to save space */
  .sahapay-legal-links { display: none; }

  /* Right card fills the rest */
  .sahapay-panel--right {
    border-radius: 0;
    max-height: 75vh;
    padding: 16px 14px;
    overflow-y: auto;
  }

  /* Form grid goes single column */
  .sahapay-form-grid { grid-template-columns: 1fr; gap: 8px; }

  /* Country dropdown — keep on-screen */
  .sahapay-country-dropdown { width: 240px; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — Small phone (≤ 420px)
══════════════════════════════════════════ */
@media (max-width: 420px) {
  .sahapay-amounts-grid { grid-template-columns: repeat(2, 1fr); }
  .sahapay-hero-image { flex: 0 0 80px; height: 80px; }
  .sahapay-org-logo  { height: 26px; }
  .sahapay-gw-pills  { gap: 5px; }
  .sahapay-gw-pill-inner { padding: 6px 10px; font-size: 12px; }
  .sahapay-continue-btn { font-size: 14px; padding: 12px 16px; }
}
