/* ==========================================================================
   جمعيتي - نظام إدارة الجمعيات المالية
   Styles: Modern Executive Arabic RTL Design System
   ========================================================================== */

:root {
  /* نظام الألوان - الثيم الداكن (Dark Theme - افتراضي) */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: #1f2937;
  --bg-card-hover: #283548;
  --bg-input: #111827;
  
  --border-color: #374151;
  --border-focus: #10b981;
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* ألوان التمييز والعلامة التجارية */
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-subtle: rgba(16, 185, 129, 0.15);
  
  --gold-500: #f59e0b;
  --gold-600: #d97706;
  --gold-subtle: rgba(245, 158, 11, 0.15);
  
  --blue-500: #3b82f6;
  --blue-subtle: rgba(59, 130, 246, 0.15);
  
  --purple-500: #8b5cf6;
  --purple-subtle: rgba(139, 92, 246, 0.15);
  
  --danger-500: #ef4444;
  --danger-subtle: rgba(239, 68, 68, 0.15);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* الثيم الفاتح (Light Theme) */
body.theme-light {
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f9fafb;
  --bg-input: #f9fafb;
  
  --border-color: #e5e7eb;
  --border-focus: #10b981;
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* التنسيق العام والخطوط */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  height: -webkit-fill-available;
}

body {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  touch-action: pan-y;
}

body.modal-open {
  overflow: hidden !important;
  touch-action: none !important;
}

/* تخطيط التطبيق الرئيسي */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   1. الهيدر والشريط العلوي (Header)
   ========================================================================== */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--emerald-500), #047857);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.brand-text h1 {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.theme-light .brand-text h1 {
  background: linear-gradient(135deg, #111827, #374151);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--emerald-500);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.association-selector-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.selector-icon {
  position: absolute;
  right: 12px;
  color: var(--emerald-500);
  pointer-events: none;
  font-size: 0.95rem;
}

.association-select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 2.4rem 0.55rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-width: 220px;
}

.association-select:focus {
  outline: none;
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* ==========================================================================
   2. شريط معلومات الجمعية وقائمة التبويبات (Sub-nav & Meta)
   ========================================================================== */
.app-nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.75rem;
}

.association-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.meta-label {
  color: var(--text-secondary);
}

.meta-value {
  color: var(--text-primary);
  font-weight: 700;
}

.meta-actions {
  margin-right: auto;
  display: flex;
  gap: 0.5rem;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.nav-tab.active {
  color: var(--emerald-500);
  border-bottom-color: var(--emerald-500);
}

/* ==========================================================================
   3. المحتوى الرئيسي والبطاقات
   ========================================================================== */
.app-main {
  flex: 1;
  padding: 1.75rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: var(--transition);
}

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

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.card-body {
  padding: 1.5rem;
}

/* شبكة الإحصائيات العلوية */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-md);
}

.stat-icon-wrapper {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.bg-blue { background: var(--blue-subtle); color: var(--blue-500); }
.bg-emerald { background: var(--emerald-subtle); color: var(--emerald-500); }
.bg-amber { background: var(--gold-subtle); color: var(--gold-500); }
.bg-purple { background: var(--purple-subtle); color: var(--purple-500); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.825rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0.15rem 0;
  letter-spacing: -0.5px;
}

.stat-hint {
  font-size: 0.775rem;
  color: var(--text-muted);
}

/* لوحة تحكم منقسمة (الشهر الحالي + المتأخرين) */
.dashboard-split {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 960px) {
  .dashboard-split {
    grid-template-columns: 1fr;
  }
}

.month-stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.month-stepper-text {
  font-size: 0.85rem;
  font-weight: 700;
}

/* بنر استحقاق القبض */
.payout-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.payout-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-500), #b45309);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.8rem;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
  flex-shrink: 0;
}

.payout-details {
  flex: 1;
}

.payout-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.payout-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0.2rem 0 0.5rem;
}

.payout-meta-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.payout-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

/* شريط تقدم تحصيل الشهر */
.month-progress-section {
  padding: 0 1.5rem 1.5rem;
}

.progress-info-row, .progress-values-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.progress-values-row {
  margin-top: 0.4rem;
  margin-bottom: 0;
  color: var(--text-secondary);
}

.progress-bar-track {
  height: 10px;
  background: var(--bg-secondary);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald-500), #34d399);
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* قائمة المتأخرين */
.overdue-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
  padding-left: 0.25rem;
}

.overdue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 0.75rem;
}

.overdue-user-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.overdue-user-amount {
  font-size: 0.85rem;
  color: var(--danger-500);
  font-weight: 700;
}

/* ==========================================================================
   4. الجداول ومصفوفة التحصيل (Tables & Matrix)
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}

.matrix-wrapper {
  width: 100%;
  overflow: visible;
}

.matrix-card-body {
  padding: 1.25rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.95rem;
}

.data-table th {
  background: var(--bg-secondary);
  padding: 0.9rem 1.2rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* مصفوفة التحصيل الشهري (Matrix Table) */
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.875rem;
  touch-action: pan-x pan-y;
}

.matrix-table th, .matrix-table td {
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--border-color);
  vertical-align: middle;
}

.matrix-table th {
  background: var(--bg-secondary);
  font-weight: 700;
  white-space: nowrap;
}

.matrix-table th.sticky-col, .matrix-table td.sticky-col {
  position: sticky;
  right: 0;
  background: var(--bg-card);
  z-index: 5;
  text-align: right;
  padding-right: 1rem;
  font-weight: 700;
  min-width: 160px;
  border-left: 2px solid var(--border-color);
}

.matrix-table th.sticky-col {
  background: var(--bg-secondary);
}

.matrix-cell-btn {
  width: 100%;
  min-height: 42px;
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: inherit;
  transition: var(--transition);
  padding: 5px 4px;
  touch-action: manipulation;
}

.matrix-cell-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.matrix-cell-btn.cell-paid {
  background: var(--emerald-subtle);
  border: 1px solid var(--emerald-500);
  color: var(--emerald-500);
}

.matrix-cell-btn.cell-partial {
  background: var(--gold-subtle);
  border: 1px solid var(--gold-500);
  color: var(--gold-500);
}

.matrix-cell-btn.cell-unpaid {
  background: var(--danger-subtle);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--danger-500);
}

.matrix-cell-btn.cell-payout-month {
  box-shadow: 0 0 0 2px var(--gold-500) inset;
}

.cell-status {
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.cell-amount {
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.cell-icon {
  font-size: 0.85rem;
}

/* أسطورة المصفوفة (Legend) */
.legend-group {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.825rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-paid { background: var(--emerald-500); }
.dot-partial { background: var(--gold-500); }
.dot-unpaid { background: var(--danger-500); }
.dot-payout { background: var(--gold-500); box-shadow: 0 0 6px var(--gold-500); }

/* تبويب التقارير والتحليلات */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.5rem;
}

.report-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.btn-group-wrap {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.actions-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ==========================================================================
   5. الأزرار والشارات (Buttons & Badges)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.925rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald-500), #047857);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #34d399, var(--emerald-500));
}

.btn-success {
  background: var(--emerald-500);
  color: #fff;
}

.btn-accent {
  background: linear-gradient(135deg, var(--gold-500), #b45309);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-secondary);
}

.btn-outline-emerald {
  background: var(--emerald-subtle);
  border: 1px solid var(--emerald-500);
  color: var(--emerald-500);
}

.btn-outline-emerald:hover {
  background: var(--emerald-500);
  color: #ffffff;
}

.btn-danger-outline {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--danger-500);
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-icon:hover {
  background: var(--bg-card-hover);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.825rem;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.775rem;
  border-radius: var(--radius-sm);
}

.w-100 { width: 100%; }

/* الشارات (Badges) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-primary { background: var(--emerald-subtle); color: var(--emerald-500); }
.badge-accent { background: var(--gold-subtle); color: var(--gold-500); }
.badge-danger { background: var(--danger-subtle); color: var(--danger-500); }
.badge-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }

.status-pill {
  padding: 0.35rem 0.85rem;
  border-radius: 99px;
  font-size: 0.825rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.status-completed {
  background: var(--emerald-subtle);
  color: var(--emerald-500);
  border: 1px solid var(--emerald-500);
}

.status-pending {
  background: var(--gold-subtle);
  color: var(--gold-500);
  border: 1px solid var(--gold-500);
}

.text-accent { color: var(--gold-500); }
.text-emerald { color: var(--emerald-500); }
.text-amber { color: var(--gold-500); }
.text-danger { color: var(--danger-500); }
.text-muted { color: var(--text-secondary); }

/* ==========================================================================
   6. النوافذ المنبثقة (Modals)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
  overflow-y: auto;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-content form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}

.modal-sm { max-width: 440px; }
.modal-receipt-wrap { max-width: 680px; }

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--danger-500);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

/* النماذج وحقول الإدخال */
.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.form-row {
  display: flex;
  gap: 1rem;
}

.flex-1 { flex: 1; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.required { color: var(--danger-500); }

/* ملخص الدفع داخل النافذة */
.payment-summary-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.summary-line:last-child {
  margin-bottom: 0;
}

/* قائمة النسخ الاحتياطي */
.backup-actions-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

.backup-action-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 1rem;
}

.action-desc {
  display: flex;
  flex-direction: column;
}

.action-desc strong {
  font-size: 0.95rem;
}

.action-desc span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.danger-zone {
  border-color: rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   7. تصميم الإيصال الرسمي للطباعة والمشاركة (Receipt Paper)
   ========================================================================== */
.receipt-paper {
  background: #ffffff;
  color: #111827;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  position: relative;
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #047857;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.receipt-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #047857;
  font-size: 1.2rem;
  font-weight: 800;
}

.receipt-meta {
  text-align: left;
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 600;
}

.receipt-title-banner {
  text-align: center;
  margin-bottom: 1.5rem;
}

.receipt-title-banner h2 {
  font-size: 1.4rem;
  font-weight: 900;
  color: #0f172a;
}

.rec-assoc-name {
  font-size: 1rem;
  color: #047857;
  font-weight: 700;
  margin-top: 0.2rem;
}

.receipt-content-body {
  margin-bottom: 2rem;
}

.receipt-paragraph {
  font-size: 1.05rem;
  margin-bottom: 0.85rem;
  line-height: 1.8;
  color: #1e293b;
}

.rec-highlight {
  color: #047857;
  font-size: 1.15rem;
  padding: 0 4px;
}

.receipt-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed #cbd5e1;
}

.signature-block {
  text-align: center;
  min-width: 160px;
  position: relative;
}

.sign-label {
  display: block;
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 2.5rem;
  font-weight: 600;
}

.sign-line {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  border-top: 1px solid #94a3b8;
  padding-top: 0.4rem;
}

.official-stamp {
  position: absolute;
  top: 15px;
  right: 50%;
  transform: translateX(50%) rotate(-12deg);
  border: 2px dashed #047857;
  color: #047857;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.85rem;
  opacity: 0.85;
}

/* ==========================================================================
   8. التنبيهات المنبثقة (Toast Notifications)
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
}

.toast {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 0.925rem;
  animation: slideUp 0.3s ease;
  min-width: 280px;
}

.toast.toast-success {
  border-right: 4px solid var(--emerald-500);
}

.toast.toast-error {
  border-right: 4px solid var(--danger-500);
}

.toast.toast-info {
  border-right: 4px solid var(--blue-500);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* الفوتر */
.app-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   9. الطباعة الرسمية (Print Stylesheet)
   ========================================================================== */
.print-only { display: none; }

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header, .app-nav, .app-footer, .nav-tabs, .btn, .modal-overlay, .toast-container, .header-actions {
    display: none !important;
  }

  .app-main {
    padding: 0 !important;
    max-width: 100% !important;
  }

  .print-only {
    display: block !important;
  }

  .print-page {
    page-break-after: always;
    padding: 20mm;
  }

  .receipt-paper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
}

/* أدوات التحكم في الظهور حسب نوع الشاشة */
.show-mobile-only {
  display: none !important;
}

.hide-mobile {
  display: inline-flex;
}

/* ==========================================================================
   10. تنسيقات الربط السحابي (Turso Cloud Database Styles)
   ========================================================================== */
.status-indicator-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
  transition: var(--transition);
}

.dot-online {
  background: var(--emerald-500);
  box-shadow: 0 0 8px var(--emerald-500);
}

.dot-offline {
  background: var(--text-muted);
}

.dot-syncing {
  background: var(--gold-500);
  animation: pulseSync 1s infinite alternate;
}

@keyframes pulseSync {
  from { opacity: 0.4; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.3); box-shadow: 0 0 10px var(--gold-500); }
}

.cloud-info-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.cloud-status-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.cloud-banner-success {
  background: var(--emerald-subtle);
  border: 1px solid var(--emerald-500);
  color: var(--emerald-500);
}

.cloud-banner-warning {
  background: var(--gold-subtle);
  border: 1px solid var(--gold-500);
  color: var(--gold-500);
}

.cloud-banner-error {
  background: var(--danger-subtle);
  border: 1px solid var(--danger-500);
  color: var(--danger-500);
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
}

/* ==========================================================================
   11. استجابة كاملة لشاشات الهواتف الذكية (مثل Oppo Reno 15 Pro)
   ========================================================================== */
@media (max-width: 768px) {
  .show-mobile-only {
    display: flex !important;
  }

  .hide-mobile {
    display: none !important;
  }

  /* الحاوية الأساسية مع مساحة حماية للشريط السفلي وزر التنقل لـ Android/ColorOS */
  .app-container {
    padding-bottom: calc(75px + env(safe-area-inset-bottom, 20px));
  }

  /* الشريط العلوي (Header) مدمج ومريح */
  .app-header {
    flex-direction: column;
    align-items: stretch;
    padding: 0.65rem 0.85rem;
    gap: 0.65rem;
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .header-brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
    border-radius: var(--radius-sm);
  }

  .brand-text h1 {
    font-size: 1.25rem;
  }

  .brand-subtitle {
    font-size: 0.7rem;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
  }

  .association-selector-wrap {
    flex: 1;
    min-width: 0;
  }

  .association-select {
    width: 100%;
    min-width: 0;
    padding: 0.45rem 2rem 0.45rem 0.65rem;
    font-size: 0.825rem;
    height: 38px;
  }

  .selector-icon {
    right: 8px;
    font-size: 0.85rem;
  }

  .btn-assoc-action {
    padding: 0.45rem 0.75rem;
    font-size: 0.825rem;
    height: 38px;
  }

  /* شريط التبويبات العلوي يتم إخفاؤه على الموبايل ليحل محله الشريط السفلي Native */
  .app-nav {
    padding: 0 0.85rem;
  }

  .nav-tabs {
    display: none !important;
  }

  /* شريط ملخص الجمعية كشريط شارات أفقي قابل للسحب */
  .association-meta {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 0.45rem !important;
    padding: 0.5rem 0 !important;
    scrollbar-width: none;
    border-bottom: none;
  }

  .association-meta::-webkit-scrollbar {
    display: none;
  }

  .meta-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 99px;
    padding: 0.25rem 0.65rem;
    font-size: 0.775rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .meta-actions {
    display: none !important;
  }

  /* المحتوى الرئيسي مع مساحة أمان سفلية لضمان عدم حجب أي زر بالشريط السفلي */
  .app-main {
    padding: 0.75rem 0.75rem calc(105px + env(safe-area-inset-bottom, 25px)) 0.75rem !important;
  }

  /* إخفاء فوتر الموقع التقليدي في الموبايل لتفريغ الشاشة للشريط السفلي */
  .app-footer {
    display: none !important;
  }

  /* شبكة الإحصائيات (2x2 Grid) لتناسب شاشة رينو 15 برو */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.55rem !important;
    margin-bottom: 1rem !important;
  }

  .stat-card {
    padding: 0.75rem 0.85rem !important;
    gap: 0.6rem !important;
    border-radius: var(--radius-md) !important;
  }

  .stat-icon-wrapper {
    width: 38px !important;
    height: 38px !important;
    font-size: 1.15rem !important;
  }

  .stat-value {
    font-size: 1.15rem !important;
    margin: 0 !important;
  }

  .stat-label {
    font-size: 0.725rem !important;
  }

  .stat-hint {
    font-size: 0.675rem !important;
  }

  /* لوحة التحكم المنقسمة */
  .dashboard-split {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .card-header {
    padding: 0.85rem 1rem !important;
  }

  .card-header.flex-between {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  .actions-group {
    display: flex !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .actions-group .btn {
    flex: 1 !important;
    justify-content: center !important;
    font-size: 0.825rem !important;
    padding: 0.55rem !important;
  }

  .card-title {
    font-size: 1rem !important;
  }

  .card-body {
    padding: 1rem !important;
  }

  /* بنر الاستحقاق */
  .payout-banner {
    margin: 0.75rem !important;
    padding: 1rem !important;
    gap: 0.85rem !important;
    text-align: center;
    flex-direction: column;
  }

  .payout-meta-tags {
    justify-content: center !important;
  }

  .payout-avatar {
    width: 54px !important;
    height: 54px !important;
    font-size: 1.4rem !important;
    margin: 0 auto;
  }

  .payout-name {
    font-size: 1.25rem !important;
  }

  .payout-actions {
    width: 100%;
    align-items: stretch !important;
    gap: 0.4rem !important;
  }

  .payout-actions .btn {
    width: 100%;
  }

  .month-progress-section {
    padding: 0 0.85rem 1rem !important;
  }

  /* إزالة حبس السكرول في قائمة المتأخرين بالموبايل لضمان التمرير الطبيعي الكامل */
  .overdue-list {
    max-height: none !important;
    overflow-y: visible !important;
  }

  /* مصفوفة التحصيل للشاشات الصغيرة */
  .matrix-card-body {
    padding: 0.65rem 0.5rem !important;
  }

  .matrix-swipe-hint {
    background: rgba(245, 158, 11, 0.1);
    border: 1px dashed var(--gold-500);
    color: var(--gold-500);
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }

  .matrix-table th.sticky-col, .matrix-table td.sticky-col {
    position: sticky;
    right: 0;
    z-index: 8;
    background: var(--bg-card) !important;
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.35);
    min-width: 125px !important;
    font-size: 0.825rem;
    padding: 0.5rem !important;
  }

  .matrix-cell-btn {
    min-height: 48px !important;
    min-width: 82px !important;
  }

  /* بطاقات المشتركين في الموبايل */
  .members-mobile-cards {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.85rem;
  }

  .member-mobile-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: var(--transition);
  }

  .member-mobile-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
  }

  .member-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .member-card-title strong {
    display: block;
    font-size: 1.05rem;
    color: var(--text-primary);
  }

  .member-card-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
  }

  .detail-item {
    display: flex;
    flex-direction: column;
  }

  .detail-label {
    color: var(--text-secondary);
    font-size: 0.725rem;
  }

  .detail-val {
    font-weight: 700;
    color: var(--text-primary);
  }

  .member-card-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
  }

  /* تبويب التقارير للموبايل */
  .reports-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .btn-group-wrap {
    flex-direction: column !important;
    width: 100% !important;
  }

  .btn-group-wrap .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* النوافذ المنبثقة بنظام Bottom Sheet للشاشات الصغيرة */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
    backdrop-filter: blur(8px);
    z-index: 2000 !important;
  }

  .modal-content {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 24px !important;
    border-top-right-radius: 24px !important;
    max-height: 85vh !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: slideUpMobile 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .modal-content form {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    height: 100% !important;
  }

  .modal-header {
    flex-shrink: 0 !important;
    padding: 1rem 1.25rem !important;
  }

  @keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .modal-body {
    padding: 1rem 1.25rem !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }

  .payment-summary-box {
    padding: 0.75rem 1rem !important;
    margin-bottom: 0.85rem !important;
  }

  .form-group {
    margin-bottom: 0.85rem !important;
  }

  .modal-footer {
    padding: 0.85rem 1rem !important;
    flex-direction: column-reverse !important;
    gap: 0.5rem !important;
    flex-shrink: 0 !important;
    background: var(--bg-secondary) !important;
    border-top: 1px solid var(--border-color) !important;
  }

  .modal-footer .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* ورقة الإيصال للموبايل */
  .receipt-paper {
    padding: 1rem !important;
  }

  .receipt-header {
    flex-direction: column !important;
    gap: 0.5rem !important;
    text-align: center !important;
  }

  .receipt-meta {
    text-align: center !important;
  }

  .receipt-signatures {
    flex-direction: column !important;
    gap: 1.25rem !important;
  }

  /* منع تكبير الشاشة التلقائي المزعج في أندرويد و ColorOS عند النقر على الحقول */
  .form-input {
    font-size: 16px !important;
    padding: 0.7rem 0.85rem !important;
  }

  .form-row {
    flex-direction: column !important;
    gap: 0 !important;
  }

  /* شريط التنقل السفلي المخصص للموبايل (Mobile Bottom Navigation Bar) */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + env(safe-area-inset-bottom, 12px));
    padding-bottom: env(safe-area-inset-bottom, 12px);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 999;
    backdrop-filter: blur(20px);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
  }

  .mobile-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-family: inherit;
    font-size: 0.725rem;
    font-weight: 700;
    flex: 1;
    height: 100%;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-btn i {
    font-size: 1.2rem;
    transition: var(--transition);
  }

  .mobile-nav-btn.active {
    color: var(--emerald-500);
  }

  .mobile-nav-btn.active i {
    transform: scale(1.18);
    filter: drop-shadow(0 2px 6px rgba(16, 185, 129, 0.5));
  }

  /* قائمة الخيارات السريعة للموبايل */
  .mobile-menu-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.85rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: right;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-primary);
    transition: var(--transition);
  }

  .mobile-menu-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--emerald-500);
  }

  .menu-item-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
  }

  .menu-item-text {
    display: flex;
    flex-direction: column;
  }

  .menu-item-text strong {
    font-size: 0.9rem;
  }

  .menu-item-text small {
    font-size: 0.75rem;
    color: var(--text-secondary);
  }
}


