/* إيقاع الحياة · Neoleap payment page — matches ayqaealhayaa.sa (warm dark, copper accent, IBM Plex Sans Arabic + Changa).
   Logical properties (inline-start/end) so the Arabic page mirrors correctly. */
:root {
  --bg: #15110f;
  --card: #201510;
  --line: rgba(239, 219, 196, .14);
  --line-strong: rgba(239, 219, 196, .26);
  --fg: #f4efe9;
  --muted: #b5a79e;
  --accent: #c88a5a;
  --accent-hover: #dfa878;
  --on-accent: #15110f;
  --radius: 10px;
  --ok: #22c55e;
  --bad: #ef4444;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-width: 320px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: 'IBM Plex Sans Arabic', ui-sans-serif, system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.is-admin .wrap { max-width: 1180px; }
.icon { vertical-align: -2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; height: 72px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 40px; height: 40px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 19px; font-weight: 700; }
.brand-text small { font-size: 11px; color: var(--muted); }
.head-links { display: flex; gap: 20px; }
.back-link { font-size: 14px; font-weight: 700; color: var(--muted); }
.back-link:hover { color: var(--accent); }

.main { flex: 1; padding-top: 56px; padding-bottom: 64px; }

/* Card */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }
.card h1, .card h2, .dash-head h1, .gateway .state, .stat strong, .brand-text strong { font-family: Changa, 'IBM Plex Sans Arabic', sans-serif; }
.card h1 { margin: 0 0 4px; font-size: 28px; font-weight: 700; line-height: 1.25; }
.card h2 { margin: 0 0 16px; font-size: 20px; font-weight: 800; }
.card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.card h3.sub { margin-top: 28px; }
.lead { margin: 0 0 24px; color: var(--muted); }
.pay-card { max-width: 460px; margin: 0 auto; }

/* Form */
.field { display: block; margin: 0 0 18px; padding: 0; border: 0; }
.field > span { display: block; font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=password], .field select {
  width: 100%; height: 48px; padding: 0 14px;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--fg); font: inherit; font-size: 16px; outline: none;
}
.field select { appearance: auto; }
.field input::placeholder { color: #7d6f66; }
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200, 138, 90, .25); }
.field.has-error input { border-color: var(--bad); }
.field-error { display: block; margin-top: 6px; font-style: normal; font-size: 13px; color: #fca5a5; }
.field.compact { margin: 0 0 12px; }
.field.compact input, .field.compact select { height: 42px; font-size: 15px; }

.amount-input { position: relative; }
.amount-input input[type=text] { height: 64px; padding-left: 76px; font-size: 28px; font-weight: 800; text-align: left; }
.amount-input .currency { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--accent); font-weight: 800; }

.mode label { display: inline-flex; align-items: center; gap: 6px; margin-inline-end: 20px; cursor: pointer; }
.mode input { accent-color: var(--accent); }

/* Buttons */
.btn-primary, .btn-ghost, .btn-stop {
  display: inline-flex; align-items: center; justify-content: center;
  height: 52px; padding: 0 24px; border: 0; border-radius: var(--radius);
  font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; transition: background .2s, border-color .2s, color .2s;
}
.btn-primary { width: 100%; background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled, .btn-ghost:disabled { opacity: .7; cursor: wait; }
.btn-ghost { width: 100%; background: transparent; color: var(--fg); border: 1px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-stop { background: transparent; color: #fca5a5; border: 1px solid rgba(239, 68, 68, .5); }
.btn-stop:hover { background: rgba(239, 68, 68, .12); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.result .btn-ghost { margin-top: 10px; }

.fine { margin: 14px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

.alert { margin: 0 auto 20px; padding: 12px 14px; font-size: 14px; font-weight: 700; border: 1px solid; overflow-wrap: anywhere; }
.alert, .alert-error { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .4); color: #fca5a5; }
.alert-ok { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .4); color: #86efac; }
.alert a { text-decoration: underline; }
.is-admin > main > .alert { max-width: 1180px; }

/* Result page */
.result { max-width: 460px; margin: 0 auto; text-align: center; }
.result-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 20px; }
.result-ok .result-icon { background: var(--ok); color: #052e14; }
.result-wait .result-icon { background: var(--accent); color: var(--on-accent); }
.result-fail .result-icon { background: var(--bad); color: #fff; }
.result h1 { margin-bottom: 12px; }

/* Why a payment was declined */
.reason { margin: 0 0 16px; padding: 14px 16px; text-align: start; background: rgba(239, 68, 68, .08); border: 1px solid rgba(239, 68, 68, .35); border-inline-start: 3px solid var(--bad); }
.reason-label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: #fca5a5; }
.reason p { margin: 4px 0 0; font-size: 16px; font-weight: 700; }
.reason small { display: block; margin-top: 8px; color: var(--muted); word-break: break-word; }

.summary { margin: 0 0 24px; border: 1px solid var(--line); text-align: start; }
.summary div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.summary div:last-child { border-bottom: 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 800; word-break: break-all; text-align: end; }
.summary.compact div { padding: 8px 12px; font-size: 14px; }
.summary.details dd { font-weight: 700; }

/* Dashboard */
.dash { display: grid; gap: 20px; }
.dash > * { min-width: 0; }
.dash-head { display: flex; justify-content: space-between; align-items: center; }
.dash-head h1 { margin: 0; font-size: 28px; font-weight: 700; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 16px; font-weight: 800; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current=page] { color: var(--accent); border-bottom-color: var(--accent); }

.gateway { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.gateway .label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.gateway .state { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 700; }
.gateway .dot { width: 12px; height: 12px; background: var(--bad); }
.gateway.is-on { border-inline-start: 3px solid var(--ok); }
.gateway.is-off { border-inline-start: 3px solid var(--bad); }
.gateway.is-on .dot { background: var(--ok); }
.gateway p { margin: 4px 0 0; }
.gateway form .btn-primary, .gateway form .btn-stop { width: auto; min-width: 180px; }
.settings { max-width: 520px; }

.steps { margin: 0 0 24px; padding-inline-start: 20px; color: var(--muted); }
.steps li { margin-bottom: 6px; }
.steps strong { color: var(--fg); }
.steps a { color: var(--accent); }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tool { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); display: flex; flex-direction: column; }
.tool > p { margin: 0 0 16px; }
.tool .btn-primary, .tool .btn-ghost { margin-top: auto; }
.test-card .summary { margin: 8px 0 6px; }
.test-card p { margin: 0; }
.copy { cursor: pointer; border-bottom: 1px dashed var(--muted); }
.copy:hover { color: var(--accent); }
.copy.copied::after { content: ' ✓ copied'; color: var(--ok); font-size: 12px; }

.check { margin-top: 20px; padding: 16px; border: 1px solid; }
.check p { margin: 4px 0 12px; }
.check-ok { border-color: rgba(34, 197, 94, .4); background: rgba(34, 197, 94, .06); }
.check-ok strong { color: #86efac; }
.check-bad { border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .06); }
.check-bad strong { color: #fca5a5; }
.check .summary { margin: 0; background: var(--card); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; }
.stat span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat strong { font-size: 26px; font-weight: 700; line-height: 1.3; }
.stat strong small { font-size: 14px; color: var(--muted); }
.stat em { font-style: normal; font-size: 13px; color: var(--muted); }
.stat:first-child { border-inline-start: 3px solid var(--ok); }

.filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end; }
.filters .btn-ghost { height: 42px; margin-bottom: 12px; width: auto; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 12px; font-size: 14px; }
.list-head a { color: var(--accent); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 10px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
td.wrap-cell { white-space: normal; min-width: 240px; max-width: 380px; }
th { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.num { text-align: end; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.tag { font-family: 'IBM Plex Sans Arabic', sans-serif; font-size: 11px; padding: 1px 6px; border: 1px solid var(--line-strong); color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; font-size: 12px; font-weight: 800; background: rgba(255, 255, 255, .08); color: var(--muted); }
.badge-paid { background: rgba(34, 197, 94, .15); color: #86efac; }
.badge-pending { background: rgba(200, 138, 90, .16); color: #e7b68d; }
.badge-declined { background: rgba(239, 68, 68, .12); color: #fca5a5; }

.back { margin: 0 0 16px; }
.back a { color: var(--accent); font-weight: 700; }
.detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-head h2 { margin: 0; font-size: 20px; }
.row-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.row-actions .btn-primary, .row-actions .btn-ghost { width: auto; }
.pager { display: flex; justify-content: space-between; margin-top: 16px; font-size: 14px; }
.pager a { color: var(--accent); font-weight: 700; }
.log { margin: 0; padding: 16px; max-height: 70vh; overflow: auto; background: var(--bg); border: 1px solid var(--line); font: 12px/1.7 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 20px; padding-bottom: 20px; }
.secure-note { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 860px) {
  .tools, .stats { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .main { padding-top: 28px; }
  .card { padding: 24px 16px; }
  .tools, .stats, .filters { grid-template-columns: 1fr; }
  .gateway form, .gateway form button { width: 100%; }
  .head-links { gap: 12px; }
  .brand-text small { display: none; }
}
