/* ============================================
   نظام إدارة الإيجارات - ثيم فاتح
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

/* ---- متغيرات الثيم الفاتح ---- */
:root {
  --primary: #5C54E8;
  --primary-light: #7B75F5;
  --primary-dark: #4A42CC;
  --secondary: #00B89A;
  --secondary-light: #00D4B2;
  --accent: #EF4444;
  --accent2: #F59E0B;
  --warning: #F97316;

  --bg-page: #F0F4FF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8F9FF;
  --bg-sidebar: #FFFFFF;
  --bg-topbar: rgba(255,255,255,0.97);
  --bg-input: #F5F7FA;
  --bg-modal: #FFFFFF;

  --border-color: #E2E8F2;
  --border-color-active: rgba(92,84,232,0.4);

  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;

  --shadow-card: 0 2px 12px rgba(0,0,0,0.07);
  --shadow-card-hover: 0 8px 30px rgba(0,0,0,0.12);
  --shadow-sidebar: 4px 0 20px rgba(0,0,0,0.06);
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.15);
  --shadow-glow: 0 0 30px rgba(92,84,232,0.12);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; }

/* ---- خلفية متحركة فاتحة ---- */
body::before {
  content: '';
  position: fixed;
  top: -30%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(92,84,232,0.08) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  left: -5%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(0,184,154,0.07) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Layout ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ---- Sidebar (القائمة الجانبية باللون الأزرق الملوكي الملكي) ---- */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #1E40AF 0%, #1D4ED8 40%, #1E3A8A 100%);
  box-shadow: 4px 0 25px rgba(30, 58, 138, 0.25);
  border-left: 1px solid rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 99999 !important; /* لضمان ظهورها دائماً فوق أي تظليل أو طبقة */
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0, 0, 0, 0.12);
}

.sidebar-logo-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #1D4ED8;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.sidebar-logo .logo-title {
  font-size: 17px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.2;
  letter-spacing: 0.2px;
}
.sidebar-logo .logo-sub {
  font-size: 11px;
  color: #BFDBFE;
  margin-top: 2px;
  font-weight: 600;
}

/* زر إغلاق القائمة في الجوال */
.sidebar-close-btn {
  display: none;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #FFFFFF;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.sidebar-close-btn:hover {
  background: rgba(239,68,68,0.8);
  color: white;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 800;
  color: #BAE6FD;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 14px 6px;
  margin-top: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: #EFF6FF;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 4px;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.18);
  color: #FFFFFF;
  transform: translateX(-3px);
}

.nav-item.active {
  background: #FFFFFF;
  color: #1D4ED8 !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
  font-weight: 800;
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: #2563EB;
  border-radius: 3px;
}

.nav-item .nav-icon {
  width: 22px;
  text-align: center;
  font-size: 17px;
  flex-shrink: 0;
}

.nav-badge {
  margin-right: auto;
  background: #EF4444;
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(239,68,68,0.4);
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.15);
  background: rgba(0, 0, 0, 0.18);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid rgba(255,255,255,0.15);
}
.user-info:hover {
  background: rgba(239,68,68,0.3);
  border-color: rgba(239,68,68,0.5);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #FFFFFF;
  color: #1D4ED8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 800; color: #FFFFFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: #BFDBFE; font-weight: 600; }

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-right: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--bg-topbar);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.topbar-title h1 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
}

.topbar-title .breadcrumb {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-content {
  flex: 1;
  padding: 28px;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}

.card:hover { box-shadow: var(--shadow-card-hover); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.purple::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card.green::before { background: linear-gradient(90deg, var(--secondary), var(--secondary-light)); }
.stat-card.red::before { background: linear-gradient(90deg, var(--accent), #FF8080); }
.stat-card.yellow::before { background: linear-gradient(90deg, var(--warning), var(--accent2)); }

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}

.stat-card.purple .stat-icon { background: #EEF2FF; }
.stat-card.green .stat-icon { background: #ECFDF5; }
.stat-card.red .stat-icon { background: #FEF2F2; }
.stat-card.yellow .stat-icon { background: #FFFBEB; }

.stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.stat-card.purple .stat-value { color: var(--primary); }
.stat-card.green .stat-value { color: var(--secondary); }
.stat-card.red .stat-value { color: var(--accent); }
.stat-card.yellow .stat-value { color: var(--warning); }

.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 3px 10px rgba(92,84,232,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(92,84,232,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-success {
  background: linear-gradient(135deg, var(--secondary), #00957A);
  color: white;
  box-shadow: 0 3px 10px rgba(0,184,154,0.3);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,184,154,0.4); }

.btn-danger {
  background: linear-gradient(135deg, var(--accent), #DC2626);
  color: white;
  box-shadow: 0 3px 10px rgba(239,68,68,0.25);
}
.btn-danger:hover { transform: translateY(-1px); }

.btn-warning {
  background: linear-gradient(135deg, var(--warning), #EA580C);
  color: white;
  box-shadow: 0 3px 10px rgba(249,115,22,0.25);
}
.btn-warning:hover { transform: translateY(-1px); }

.btn-ghost {
  background: #F5F7FA;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-ghost:hover { background: #EEF2FF; color: var(--primary); border-color: rgba(92,84,232,0.3); }

.btn-whatsapp {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: white;
  box-shadow: 0 3px 10px rgba(37,211,102,0.25);
}
.btn-whatsapp:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(37,211,102,0.4); }

.btn-sms {
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: white;
  box-shadow: 0 3px 10px rgba(59,130,246,0.25);
}
.btn-sms:hover { transform: translateY(-1px); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* ---- Table ---- */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  width: 100%;
}

table {
  width: 100%;
  min-width: 650px; /* يضمن عدم انضغاط الأعمدة في الجوال */
  border-collapse: collapse;
}

thead th {
  background: #F5F7FA;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 14px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 2px solid var(--border-color);
}

tbody tr { border-bottom: 1px solid var(--border-color); transition: var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #F8F9FF; }

tbody td {
  padding: 13px 14px;
  font-size: 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

/* ---- Status Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.badge-success { background: #ECFDF5; color: #059669; border: 1px solid #A7F3D0; }
.badge-danger { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }
.badge-warning { background: #FFFBEB; color: #D97706; border: 1px solid #FDE68A; }
.badge-info { background: #EEF2FF; color: var(--primary); border: 1px solid #C7D2FE; }
.badge-neutral { background: #F5F7FA; color: var(--text-secondary); border: 1px solid var(--border-color); }

/* currency badges */
.badge-sar { background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA; }
.badge-yer { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.badge-usd { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(92,84,232,0.1);
  background: white;
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 13px center;
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; line-height: 1.5; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-modal);
}

.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title { font-size: 17px; font-weight: 800; color: var(--text-primary); }

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #F5F7FA;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}
.modal-close:hover { background: #FEF2F2; color: var(--accent); border-color: #FECACA; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* ---- Search & Filter Bar ---- */
.search-filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-input-wrapper { position: relative; flex: 1; min-width: 200px; }
.search-input-wrapper .search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}
.search-input-wrapper .form-control { padding-right: 36px; }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 14px; opacity: 0.5; }
.empty-state h3 { font-size: 17px; color: var(--text-secondary); margin-bottom: 7px; font-weight: 700; }
.empty-state p { font-size: 13px; line-height: 1.7; }

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  background: white;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  min-width: 260px;
  max-width: 360px;
  animation: slideInToast 0.3s ease;
  cursor: pointer;
}

.toast.success { border-right: 3px solid #059669; }
.toast.error { border-right: 3px solid var(--accent); }
.toast.warning { border-right: 3px solid var(--warning); }
.toast.info { border-right: 3px solid var(--primary); }

.toast-icon { font-size: 17px; flex-shrink: 0; }
.toast-message { font-size: 13px; font-weight: 600; flex: 1; line-height: 1.4; color: var(--text-primary); }

@keyframes slideInToast {
  from { transform: translateX(-18px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #EEF2FF 0%, #F0F9FF 50%, #ECFDF5 100%);
  position: relative;
  overflow: hidden;
}

.login-card {
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(92,84,232,0.12);
  border-radius: 24px;
  padding: 44px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 20px 60px rgba(0,0,0,0.1), 0 0 30px rgba(92,84,232,0.08);
  backdrop-filter: blur(20px);
}

.login-logo { text-align: center; margin-bottom: 32px; }

.login-logo .logo-circle {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(92,84,232,0.4);
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-logo p { font-size: 13px; color: var(--text-secondary); margin-top: 5px; }

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 18px; }

.page-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-btn:hover, .page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ---- Confirm Dialog ---- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.confirm-overlay.open { opacity: 1; pointer-events: all; }

.confirm-box {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  transform: scale(0.95);
  transition: transform 0.25s;
  box-shadow: var(--shadow-modal);
}
.confirm-overlay.open .confirm-box { transform: scale(1); }

.confirm-icon { font-size: 44px; margin-bottom: 14px; }
.confirm-title { font-size: 17px; font-weight: 800; margin-bottom: 9px; color: var(--text-primary); }
.confirm-msg { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 22px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ---- Collection Stat ---- */
.collection-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}
.collection-stat:last-child { border-bottom: none; }
.collection-label { font-size: 13px; color: var(--text-secondary); }
.collection-value { font-size: 14px; font-weight: 700; color: var(--text-primary); }

/* ---- Progress ---- */
.progress-bar { height: 6px; background: #EEF2FF; border-radius: 3px; overflow: hidden; margin-top: 7px; }
.progress-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }

/* ---- Receipt ---- */
.receipt {
  background: white;
  color: #1a1a1a;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 460px;
  margin: 0 auto;
  font-family: 'Cairo', sans-serif;
  direction: rtl;
  border: 1px solid #E2E8F2;
}

.receipt-header { text-align: center; padding-bottom: 18px; border-bottom: 2px dashed #E2E8F2; margin-bottom: 18px; }
.receipt-title { font-size: 20px; font-weight: 800; color: #1a1a1a; }
.receipt-subtitle { font-size: 12px; color: #64748B; margin-top: 3px; }
.receipt-number { font-size: 13px; font-weight: 700; color: var(--primary); margin-top: 7px; }

.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 13px;
}
.receipt-row:last-child { border-bottom: none; }
.receipt-row .label { color: #64748B; }
.receipt-row .value { font-weight: 700; color: #1E293B; }

.receipt-total {
  background: linear-gradient(135deg, #EEF2FF, #F0FFF4);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-top: 18px;
  border: 1px solid rgba(92,84,232,0.15);
}
.receipt-total .amount { font-size: 26px; font-weight: 800; color: var(--primary); }
.receipt-total .amount-label { font-size: 12px; color: #64748B; }

.receipt-footer { text-align: center; font-size: 11px; color: #94A3B8; margin-top: 18px; padding-top: 14px; border-top: 1px dashed #E2E8F2; }

/* ---- Overdue & Reminder Cards ---- */
.overdue-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: #FEF2F2; border: 1px solid #FECACA;
  border-radius: 12px; transition: var(--transition);
}
.overdue-item:hover { border-color: #FCA5A5; box-shadow: 0 2px 10px rgba(239,68,68,0.1); }
.overdue-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #DC2626); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; color: white; }
.overdue-info { flex: 1; min-width: 0; }
.overdue-name { font-size: 13px; font-weight: 700; }
.overdue-unit { font-size: 12px; color: var(--text-secondary); }
.overdue-days { font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }

.reminder-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: #FFFBEB; border: 1px solid #FDE68A;
  border-radius: 12px; transition: var(--transition);
}
.reminder-item:hover { border-color: #FCD34D; }
.reminder-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent2), #D97706); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; color: white; }
.reminder-info { flex: 1; min-width: 0; }
.reminder-name { font-size: 13px; font-weight: 700; }
.reminder-due { font-size: 12px; color: var(--text-secondary); }
.reminder-days { font-size: 12px; font-weight: 700; color: #D97706; white-space: nowrap; }

/* ---- SMS Connection Info ---- */
.sms-server-card {
  background: #F8FAFF;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 14px;
  transition: var(--transition);
}
.sms-server-card.active { border-color: var(--primary); background: #EEF2FF; }
.sms-server-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.sms-info-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 12px; border-bottom: 1px solid var(--border-color); }
.sms-info-row:last-child { border-bottom: none; }
.sms-info-label { color: var(--text-secondary); }
.sms-info-value { font-weight: 600; color: var(--primary); font-family: monospace; font-size: 11px; word-break: break-all; text-align: left; max-width: 60%; }

/* ============================================
   عناصر ومكونات الجوال والشاشات الذكية
   ============================================ */

/* زر فتح القائمة الجانبية (Hamburger Button) */
.mobile-menu-btn {
  display: none;
  background: white;
  border: 1px solid var(--border-color);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: var(--transition);
  margin-left: 10px;
  flex-shrink: 0;
}
.mobile-menu-btn:hover, .mobile-menu-btn:active {
  background: #EEF2FF;
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(0.97);
}

/* خلفية تظليل الشاشة عند فتح القائمة بالجوال */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99990 !important; /* تحت الـ sidebar مباشرة وفوق باقي الصفحة */
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* شريط التنقل السفلي المخصص للجوال (Mobile Bottom Navigation Bar) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  height: 64px;
  z-index: 99980 !important;
  justify-content: space-around;
  align-items: center;
  padding: 4px 6px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  height: 100%;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 10px;
  transition: var(--transition);
  position: relative;
}

.bottom-nav-icon {
  font-size: 19px;
  line-height: 1;
  transition: var(--transition);
}

.bottom-nav-item.active {
  color: var(--primary);
}
.bottom-nav-item.active .bottom-nav-icon {
  transform: translateY(-2px);
}
.bottom-nav-badge {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 4px;
  background: #EF4444;
  color: white;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

/* تحسين الجداول للتمرير الأفقي الناعم بالجوال */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
}

/* ---- التجاوب مع مختلف الشاشات (Responsive Breakpoints) ---- */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
  .mobile-menu-btn { display: flex; }
  .sidebar-close-btn { display: flex; }
  .sidebar {
    transform: translateX(100%);
    box-shadow: -8px 0 35px rgba(0,0,0,0.3);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-content {
    margin-right: 0 !important;
  }
}

@media (max-width: 768px) {
  .mobile-bottom-nav { display: flex; }
  .page-content {
    padding: 14px 14px 85px !important; /* مساحة كافية للشريط السفلي */
  }
  .topbar {
    padding: 10px 14px;
  }
  .topbar-title h1 {
    font-size: 17px;
  }
  .topbar-actions {
    gap: 8px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .stat-card {
    padding: 16px;
  }
  .stat-value {
    font-size: 20px;
  }
  .form-row, .form-row-3 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .card-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .modal {
    width: 95% !important;
    max-width: 95% !important;
    max-height: 90vh !important;
    margin: auto;
    border-radius: 20px !important;
    padding: 20px 16px !important;
  }
  .btn {
    padding: 9px 14px;
    font-size: 13px;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .topbar-title .breadcrumb {
    display: none;
  }
  .notify-actions {
    justify-content: flex-end;
    width: 100%;
  }
}

/* ---- Print ---- */
@media print {
  .sidebar, .topbar, .mobile-bottom-nav, .mobile-menu-btn, .sidebar-overlay, .no-print { display: none !important; }
  .main-content { margin-right: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #F5F7FA; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ---- Animations ---- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.fade-in { animation: fadeIn 0.35s ease forwards; }
.pulse { animation: pulse 2s infinite; }
.overdue-badge-pulse { animation: pulse 1.5s infinite; }

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-success { color: #059669 !important; }
.text-danger { color: var(--accent) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary-color { color: var(--primary) !important; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.fw-bold { font-weight: 700; } .w-100 { width: 100%; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Notify actions */
.notify-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
