/* ============================================================
   ProPods - صفحة الدفع (تصميم نظيف بأسلوب Stripe)
   ============================================================ */
:root {
  --bg:      #f5f6f8;
  --panel:   #ffffff;
  --ink:     #1a1f36;
  --muted:   #6b7385;
  --muted-2: #8a93a6;
  --line:    #e3e6eb;
  --line-2:  #d7dbe2;
  --brand:   #1f6feb;
  --brand-d: #1a5fd0;
  --green:   #15a05a;
  --danger:  #df1b41;
  --radius:  10px;
  --shadow:  0 1px 2px rgba(20,25,55,.05), 0 8px 28px rgba(20,25,55,.06);
  --font:    'Tajawal', system-ui, -apple-system, sans-serif;
}

* , *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* يضمن إخفاء شاشة النجاح حتى إتمام الدفع */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink);
  line-height: 1.7; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 800; }
p { margin: 0; }
img { display: block; max-width: 100%; }
input, select, button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ===================== الترويسة ===================== */
.co-header { background: var(--panel); border-bottom: 1px solid var(--line); }
.co-header-inner {
  max-width: 1040px; margin-inline: auto; padding: 16px 24px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
}
.co-back {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; color: var(--muted);
  text-decoration: none; font-size: .92rem; font-weight: 500; transition: color .15s;
}
.co-back:hover { color: var(--ink); }
.co-brand { justify-self: center; font-size: 1.35rem; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: .3px; }
.co-brand strong { color: var(--brand); }

/* ===================== التخطيط ===================== */
.co-main {
  max-width: 1040px; margin-inline: auto; padding: 40px 24px 60px;
  display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: start;
}

/* ===================== ملخص الطلب ===================== */
.co-summary { position: sticky; top: 32px; }
.co-eyebrow { font-size: .9rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.co-total-big { font-size: 2.6rem; font-weight: 800; letter-spacing: -.5px; margin-bottom: 26px; }
.co-cur { font-size: 1.1rem; font-weight: 700; color: var(--muted); }

.co-line-item {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 22px; border-bottom: 1px solid var(--line);
}
.co-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.co-li-info { flex: 1; }
.co-li-info strong { display: block; font-size: .98rem; }
.co-li-info span { font-size: .85rem; color: var(--muted); }
.co-qty {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden;
}
.co-qty button {
  width: 30px; height: 32px; border: none; background: var(--panel); color: var(--ink);
  font-size: 1.1rem; cursor: pointer; transition: background .15s;
}
.co-qty button:hover { background: #f0f2f5; }
.co-qty span { min-width: 26px; text-align: center; font-weight: 700; font-size: .95rem; }

.co-totals { margin: 22px 0 0; }
.co-totals > div { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; }
.co-totals dt { color: var(--muted); margin: 0; }
.co-totals dd { margin: 0; font-weight: 700; }
.co-free { color: var(--green); }
.co-grand { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 16px; }
.co-grand dt { color: var(--ink); font-weight: 800; }
.co-grand dd { font-size: 1.25rem; font-weight: 800; }
.co-summary-note { margin-top: 18px; font-size: .82rem; color: var(--muted-2); }

/* ===================== النموذج ===================== */
.co-pay-col {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 32px; box-shadow: var(--shadow);
}
.co-title { font-size: 1.5rem; margin-bottom: 18px; }
.co-section-title { font-size: 1rem; font-weight: 700; margin: 18px 0 9px; }

.co-group { margin-bottom: 11px; }
.co-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.co-label { display: block; font-size: .86rem; font-weight: 500; color: var(--ink); margin-bottom: 5px; }

.co-input {
  width: 100%; padding: 11px 13px; font-size: .98rem; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.co-input::placeholder { color: var(--muted-2); }
.co-input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31,111,235,.15);
}
.co-input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(223,27,65,.12); }
select.co-input {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7385' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 11px center; background-size: 20px; padding-inline-start: 38px;
}
.co-err { display: block; min-height: 13px; margin-top: 3px; font-size: .78rem; line-height: 1.4; color: var(--danger); }

.co-input-icon { position: relative; }
.co-card-brand {
  position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%);
  font-size: .78rem; font-weight: 800; color: var(--muted); letter-spacing: .5px;
}

/* ===================== اختيار طريقة الدفع ===================== */
.co-pay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.co-accepted { display: flex; align-items: center; gap: 6px; }
.card-logo { display: inline-flex; }
.card-logo svg { width: 38px; height: auto; display: block; border-radius: 4px; }

.co-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.co-method {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 10px; background: var(--panel); border: 1.5px solid var(--line-2);
  border-radius: var(--radius); color: var(--ink); font-size: .92rem; font-weight: 700;
  cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s;
}
.co-method:hover { border-color: var(--muted-2); }
.co-method.is-active {
  border-color: var(--brand); background: rgba(31,111,235,.05);
  box-shadow: 0 0 0 3px rgba(31,111,235,.1);
}
.co-method svg { color: var(--muted); }
.co-method.is-active svg { color: var(--brand); }

.paypal-mark { font-weight: 800; font-style: italic; font-size: 1rem; letter-spacing: -.3px; }
.paypal-mark span:first-child { color: #003087; }
.paypal-mark span:last-child  { color: #009cde; }
.paypal-mark.lg { font-size: 1.7rem; }

.co-pane { display: none; }
.co-pane.is-active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.co-paypal-box {
  text-align: center; padding: 26px 20px; border: 1px dashed var(--line-2);
  border-radius: var(--radius); background: #fafbfc;
}
.co-paypal-box p { margin-top: 10px; color: var(--muted); font-size: .9rem; }

/* ===================== زر الدفع ===================== */
.co-pay-btn {
  position: relative; width: 100%; margin-top: 22px; padding: 14px; border: none;
  border-radius: var(--radius); background: var(--brand); color: #fff;
  font-size: 1.02rem; font-weight: 800; cursor: pointer;
  transition: background .15s, transform .1s;
}
.co-pay-btn:hover { background: var(--brand-d); }
.co-pay-btn:active { transform: translateY(1px); }
.co-pay-btn:disabled { opacity: .7; cursor: progress; }
.co-spinner {
  position: absolute; top: 50%; inset-inline-start: 50%; width: 18px; height: 18px;
  margin: -9px 0 0 -9px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; display: none;
}
.co-pay-btn.loading .co-btn-label { opacity: 0; }
.co-pay-btn.loading .co-spinner { display: block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.co-foot-note {
  display: flex; align-items: flex-start; gap: 7px; margin-top: 16px;
  font-size: .8rem; color: var(--muted-2); line-height: 1.6;
}
.co-foot-note svg { color: var(--green); flex-shrink: 0; margin-top: 3px; }

/* ===================== شاشة النجاح ===================== */
.co-success { min-height: 70vh; display: grid; place-items: center; padding: 40px 24px; }
.co-success-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 44px 36px; max-width: 440px; width: 100%; text-align: center;
}
.co-check { width: 76px; height: 76px; margin: 0 auto 20px; }
.co-check svg { width: 100%; height: 100%; }
.co-check circle { stroke: var(--green); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151; animation: dc .6s ease forwards; }
.co-check path { stroke: var(--green); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: dk .35s ease .5s forwards; }
@keyframes dc { to { stroke-dashoffset: 0; } }
@keyframes dk { to { stroke-dashoffset: 0; } }
.co-success-card h2 { font-size: 1.6rem; margin-bottom: 10px; }
.co-success-card p { color: var(--muted); }
.co-order-no {
  margin: 18px 0; padding: 12px; background: #f5f7fa; border-radius: var(--radius);
  font-size: .95rem; color: var(--ink);
}
.co-success-sub { font-size: .9rem; }
.co-back-btn { display: block; margin-top: 24px; text-decoration: none; text-align: center; }

/* لوحة تفاصيل الإدخال (اختبار محلي) */
.co-test { margin-top: 22px; text-align: start; border: 1px solid var(--line); border-radius: var(--radius); background: #fafbfc; }
.co-test > summary { cursor: pointer; padding: 12px 14px; font-weight: 700; font-size: .9rem; color: var(--ink); list-style: none; }
.co-test > summary::-webkit-details-marker { display: none; }
.co-test > summary::before { content: '▸ '; color: var(--muted); }
.co-test[open] > summary::before { content: '▾ '; }
.co-test-hint { padding: 0 14px; margin: 0 0 8px; font-size: .78rem; color: var(--muted-2); }
.co-test-list { padding: 0 14px 12px; }
.co-test-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px dashed var(--line); font-size: .85rem; }
.co-test-row span { color: var(--muted); flex-shrink: 0; }
.co-test-row b { color: var(--ink); text-align: end; word-break: break-word; }

/* ===================== الإشعارات ===================== */
.toast-wrap { position: fixed; bottom: 22px; inset-inline-start: 22px; z-index: 50; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; border: 1px solid var(--line); border-inline-start: 3px solid var(--danger);
  border-radius: 8px; padding: 12px 16px; box-shadow: var(--shadow);
  font-size: .9rem; font-weight: 600; max-width: 320px; animation: tin .25s ease;
}
@keyframes tin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.out { opacity: 0; transition: opacity .25s; }

/* ===================== الاستجابة ===================== */
@media (max-width: 860px) {
  .co-main { grid-template-columns: 1fr; gap: 28px; padding: 28px 18px 50px; }
  .co-summary { position: static; order: -1; }
  .co-total-big { font-size: 2.1rem; margin-bottom: 18px; }
  .co-pay-col { padding: 22px; }
}
@media (max-width: 420px) {
  .co-row { grid-template-columns: 1fr; }
  .co-methods { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
