/* ─── VARIABLES ─── */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', 'Cairo', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
}

/* ─── NAVBAR ─── */
.navbar {
  background: var(--primary);
  color: white;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.navbar-brand {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.navbar-nav {
  display: flex;
  gap: .25rem;
  list-style: none;
}
.navbar-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: .4rem .8rem;
  border-radius: 8px;
  font-size: .9rem;
  transition: all .2s;
}
.navbar-nav a:hover, .navbar-nav a.active {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* ─── LAYOUT ─── */
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; }

/* ─── CARDS ─── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ─── STAT BOXES ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.stat-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--primary);
}
.stat-box.success { border-color: var(--success); }
.stat-box.warning { border-color: var(--warning); }
.stat-box.danger  { border-color: var(--danger); }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-box.success .stat-value { color: var(--success); }
.stat-box.warning .stat-value { color: var(--warning); }
.stat-box.danger  .stat-value { color: var(--danger); }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

/* ─── FORMS ─── */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
  align-items: end;
}
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  color: var(--text);
  background: white;
  transition: border-color .2s;
  direction: rtl;
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 70px; }

/* ─── BUTTONS ─── */
.btn {
  padding: .6rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: var(--danger); color: white; }
.btn-danger:hover  { background: #b91c1c; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; margin-top: .5rem; }

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead tr { background: var(--bg); }
th { padding: .65rem .85rem; text-align: right; font-weight: 600; color: var(--text-muted); font-size: .8rem; border-bottom: 2px solid var(--border); }
td { padding: .65rem .85rem; text-align: right; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ─── BADGES ─── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-danger  { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef9c3; color: #ca8a04; }

/* ─── TOTAL DISPLAY ─── */
.total-display {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1rem;
}
.total-display .amount { font-size: 2.5rem; font-weight: 800; }
.total-display .label  { font-size: .9rem; opacity: .85; }

/* ─── DATE PICKER ─── */
.date-filter {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.date-filter input, .date-filter select {
  padding: .5rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  direction: rtl;
  font-family: inherit;
}
.date-filter input:focus, .date-filter select:focus { outline: none; border-color: var(--primary); }

/* ─── EMPTY STATE ─── */
.empty { text-align: center; color: var(--text-muted); padding: 2rem; font-size: .95rem; }

/* ─── ALERT ─── */
.alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  margin-bottom: .75rem;
  font-size: .9rem;
  display: none;
}
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }

/* ─── PROGRESS BAR ─── */
.progress { background: var(--border); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 99px; transition: width .5s; }

/* ─── TABS ─── */
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; background: var(--border); border-radius: 10px; padding: 4px; }
.tab-btn {
  flex: 1;
  padding: .5rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .2s;
  font-family: inherit;
}
.tab-btn.active { background: white; color: var(--primary); box-shadow: var(--shadow); }

/* ─── RESPONSIVE ─── */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .navbar-brand span { display: none; }
  .total-display .amount { font-size: 2rem; }
}
