/* =============================================================================
   SHOP — Design System
   All pages share this stylesheet.
============================================================================= */

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --blue:         #2563EB;
  --blue-d:       #1D4ED8;
  --blue-dd:      #1E3A8A;
  --blue-l:       #EFF6FF;
  --blue-border:  #BFDBFE;
  --green:        #059669;
  --green-l:      #ECFDF5;
  --green-border: #A7F3D0;
  --red:          #DC2626;
  --red-l:        #FEF2F2;
  --red-border:   #FECACA;
  --amber:        #D97706;
  --amber-l:      #FFFBEB;
  --amber-border: #FDE68A;
  --text:         #0F172A;
  --text-2:       #475569;
  --text-3:       #94A3B8;
  --border:       #E2E8F0;
  --border-d:     #CBD5E1;
  --bg:           #F8FAFC;
  --card:         #FFFFFF;
  --radius:       0.75rem;
  --radius-sm:    0.375rem;
  --radius-full:  9999px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:    0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --transition:   0.18s ease;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               'Cairo', 'Noto Sans Arabic', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.container--sm  { max-width: 560px; }
.container--md  { max-width: 800px; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: -0.02em;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-2);
  font-weight: 500;
}
.back-link:hover { color: var(--blue); text-decoration: none; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.btn-primary:hover { background: var(--blue-d); box-shadow: 0 4px 12px rgba(37,99,235,.4); }

.btn-success {
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5,150,105,.25);
}
.btn-success:hover { background: #047857; }

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { background: #B91C1C; }

.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}
.btn-outline:hover { background: var(--blue-l); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1.5px solid var(--border-d);
}
.btn-ghost:hover { background: var(--bg); }

.btn-lg { padding: 0.9rem 2rem; font-size: 1.05rem; border-radius: var(--radius-sm); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn-block { width: 100%; }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 1.75rem; }
.card-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-blue    { background: var(--blue-l);   color: var(--blue-d); border: 1px solid var(--blue-border); }
.badge-green   { background: var(--green-l);  color: #065F46;       border: 1px solid var(--green-border); }
.badge-red     { background: var(--red-l);    color: #991B1B;       border: 1px solid var(--red-border); }
.badge-amber   { background: var(--amber-l);  color: #92400E;       border: 1px solid var(--amber-border); }

/* ── Form elements ───────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.45rem; }
.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.form-hint { font-size: 0.8rem; color: var(--text-2); }
.form-input, .form-select {
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border-d);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-input.error { border-color: var(--red); }
.form-error { font-size: 0.8rem; color: var(--red); margin-top: 0.25rem; }

/* ── Method selector tabs ────────────────────────────────────────────────────── */
.method-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.method-tab {
  border: 2px solid var(--border-d);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  background: var(--card);
  text-align: center;
  transition: border-color var(--transition), background var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.method-tab input[type="radio"] { display: none; }
.method-tab .method-icon { font-size: 1.75rem; line-height: 1; }
.method-tab .method-label { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.method-tab .method-sub   { font-size: 0.75rem; color: var(--text-2); }
.method-tab:has(input:checked),
.method-tab.active {
  border-color: var(--blue);
  background: var(--blue-l);
}

/* ── Instructions box ────────────────────────────────────────────────────────── */
.instructions {
  background: var(--blue-l);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.instructions-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--blue-d);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.instructions p { font-size: 0.9rem; color: var(--blue-dd); margin-bottom: 0.3rem; }
.instructions strong { font-weight: 700; font-size: 1rem; }
.instructions ol { padding-left: 1.25rem; margin-top: 0.5rem; }
.instructions ol li { font-size: 0.85rem; color: var(--blue-dd); margin-bottom: 0.2rem; }

/* ── Alert boxes ─────────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.alert-warning { background: var(--amber-l); border: 1px solid var(--amber-border); color: #78350F; }
.alert-success { background: var(--green-l); border: 1px solid var(--green-border); color: #064E3B; }
.alert-error   { background: var(--red-l);   border: 1px solid var(--red-border);   color: #7F1D1D; }
.alert-info    { background: var(--blue-l);  border: 1px solid var(--blue-border);  color: #1E3A8A; }
.alert-icon    { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.05rem; }

/* ── Section headings ────────────────────────────────────────────────────────── */
.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  margin-bottom: 0.6rem;
}

/* ── Copy-to-clipboard ───────────────────────────────────────────────────────── */
.copy-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border-d);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.5rem 0.5rem 0.9rem;
}
.copy-field code {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-all;
}
.copy-btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

/* ── Spinner ─────────────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--blue-border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2.5px;
  display: inline-block;
  vertical-align: middle;
}

/* ── Status icon ─────────────────────────────────────────────────────────────── */
@keyframes pop { 0% { transform: scale(0.3); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
.status-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 1.25rem;
  animation: pop 0.4s ease-out;
}
.status-icon-pending { background: var(--amber-l); }
.status-icon-success { background: var(--green-l); }
.status-icon-error   { background: var(--red-l); }

/* ── Stats row (admin) ───────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  text-align: center;
}
.stat-number { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label  { font-size: 0.78rem; color: var(--text-2); margin-top: 0.3rem; font-weight: 500; }

/* ── Table ───────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead { background: var(--bg); }
th { padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); white-space: nowrap; }
td { padding: 0.9rem 1rem; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: var(--bg); }
.td-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.82rem; }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-2);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
footer a { color: var(--text-2); }
footer a:hover { color: var(--blue); }

/* ── Landing page specific ───────────────────────────────────────────────────── */
.hero {
  padding: 4rem 0;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 3.5rem;
  align-items: center;
}
.product-visual {
  background: linear-gradient(135deg, var(--blue-dd) 0%, var(--blue) 100%);
  border-radius: var(--radius);
  aspect-ratio: 3/4;
  max-width: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
}
.product-visual img { width: 100%; height: 100%; object-fit: cover; }
.product-visual-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: rgba(255,255,255,0.85);
  padding: 2rem;
  text-align: center;
}
.product-visual-placeholder .book-icon { font-size: 5rem; }
.product-visual-placeholder p { font-size: 0.9rem; opacity: 0.7; }

.product-info { display: flex; flex-direction: column; gap: 1.1rem; }
.product-name {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text);
}
.product-subtitle { font-size: 1.1rem; color: var(--text-2); font-weight: 400; }
.product-desc { color: var(--text-2); line-height: 1.7; }

.features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.features-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: var(--text);
}
.features-list li::before {
  content: "✓";
  color: var(--green);
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
}
.price-currency {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-2);
}
.price-note { font-size: 0.82rem; color: var(--text-3); margin-top: 0.2rem; }

/* ── Checkout / form pages ───────────────────────────────────────────────────── */
.checkout-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 2rem;
  padding: 2.5rem 0 4rem;
}
.order-summary { position: sticky; top: 5rem; height: fit-content; }
.order-product-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.3rem; }
.order-product-sub  { font-size: 0.85rem; color: var(--text-2); margin-bottom: 1rem; }
.order-divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.order-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  font-size: 1.1rem;
}
.order-total-row .amount { color: var(--blue); font-size: 1.4rem; }

.checkout-form { display: flex; flex-direction: column; gap: 1.25rem; }

/* ── Pending / status pages ──────────────────────────────────────────────────── */
.status-page {
  min-height: calc(100vh - 65px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.status-card {
  width: 100%;
  max-width: 500px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  text-align: center;
}
.status-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.status-card p  { color: var(--text-2); font-size: 0.95rem; }

.order-id-block { margin: 1.5rem 0; text-align: left; }

.pulse { animation: pulse-anim 2s ease-in-out infinite; }
@keyframes pulse-anim { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── Admin page ──────────────────────────────────────────────────────────────── */
.admin-page { padding: 2rem 0 4rem; }
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.filter-tab {
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1.5px solid var(--border-d);
  background: var(--card);
  cursor: pointer;
  color: var(--text-2);
  transition: all var(--transition);
}
.filter-tab.active { border-color: var(--blue); background: var(--blue-l); color: var(--blue-d); }

/* ── Login form ──────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: calc(100vh - 65px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
}
.login-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.25rem; }
.login-sub   { font-size: 0.9rem; color: var(--text-2); margin-bottom: 1.75rem; }

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.text-center { text-align: center; } .text-sm { font-size: 0.875rem; } .text-muted { color: var(--text-2); }
.font-bold { font-weight: 700; } .font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }
.w-full { width: 100%; } .hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-grid      { grid-template-columns: 1fr; }
  .product-visual { max-width: 220px; margin: 0 auto; }
  .hero           { padding: 2rem 0; }
  .product-name   { font-size: 1.6rem; }
  .price          { font-size: 2rem; }

  .checkout-grid  { grid-template-columns: 1fr; }
  .order-summary  { position: static; }

  .method-tabs    { grid-template-columns: 1fr 1fr; }

  th, td { padding: 0.6rem 0.75rem; }
}
@media (max-width: 480px) {
  .method-tabs    { grid-template-columns: 1fr 1fr; }
  .stats-row      { grid-template-columns: 1fr 1fr; }
  .btn-lg         { padding: 0.85rem 1.5rem; font-size: 1rem; }
}
