/* ════════════════════════════════════════════════════════════════════
   PayCash Base — Reset, Typography, RTL, Scrollbar
   ════════════════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  font-weight: var(--weight-normal);
  background: var(--bg-base);
  color: var(--text-primary);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Typography ────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.5px; }

p { color: var(--text-secondary); }
small { font-size: var(--text-xs); }

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}
a:hover { color: var(--brand-primary-dim); }

code, pre, kbd, samp { font-family: var(--font-mono); font-size: 0.9em; }
code {
  padding: 2px 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  color: var(--brand-primary);
}

ul, ol { list-style: none; }

img, svg, video { max-width: 100%; display: block; }

button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }

input, textarea, select { font-family: inherit; }

table { border-collapse: collapse; width: 100%; }

hr { border: none; border-top: 1px solid var(--border); margin: var(--space-md) 0; }

/* ── Selection ─────────────────────────────────────────────────────── */
::selection { background: var(--brand-primary); color: var(--brand-on-primary); }

/* ── Scrollbar ─────────────────────────────────────────────────────── */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Focus ─────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
button:focus { outline: none; }

/* ── Numeric values use mono font for alignment ────────────────────── */
.num,
[data-num] { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ── RTL helpers ───────────────────────────────────────────────────── */
.ltr { direction: ltr; text-align: left; }
.rtl { direction: rtl; text-align: right; }

/* ── Utilities ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }
.text-warning   { color: var(--warning); }
.text-info      { color: var(--info); }
.text-accent    { color: var(--brand-primary); }

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-md   { font-size: var(--text-md); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

.font-normal    { font-weight: var(--weight-normal); }
.font-medium    { font-weight: var(--weight-medium); }
.font-semibold  { font-weight: var(--weight-semibold); }
.font-bold      { font-weight: var(--weight-bold); }

.flex     { display: flex; }
.inline-flex { display: inline-flex; }
.grid     { display: grid; }
.block    { display: block; }
.inline   { display: inline; }
.inline-block { display: inline-block; }

.flex-col { flex-direction: column; }
.flex-1   { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.justify-start   { justify-content: flex-start; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.m-0 { margin: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-2 { padding-inline: var(--space-2); }
.px-4 { padding-inline: var(--space-4); }
.py-2 { padding-block: var(--space-2); }
.py-4 { padding-block: var(--space-4); }

.w-full  { width: 100%; }
.h-full  { height: 100%; }
.min-w-0 { min-width: 0; }

.rounded-sm  { border-radius: var(--radius-sm); }
.rounded-md  { border-radius: var(--radius-md); }
.rounded-lg  { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }

.overflow-auto    { overflow: auto; }
.overflow-hidden  { overflow: hidden; }

.no-select { user-select: none; -webkit-user-select: none; }

/* ── Loading states ────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 0%, var(--bg-overlay) 50%, var(--bg-elevated) 100%);
  background-size: 200% 100%;
  animation: skeleton-shine 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shine {
  0%   { background-position: -100% 0; }
  100% { background-position: 100% 0; }
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand-primary);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ───────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-2xl) var(--space-md);
  text-align: center;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: var(--space-3); opacity: 0.5; }
.empty-state-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--text-secondary); margin-bottom: var(--space-1); }
.empty-state-description { font-size: var(--text-sm); }

/* ── Page error ────────────────────────────────────────────────────── */
.page-error {
  padding: var(--space-2xl);
  text-align: center;
  color: var(--danger);
}

/* ── Animations (general) ──────────────────────────────────────────── */
@keyframes fade-in     { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-in-up  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slide-in-right { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.fade-in    { animation: fade-in var(--duration-base) var(--ease); }
.fade-in-up { animation: fade-in-up var(--duration-base) var(--ease); }
