/* ============================================================
   RESTHOUSE MANAGER — DESIGN SYSTEM
   Mirrors Flutter AppColors exactly
   ============================================================ */

/* ── Design Tokens (Light) ────────────────────────────────── */
:root {
  /* Primary Palette */
  --color-primary:       rgb(15, 52, 81);
  --color-primary-light: rgb(30, 96, 147);
  --color-primary-dark:  rgb(15, 38, 56);
  --color-accent:        #D4AF37;
  --color-accent-light:  #F3E5AB;

  /* Status */
  --color-success: #198754;
  --color-warning: #FFC107;
  --color-danger:  #DC3545;
  --color-info:    #0D6EFD;

  /* Payment */
  --color-paid:    #198754;
  --color-partial: #FF9800;
  --color-unpaid:  #E53935;

  /* Surfaces */
  --color-bg:              #F8F9FA;
  --color-card:            #ffffff;
  --color-surface:         #F1F3F5;
  --color-border:          #DEE2E6;
  --color-text-primary:    #212529;
  --color-text-secondary:  #6C757D;

  /* Sidebar */
  --sidebar-width: 270px;
  --header-height: 64px;

  /* Radii */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);

  /* Transitions */
  --transition: 0.2s ease;
}

/* ── Dark Mode ────────────────────────────────────────────── */
[data-theme="dark"] {
  --color-bg:             #121212;
  --color-card:           #1E1E1E;
  --color-surface:        #252525;
  --color-border:         #2C2C2C;
  --color-text-primary:   #F8F9FA;
  --color-text-secondary: #A0A0A0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
}

/* ── CSS Reset ────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  direction: rtl;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Tajawal', 'Cairo', system-ui, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { display: inline-block; max-width: 100%; vertical-align: middle; }
svg:not([width]) { width: 1.25em; height: 1.25em; flex-shrink: 0; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* ── Typography ───────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem;     font-weight: 600; }

.text-primary   { color: var(--color-primary) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-success   { color: var(--color-success) !important; }
.text-warning   { color: var(--color-warning) !important; }
.text-danger    { color: var(--color-danger)  !important; }
.text-accent    { color: var(--color-accent)  !important; }
.text-muted     { color: var(--color-text-secondary) !important; }
.text-bold      { font-weight: 700 !important; }
.text-semibold  { font-weight: 600 !important; }
.text-sm        { font-size: 0.875rem; }
.text-xs        { font-size: 0.75rem; }
.text-lg        { font-size: 1.125rem; }
.text-xl        { font-size: 1.25rem; }
.text-center    { text-align: center; }
.text-end       { text-align: end; }
.strikethrough  { text-decoration: line-through; }

/* ── Layout Utilities ─────────────────────────────────────── */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.flex-1        { flex: 1; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-wrap     { flex-wrap: wrap; }
.gap-4  { gap: 4px;  }
.gap-8  { gap: 8px;  }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Grid */
.grid      { display: grid; }
.grid-2    { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3    { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }

/* Spacing */
.p-0   { padding: 0 !important; }
.p-8   { padding: 8px; }
.p-12  { padding: 12px; }
.p-16  { padding: 16px; }
.p-20  { padding: 20px; }
.p-24  { padding: 24px; }
.px-16 { padding-inline: 16px; }
.py-8  { padding-block: 8px; }
.py-12 { padding-block: 12px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.ms-auto { margin-inline-start: auto; }

/* Misc */
.hidden { display: none !important; }
.overflow-hidden { overflow: hidden; }
.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: 9999px; }
.cursor-pointer { cursor: pointer; }
.opacity-60 { opacity: 0.6; }

/* Divider */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: 0;
}

/* Loading Spinner */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm {
  width: 20px; height: 20px;
  border-width: 2px;
  border-color: rgba(255,255,255,0.4);
  border-top-color: #fff;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Page Loading */
#page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 12px;
  color: var(--color-text-secondary);
  text-align: center;
}
.empty-state svg { opacity: 0.4; }
.empty-state p { font-size: 0.95rem; }

/* Scrollbar Styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-secondary); }
