/* css/payment-modal.css
   Payment modal — telco network selector + Paystack redirect flow. */

/* ── Overlay ─────────────────────────────────────────────────────────────── */
.pay-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 25, 0.62);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.pay-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Dialog card ─────────────────────────────────────────────────────────── */
.pay-dialog {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 32px 80px -16px rgba(60, 20, 80, 0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.28s cubic-bezier(.2, .9, .3, 1.1);
}
.pay-overlay.open .pay-dialog {
  transform: translateY(0) scale(1);
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.pay-head {
  background: linear-gradient(135deg, #dd5588 0%, #f58518 100%);
  color: #fff;
  padding: 1.4rem 1.6rem 1.2rem;
  position: relative;
  overflow: hidden;
}
.pay-head::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 190px; height: 190px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  pointer-events: none;
}
.pay-head::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  pointer-events: none;
}
.pay-head h2 {
  font-size: 1.18rem;
  font-weight: 700;
  margin: 0;
  position: relative; z-index: 1;
}
.pay-head p {
  font-size: 0.83rem;
  opacity: 0.88;
  margin: 0.2rem 0 0;
  position: relative; z-index: 1;
}
.pay-close {
  position: absolute;
  top: 0.8rem; right: 0.9rem;
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s;
  display: grid; place-items: center;
}
.pay-close:hover { background: rgba(255,255,255,0.32); }

/* ── Body ────────────────────────────────────────────────────────────────── */
.pay-body {
  padding: 1.3rem 1.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Amount pill */
.pay-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff7fa;
  border: 1.5px solid #fce0ec;
  border-radius: 1rem;
  padding: 0.8rem 1.1rem;
}
.pay-price .label {
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: #b8a0b2;
}
.pay-price .amount {
  font-size: 1.6rem; font-weight: 700; color: #2b1e26;
  display: flex; align-items: baseline; gap: 0.25rem;
}
.pay-price .amount small {
  font-size: 0.82rem; color: #7a6873; font-weight: 600;
}

/* ── Network / method selector label ────────────────────────────────────── */
.pay-method-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a5a6a;
  margin-bottom: -0.2rem;
}

/* ── Telco cards grid ────────────────────────────────────────────────────── */
.pay-telco-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.pay-telco-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.4rem 0.55rem;
  border: 2px solid #f0dde8;
  border-radius: 0.85rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.12s;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.pay-telco-card:hover {
  border-color: #dd5588;
  background: #fff7fa;
  transform: translateY(-1px);
}
.pay-telco-card.selected {
  border-color: #dd5588;
  background: #fff2f7;
  box-shadow: 0 0 0 3px rgba(221,85,136,0.18);
}
.pay-telco-card.selected::after {
  content: '✓';
  position: absolute;
  top: 5px; right: 7px;
  font-size: 0.65rem;
  font-weight: 800;
  color: #dd5588;
  line-height: 1;
}

/* Logo wrapper — fixed height so all cards align */
.pay-telco-logo {
  width: 52px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pay-telco-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

/* Paystack card uses an SVG badge instead of a photo */
.pay-telco-logo.paystack-badge {
  background: linear-gradient(135deg, #00c3f7 0%, #011b33 100%);
  border-radius: 8px;
  width: 52px; height: 32px;
}
.pay-telco-logo.paystack-badge svg {
  width: 38px; height: 22px; fill: #fff;
}

.pay-telco-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: #4a3a44;
  text-align: center;
  line-height: 1.2;
}

/* ── Phone input row (shown only for MoMo networks) ─────────────────────── */
.pay-phone-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.pay-phone-row label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #4a3a44;
  letter-spacing: 0.02em;
}
.pay-phone-input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid #fbd0e0;
  border-radius: 0.75rem;
  background: #fff7fa;
  overflow: hidden;
  transition: border-color 0.15s;
}
.pay-phone-input-wrap:focus-within {
  border-color: #dd5588;
  background: #fff;
}
.pay-phone-prefix {
  padding: 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #96284f;
  background: #fce8f1;
  border-right: 1.5px solid #fbd0e0;
  white-space: nowrap;
  height: 42px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.pay-phone-input-wrap input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.93rem;
  padding: 0 0.85rem;
  color: #2b1e26;
  height: 42px;
  width: 100%;
  outline: none;
}
.pay-phone-hint {
  font-size: 0.72rem;
  color: #b8a0b2;
}

/* ── Paystack-only notice ────────────────────────────────────────────────── */
.pay-card-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  background: #f0f9ff;
  border-left: 4px solid #00a8e6;
  border-radius: 0.75rem;
  padding: 0.65rem 0.9rem;
  font-size: 0.8rem;
  color: #0a5a7a;
  line-height: 1.45;
}
.pay-card-notice svg {
  width: 16px; height: 16px; flex-shrink: 0;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  margin-top: 1px;
}

/* ── Secure badge row ────────────────────────────────────────────────────── */
.pay-secure-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  color: #b8a0b2;
  padding-bottom: 0.2rem;
}
.pay-secure-row svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  color: #22c55e;
}

/* ── Error / note ────────────────────────────────────────────────────────── */
.pay-error {
  background: #ffe9e9;
  border-left: 4px solid #a11212;
  border-radius: 0.75rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.83rem;
  color: #a11212;
}

/* ── Actions ─────────────────────────────────────────────────────────────── */
.pay-actions {
  display: flex;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem 1.4rem;
}
.pay-actions button {
  flex: 1;
  font-family: inherit;
  font-size: 0.93rem;
  font-weight: 700;
  padding: 0.78rem 1rem;
  border-radius: 2rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.pay-cancel {
  background: #fff;
  border-color: #fbd0e0 !important;
  color: #96284f;
}
.pay-cancel:hover { background: #fff7fa; border-color: #f7b0cb !important; }

.pay-submit {
  background: linear-gradient(135deg, #dd5588 0%, #f58518 100%);
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(221,85,136,0.55);
}
.pay-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 28px -10px rgba(221,85,136,0.6); }
.pay-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

/* Small phones (≤ 400px) — 2-column telco grid, tighter spacing */
@media (max-width: 400px) {
  .pay-dialog { border-radius: 1rem; }
  .pay-head { padding: 1rem 1.15rem .9rem; }
  .pay-head h2 { font-size: 1rem; }
  .pay-body { padding: .9rem 1rem .4rem; gap: .55rem; }
  .pay-actions { padding: .6rem 1rem 1rem; gap: .45rem; }
  .pay-actions button { font-size: .85rem; padding: .68rem .75rem; }

  .pay-telco-grid { grid-template-columns: repeat(2, 1fr); gap: .4rem; }
  .pay-telco-card { padding: .55rem .35rem .45rem; border-radius: .7rem; }
  .pay-telco-logo { width: 44px; height: 26px; }
  .pay-telco-name { font-size: .62rem; }

  .pay-price .amount { font-size: 1.25rem; }
  .pay-phone-prefix { font-size: .78rem; padding: 0 .55rem; height: 38px; }
  .pay-phone-input-wrap input { font-size: .85rem; height: 38px; }

  .pay-secure-row { font-size: .68rem; }
  .pay-card-notice { font-size: .75rem; padding: .5rem .7rem; }
}

/* Medium phones (401–600px) — keep 4-col but shrink logos */
@media (min-width: 401px) and (max-width: 600px) {
  .pay-dialog { border-radius: 1.15rem; }
  .pay-body { padding: 1.1rem 1.2rem .5rem; }
  .pay-actions { padding: .65rem 1.2rem 1.2rem; }
  .pay-telco-logo { width: 46px; height: 28px; }
  .pay-telco-name { font-size: .65rem; }
  .pay-telco-card { padding: .6rem .4rem .5rem; }
}

/* All phones — ensure modal never exceeds viewport height */
@media (max-width: 600px) {
  .pay-overlay { align-items: flex-end; padding: 0; }
  .pay-dialog {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 1.35rem;
    border-top-right-radius: 1.35rem;
    max-height: 92vh;
    overflow-y: auto;
    width: 100%;
    max-width: 100%;
    /* Slide up from bottom on mobile */
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.2,.9,.3,1);
  }
  .pay-overlay.open .pay-dialog { transform: translateY(0); }

  /* Drag handle hint */
  .pay-dialog::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    background: #e0d0d8;
    border-radius: 999px;
    margin: .65rem auto -.2rem;
  }
}

/* ── Success view (kept for compatibility) ───────────────────────────────── */
.pay-success-view {
  padding: 2rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.pay-success-view .tick {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dd5588 0%, #f58518 100%);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 18px 40px -18px rgba(221,85,136,0.7);
}
.pay-success-view .tick svg {
  width: 32px; height: 32px;
  stroke: currentColor; fill: none;
  stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
}
.pay-success-view h3 { font-size: 1.15rem; font-weight: 700; color: #2b1e26; margin-top: 0.35rem; }
.pay-success-view p  { font-size: 0.9rem; color: #7a6873; }
.pay-success-view .job {
  display: inline-block;
  background: #fff7fa;
  border: 1.5px dashed #f7b0cb;
  color: #96284f;
  font-family: ui-monospace, monospace;
  font-size: 0.9rem; font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 0.6rem;
  margin-top: 0.35rem;
}
