/* ============================================================
 * pay.css — page-specific styles for /pay (Make a Payment)
 * The IT Experience
 *
 * Presentation only. Loaded after the shared styles.css, so it
 * inherits every brand token (--accent, --bg-*, --font-*, etc.)
 * and only adds the styles unique to this page: the invoice
 * lookup row, the loaded-invoice panel, the Stripe card modal,
 * and the receipt view. Mirrors the form styling already used by
 * payment-request.html and portable-internet-rental.html so the
 * page feels native to the site.
 * ============================================================ */

/* ── Trust strip (reused pattern) ── */
.trust-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; margin-bottom: 72px; }
.trust-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px 26px; text-align: center;
  transition: all 0.35s var(--ease-out);
}
.trust-card:hover { border-color: var(--border-hover); transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.trust-card-icon {
  width: 50px; height: 50px; border-radius: 14px; background: var(--accent-glow);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.trust-card-icon svg { width: 22px; height: 22px; stroke: var(--accent); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.trust-card h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.trust-card p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; }

/* ── Form shell ── */
.form-layout { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.form-topbar {
  background: var(--bg-secondary); padding: 32px 36px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.form-topbar h2 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.form-topbar p { font-size: 0.88rem; color: var(--text-secondary); margin-top: 4px; }
.form-topbar-secure {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: var(--radius-pill); background: var(--accent-glow); color: var(--accent);
  font-family: var(--font-display); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.form-topbar-secure svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

.form-body { padding: 36px; }

.form-section { padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.form-section-heading {
  font-family: var(--font-display); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 18px;
}
.form-section-sub { font-size: 0.86rem; color: var(--text-secondary); line-height: 1.55; margin: -8px 0 18px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-row.full { grid-template-columns: 1fr; }
.form-row.three { grid-template-columns: 2fr 1fr 1fr; }
.form-row.split-321 { grid-template-columns: 3fr 2fr 1fr; }
.form-row.two-one { grid-template-columns: 2fr 1fr; }

.fld { margin-bottom: 20px; }
.form-section .fld:last-child, .form-row .fld { margin-bottom: 0; }
.form-row + .fld, .fld + .form-row, .form-row + .form-row { margin-top: 20px; }

.fld label { display: block; font-family: var(--font-display); font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; letter-spacing: 0.01em; }
.fld label .req { color: #ef4444; margin-left: 2px; }
.fld label .hint, .fld .label-help {
  color: var(--text-muted); font-weight: 400; letter-spacing: 0; margin-left: 6px;
  font-family: var(--font-body); font-size: 0.74rem;
}

.fld input, .fld select, .fld textarea {
  width: 100%; padding: 12px 14px; font-family: var(--font-body); font-size: 0.92rem;
  color: var(--text-primary); background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 10px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; box-sizing: border-box;
}
.fld textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.fld input::placeholder, .fld textarea::placeholder { color: var(--text-muted, #5a6478); opacity: 1; }
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.fld input:read-only { opacity: 0.85; cursor: default; }
.fld select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238892a8' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 4 3.5-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px;
  cursor: pointer; color-scheme: dark; -webkit-appearance: none; -moz-appearance: none; appearance: none;
}
.fld select option { background: #1a2236; color: #e8ecf4; padding: 8px 12px; }

.fld.has-error input, .fld.has-error select, .fld.has-error textarea { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.15); }
.fld .err-msg { display: none; font-size: 0.78rem; color: #ef4444; margin-top: 5px; }
.fld.has-error .err-msg { display: block; }

/* Amount input with $ prefix */
.amount-wrap { position: relative; }
.amount-wrap .amount-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 600; pointer-events: none; }
.amount-wrap input { padding-left: 26px; font-size: 1.05rem; font-weight: 600; }

/* ── Invoice lookup row ── */
.inv-lookup { display: flex; gap: 12px; align-items: flex-start; }
.inv-lookup .fld { flex: 1 1 auto; margin-bottom: 0; }
.inv-load-btn {
  flex: 0 0 auto; align-self: stretch; margin-top: 29px; /* aligns with input, past the label */
  display: inline-flex; align-items: center; gap: 8px; padding: 0 20px; height: 44px;
  font-family: var(--font-display); font-size: 0.88rem; font-weight: 700; white-space: nowrap;
  color: var(--accent); background: var(--accent-glow); border: 1px solid var(--accent-border-strong);
  border-radius: 10px; cursor: pointer; transition: all 0.2s;
}
.inv-load-btn:hover { background: var(--accent-glow-strong); }
.inv-load-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.inv-load-btn .spinner-sm { display: none; width: 15px; height: 15px; border: 2px solid var(--accent-border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
.inv-load-btn.loading .spinner-sm { display: inline-block; }
.inv-load-btn.loading .inv-load-label { opacity: 0.6; }
@media (max-width: 560px) { .inv-lookup { flex-direction: column; } .inv-load-btn { margin-top: 4px; width: 100%; justify-content: center; } }

/* Inline lookup status message under the invoice row */
.inv-note { margin-top: 12px; font-size: 0.84rem; line-height: 1.5; display: none; }
.inv-note.show { display: block; }
.inv-note.is-info  { color: var(--text-secondary); }
.inv-note.is-warn  { color: #f0b429; }
.inv-note.is-error { color: #ef4444; }

/* ── Loaded-invoice panel ── */
.inv-panel {
  display: none; margin-top: 20px; border: 1px solid var(--accent-border-strong);
  border-radius: 14px; overflow: hidden; background: linear-gradient(180deg, rgba(59,143,245,0.06) 0%, transparent 100%);
}
.inv-panel.show { display: block; }
.inv-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 22px; border-bottom: 1px solid var(--accent-border);
}
.inv-panel-head h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 800; }
.inv-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--radius-pill);
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.inv-badge.st-open, .inv-badge.st-sent, .inv-badge.st-overdue { background: rgba(240,180,41,0.14); color: #f0b429; }
.inv-badge.st-partially_paid { background: rgba(59,143,245,0.14); color: var(--accent); }
.inv-badge.st-paid { background: rgba(34,197,94,0.14); color: #22c55e; }
.inv-panel-body { padding: 20px 22px; }
.inv-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.inv-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9rem; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.inv-kv .k { color: var(--text-muted); }
.inv-kv .v { color: var(--text-primary); font-weight: 600; text-align: right; }
.inv-kv.balance .v { color: var(--accent); font-size: 1.05rem; }
@media (max-width: 560px) { .inv-rows { grid-template-columns: 1fr; } }

/* Two payment paths */
.pay-paths { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .pay-paths { grid-template-columns: 1fr; } }
.pay-path {
  border: 1px solid var(--border); border-radius: 12px; padding: 20px; background: var(--bg-primary);
  display: flex; flex-direction: column; gap: 10px;
}
.pay-path.recommended { border-color: var(--accent-border-strong); background: var(--accent-glow); }
.pay-path .pp-tag {
  align-self: flex-start; font-family: var(--font-display); font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent);
  background: var(--bg-primary); border: 1px solid var(--accent-border); border-radius: var(--radius-pill); padding: 3px 10px;
}
.pay-path h4 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
.pay-path p { font-size: 0.84rem; color: var(--text-secondary); line-height: 1.5; flex: 1 1 auto; }
.portal-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px;
  padding: 13px 20px; font-family: var(--font-display); font-size: 0.92rem; font-weight: 700;
  color: var(--bg-primary); background: var(--accent); border: none; border-radius: 10px;
  cursor: pointer; text-decoration: none; transition: all 0.25s;
}
.portal-btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,143,245,0.35); }
.portal-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pp-card-link {
  align-self: flex-start; background: transparent; border: 0; padding: 0; margin-top: 4px;
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; color: var(--accent);
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}

/* ── Checkbox rows (receipt opt-in, remember-me) ── */
.check-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-size: 0.86rem; color: var(--text-secondary); line-height: 1.5; }
.check-row + .check-row { margin-top: 12px; }
.check-row input[type="checkbox"] {
  flex: 0 0 20px; width: 20px; height: 20px; margin: 1px 0 0; appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background: var(--bg-primary); border: 1.5px solid var(--border); border-radius: 6px; cursor: pointer; position: relative;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.check-row input[type="checkbox"]:hover { border-color: var(--border-hover); }
.check-row input[type="checkbox"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.check-row input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.check-row input[type="checkbox"]:checked::after { content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }

/* Honeypot */
.fld-hp { position: absolute; left: -9999px; top: -9999px; opacity: 0; height: 0; width: 0; overflow: hidden; }

/* ── Submit button + spinner (shared pattern) ── */
.form-submit { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin-top: 28px; }
.btn-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 16px 32px; font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  color: var(--bg-primary); background: var(--accent); border: none; border-radius: 12px;
  cursor: pointer; transition: all 0.3s; letter-spacing: -0.01em;
}
.btn-submit:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,143,245,0.35); }
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-submit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-submit .amt-tail { opacity: 0.85; font-weight: 600; }
.form-submit .fine { font-size: 0.76rem; color: var(--text-muted); text-align: center; line-height: 1.5; }

.spinner { display: none; width: 20px; height: 20px; border: 2.5px solid rgba(10,14,23,0.35); border-top-color: var(--bg-primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-submit.loading .spinner { display: inline-block; }
.btn-submit.loading .btn-label, .btn-submit.loading .btn-arrow, .btn-submit.loading .amt-tail { display: none; }

/* Secured-by-Stripe strip */
.secured-strip { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; font-size: 0.78rem; color: var(--text-muted); }
.secured-strip svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ── Stripe card modal ── */
.pay-modal-overlay {
  position: fixed; inset: 0; z-index: 1200; display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; background: rgba(6,9,15,0.78); opacity: 0; transition: opacity 0.25s;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.pay-modal-overlay.open { opacity: 1; }
.pay-modal {
  width: 100%; max-width: 460px; margin: auto; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: 0 24px 70px rgba(0,0,0,0.5); transform: translateY(12px) scale(0.98);
  transition: transform 0.25s var(--ease-out); overflow: hidden;
}
.pay-modal-overlay.open .pay-modal { transform: none; }
.pay-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.pay-modal-head h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; }
.pay-modal-close { background: transparent; border: 0; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 8px; transition: color 0.2s, background 0.2s; }
.pay-modal-close:hover { color: var(--text-primary); background: var(--bg-secondary); }
.pay-modal-close svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
.pay-modal-body { padding: 22px; }
.pay-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px; margin-bottom: 18px; background: var(--bg-secondary); border-radius: 12px; }
.pay-summary .ps-label { font-size: 0.85rem; color: var(--text-secondary); }
.pay-summary .ps-amt { font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; color: var(--text-primary); }
.pay-mode-badge { display: inline-block; margin-bottom: 16px; padding: 6px 12px; border-radius: 8px; background: rgba(240,180,41,0.14); color: #f0b429; font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
#payment-element { margin-bottom: 16px; min-height: 40px; }
.pay-errors { color: #ef4444; font-size: 0.84rem; margin-bottom: 14px; min-height: 1em; line-height: 1.45; }
.pay-modal .btn-submit { font-size: 0.95rem; padding: 14px 28px; }

/* ── Status views (success / error / receipt) ── */
.form-status { display: none; text-align: center; padding: 56px 36px 72px; }
.form-status.show { display: block; }
.form-status .status-icon { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.form-status .status-icon svg { width: 28px; height: 28px; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.form-status.success .status-icon { background: rgba(34,197,94,0.12); }
.form-status.success .status-icon svg { stroke: #22c55e; }
.form-status.error .status-icon { background: rgba(239,68,68,0.12); }
.form-status.error .status-icon svg { stroke: #ef4444; }
.form-status h3 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; margin-bottom: 8px; }
.form-status > p { font-size: 0.92rem; color: var(--text-secondary); line-height: 1.6; max-width: 440px; margin: 0 auto; }

/* Receipt card inside the success view */
.receipt {
  max-width: 440px; margin: 26px auto 0; text-align: left; border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; background: var(--bg-secondary);
}
.receipt-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.receipt-head .r-total { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: #22c55e; }
.receipt-head .r-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.receipt-rows { padding: 8px 20px 16px; }
.receipt-row { display: flex; justify-content: space-between; gap: 14px; font-size: 0.88rem; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.receipt-row:last-child { border-bottom: 0; }
.receipt-row .rk { color: var(--text-muted); }
.receipt-row .rv { color: var(--text-primary); font-weight: 600; text-align: right; word-break: break-word; }
.receipt-row .rv.ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }
.receipt-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 26px; }
.receipt-actions a, .receipt-actions button {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 10px;
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; cursor: pointer; text-decoration: none; transition: all 0.25s; border: none;
}
.receipt-actions .ra-primary { color: var(--bg-primary); background: var(--accent); }
.receipt-actions .ra-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.receipt-actions .ra-secondary { color: var(--accent); background: var(--accent-glow); border: 1px solid var(--accent-border); }
.receipt-actions .ra-secondary:hover { background: var(--accent-glow-strong); }
.receipt-actions svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn-retry { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; padding: 10px 24px; font-family: var(--font-display); font-size: 0.88rem; font-weight: 600; color: var(--accent); background: var(--accent-glow); border: none; border-radius: 8px; cursor: pointer; transition: all 0.3s; }
.btn-retry:hover { background: var(--accent-glow-strong); }

/* Conditional visibility helper */
.is-hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .trust-grid { grid-template-columns: 1fr; }
  .form-topbar { flex-direction: column; align-items: flex-start; }
  .form-body { padding: 26px 18px 34px; }
  .form-row, .form-row.three, .form-row.split-321, .form-row.two-one { grid-template-columns: 1fr; }
}
