/* ================================================
   نظام تصميم عائلة المسري — Family Design System
   ================================================ */

/* === DESIGN TOKENS === */
:root {
  --primary:        #6C63FF;
  --primary-dark:   #5A52D5;
  --primary-light:  #8B85FF;
  --primary-glow:   rgba(108,99,255,.25);
  --secondary:      #FF6584;
  --success:        #00C896;
  --warning:        #FFB74D;
  --danger:         #FF5252;
  --info:           #3ECFCF;

  /* Light mode */
  --bg:             #F0F4F8;
  --bg2:            #E8EDF4;
  --card:           #FFFFFF;
  --card2:          #F8FAFC;
  --border:         rgba(0,0,0,.08);
  --text:           #1A1A2E;
  --text2:          #5A6480;
  --text3:          #9BA3B8;
  --sidebar-bg:     #1A1A2E;
  --sidebar-text:   rgba(224,224,240,.75);
  --sidebar-active: rgba(108,99,255,.18);
  --navbar-bg:      rgba(255,255,255,.92);
  --shadow:         0 2px 16px rgba(0,0,0,.07);
  --shadow-md:      0 6px 28px rgba(0,0,0,.10);
  --shadow-lg:      0 16px 56px rgba(0,0,0,.14);
  --input-bg:       #F5F7FC;
  --input-border:   #DDE3EF;
  --input-focus:    rgba(108,99,255,.3);
  --radius:         14px;
  --radius-sm:      8px;
  --radius-xl:      22px;
  --trans:          .25s ease;
}

[data-theme="dark"] {
  --bg:           #0F0F1A;
  --bg2:          #141425;
  --card:         #1A1A2E;
  --card2:        #1F1F38;
  --border:       rgba(255,255,255,.07);
  --text:         #E8E8F4;
  --text2:        #9090B0;
  --text3:        #6060A0;
  --sidebar-bg:   #0A0A18;
  --sidebar-text: rgba(200,200,230,.65);
  --navbar-bg:    rgba(15,15,26,.94);
  --shadow:       0 2px 16px rgba(0,0,0,.35);
  --shadow-md:    0 6px 28px rgba(0,0,0,.45);
  --shadow-lg:    0 16px 56px rgba(0,0,0,.6);
  --input-bg:     #22224A;
  --input-border: #35356A;
  --input-focus:  rgba(108,99,255,.4);
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--trans), color var(--trans);
  direction: rtl;
}
a { color: var(--primary); text-decoration: none; transition: color var(--trans); }
a:hover { color: var(--primary-light); }
img { max-width: 100%; }
::selection { background: var(--primary); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.3; color: var(--text); }
h1 { font-size: clamp(24px, 4vw, 36px); }
h2 { font-size: clamp(20px, 3vw, 28px); }
h3 { font-size: 20px; }
h4 { font-size: 17px; }
p  { color: var(--text2); }

/* === LAYOUT — AUTH PAGES === */
.auth-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: stretch;
}

.auth-left {
  flex: 1;
  background: linear-gradient(155deg, #6C63FF 0%, #3ECFCF 50%, #FF6584 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  position: relative;
  overflow: hidden;
}
.auth-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}
.auth-left-content { position: relative; z-index: 1; text-align: center; color: #fff; }
.auth-brand-icon { font-size: 80px; display: block; margin-bottom: 20px; filter: drop-shadow(0 8px 20px rgba(0,0,0,.3)); }
.auth-brand-name { font-size: 32px; font-weight: 800; margin-bottom: 8px; text-shadow: 0 2px 12px rgba(0,0,0,.2); }
.auth-brand-sub  { font-size: 16px; opacity: .85; max-width: 300px; margin: 0 auto; line-height: 1.7; }
.auth-features   { margin-top: 40px; text-align: start; }
.auth-feature    { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.auth-feature-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.auth-feature-text h4 { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.auth-feature-text p  { font-size: 12px; opacity: .75; }

.auth-right {
  width: 480px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 48px;
  background: var(--card);
  overflow-y: auto;
}
.auth-right-inner { width: 100%; max-width: 380px; }

/* === AUTH CARD HEADER === */
.auth-header { margin-bottom: 36px; }
.auth-header h2 { font-size: 26px; color: var(--text); margin-bottom: 6px; }
.auth-header p  { color: var(--text2); font-size: 14px; }

/* === FORM ELEMENTS === */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 7px;
  letter-spacing: .3px;
}
.form-label span.req { color: var(--danger); margin-right: 3px; }

/* Flatpickr — تقويم dd/MM/yyyy */
input[type="date"] { direction: ltr; text-align: left; }
.flatpickr-calendar { font-family: inherit; direction: ltr; z-index: 99999 !important; }
.flatpickr-input[type="text"] { direction: ltr; text-align: left; }

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  direction: ltr;
  transition: all var(--trans);
  outline: none;
}
.form-control.rtl-input { direction: rtl; }
.form-control:focus {
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 4px var(--input-focus);
}
.form-control::placeholder { color: var(--text3); font-size: 14px; }
.form-control.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
.checkbox-custom.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
.form-error { color: var(--danger); font-size: 12px; margin-top: 5px; }

/* Phone Input Group */
.phone-group {
  display: flex;
  gap: 10px;
}
.country-selector {
  position: relative;
  flex-shrink: 0;
}
.country-btn {
  height: 100%;
  min-width: 120px;
  padding: 12px 12px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all var(--trans);
  direction: ltr;
  white-space: nowrap;
}
.country-btn:hover, .country-btn.open {
  border-color: var(--primary);
  background: var(--card);
}
.country-btn .flag { font-size: 18px; }
.country-btn .code { font-weight: 700; color: var(--primary); }
.country-btn .arrow { margin-right: auto; opacity: .5; font-size: 10px; transition: transform var(--trans); }
.country-btn.open .arrow { transform: rotate(180deg); }

.country-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 320px;
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.country-dropdown.open { display: flex; }
.country-search {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.country-search input {
  width: 100%;
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  direction: rtl;
}
.country-list {
  overflow-y: auto;
  flex: 1;
}
.country-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--trans);
  direction: ltr;
}
.country-item:hover, .country-item.selected { background: var(--primary-glow); }
.country-item .flag { font-size: 20px; }
.country-item .name { flex: 1; font-size: 13px; color: var(--text); text-align: right; }
.country-item .dial { font-size: 12px; font-weight: 700; color: var(--primary); }
.phone-input-wrap { flex: 1; }

/* Password Input */
.password-wrap { position: relative; }
.password-wrap .form-control { padding-left: 44px; }
.password-toggle {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  font-size: 16px;
  padding: 2px;
  transition: color var(--trans);
}
.password-toggle:hover { color: var(--primary); }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--trans);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 15px rgba(108,99,255,.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(108,99,255,.5);
  color: #fff;
}
.btn-primary:active { transform: translateY(0); }
.btn-block { width: 100%; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text2);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm  { padding: 7px 14px; font-size: 13px; }
.btn-lg  { padding: 15px 32px; font-size: 17px; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: var(--radius-sm); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === THEME TOGGLE === */
.theme-toggle {
  width: 44px; height: 24px;
  background: var(--input-border);
  border-radius: 12px;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background var(--trans);
  flex-shrink: 0;
}
.theme-toggle::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px; right: 3px;
  transition: transform var(--trans);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
[data-theme="dark"] .theme-toggle { background: var(--primary); }
[data-theme="dark"] .theme-toggle::after { transform: translateX(-20px); }
.theme-toggle-wrap { display: flex; align-items: center; gap: 8px; }
.theme-icon { font-size: 16px; }

/* === ALERTS === */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}
.alert-success { background: rgba(0,200,150,.1); border: 1px solid rgba(0,200,150,.25); color: #00C896; }
.alert-danger   { background: rgba(255,82,82,.1);  border: 1px solid rgba(255,82,82,.25);  color: #FF5252; }
.alert-warning  { background: rgba(255,183,77,.1); border: 1px solid rgba(255,183,77,.25); color: #FFB74D; }
.alert-info     { background: rgba(62,207,207,.1); border: 1px solid rgba(62,207,207,.25); color: #3ECFCF; }
.alert-icon { font-size: 16px; flex-shrink: 0; }
.alert-close { margin-right: auto; background: none; border: none; cursor: pointer; color: inherit; opacity: .7; font-size: 18px; line-height: 1; padding: 0; }
.alert-close:hover { opacity: 1; }

/* === DIVIDER === */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--text3);
  font-size: 13px;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* === AUTH LINKS === */
.auth-link-row { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text2); }
.auth-link-row a { color: var(--primary); font-weight: 600; }
.auth-link-row a:hover { text-decoration: underline; }

/* === CHECKBOX === */
.checkbox-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.checkbox-wrap input[type="checkbox"] { display: none; }
.checkbox-custom {
  width: 18px; height: 18px;
  border: 1.5px solid var(--input-border);
  border-radius: 5px;
  background: var(--input-bg);
  flex-shrink: 0;
  position: relative;
  transition: all var(--trans);
}
.checkbox-wrap input:checked + .checkbox-custom {
  background: var(--primary);
  border-color: var(--primary);
}
.checkbox-wrap input:checked + .checkbox-custom::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
}
.checkbox-label { font-size: 13px; color: var(--text2); }

/* === DASHBOARD LAYOUT === */
.app-layout { display: flex; min-height: 100vh; }

/* ── برجر منو عالمي: الشريط الجانبي مخفي دائماً ويظهر عند الضغط فقط ── */
.sidebar { transform: translateX(100%) !important; }
.sidebar.open { transform: translateX(0) !important; }
.main-content { margin-right: 0 !important; }
.topbar-menu-btn { display: flex !important; }

/* Sidebar */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; right: 0;
  z-index: 200;
  transition: transform var(--trans);
}
.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; }
.sidebar-logo {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(108,99,255,.4);
}
.sidebar-name { font-size: 15px; font-weight: 700; color: #fff; }
.sidebar-sub  { font-size: 11px; color: rgba(255,255,255,.4); }

.sidebar-nav  { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.25);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 12px 10px 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--trans);
  margin-bottom: 3px;
  text-decoration: none;
  position: relative;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active {
  background: var(--sidebar-active);
  color: var(--primary-light);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  right: 0; top: 25%; height: 50%;
  width: 3px;
  background: var(--primary);
  border-radius: 2px 0 0 2px;
}
.nav-icon { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-right: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background var(--trans);
  cursor: pointer;
  text-decoration: none;
}
.sidebar-user:hover { background: rgba(255,255,255,.07); }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,.4); }

/* Main content */
.main-content {
  margin-right: 0;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--trans);
}

/* Topbar */
.topbar {
  height: 64px;
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}
.topbar-menu-btn {
  display: none;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
  padding: 6px 10px;
  line-height: 1;
  align-items: center;
  justify-content: center;
  transition: background var(--trans), border-color var(--trans);
}
.topbar-menu-btn:hover {
  background: var(--bg2);
  border-color: var(--primary);
}
.topbar-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}
.topbar-brand-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}
.logo-light-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 4px;
  transition: background .3s;
}
[data-theme="light"] .logo-light-wrap {
  background: #111;
}
.logo-light-wrap--topbar {
  line-height: 0;
}
.topbar-brand-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-glow);
  border-radius: 8px;
  font-size: 18px;
}
.topbar-brand-text {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* تخطيط برجر: بدون شريط جانبي ثابت — القائمة تنزلق عند الضغط */
.app-layout.layout-burger .sidebar {
  transform: translateX(100%);
  box-shadow: var(--shadow-lg);
}
.app-layout.layout-burger .sidebar.open {
  transform: translateX(0);
}
.app-layout.layout-burger .main-content {
  margin-right: 0;
  width: 100%;
}
.app-layout.layout-burger .topbar-menu-btn {
  display: flex;
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--text); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text2);
  font-size: 17px;
  transition: all var(--trans);
  text-decoration: none;
  position: relative;
}
.topbar-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.notif-dot {
  position: absolute;
  top: 5px; left: 8px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--navbar-bg);
}
.topbar-user { display: flex; align-items: center; gap: 9px; cursor: pointer; position: relative; }
.topbar-user-info { text-align: right; }
.topbar-user-name { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.2; }
.topbar-user-role { font-size: 11px; color: var(--text3); }
.user-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
}
.user-dropdown-menu.open { display: block; }

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px 12px;
  background: var(--bg2);
}
.user-dropdown-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.user-dropdown-header-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dropdown-header-role {
  font-size: 11px;
  color: var(--text3);
}

.user-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text2);
  transition: all var(--trans);
}
.user-dropdown-menu a:hover { background: var(--bg2); color: var(--primary); }
.user-dropdown-menu .divider-line { height: 1px; background: var(--border); margin: 4px 0; }
.user-dropdown-menu .logout { color: var(--danger) !important; }

/* Page content */
.page-content { padding: 28px 24px; flex: 1; }
.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 22px; }
.page-header p  { color: var(--text2); font-size: 14px; margin-top: 4px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text3); margin-bottom: 6px; }
.breadcrumb a { color: var(--text3); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { opacity: .5; }

/* === CARDS === */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h3 { font-size: 16px; margin: 0; }
.card-body  { padding: 22px; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--border); background: var(--card2); }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: all var(--trans);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 54px; height: 54px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.stat-icon.purple { background: rgba(108,99,255,.15); }
.stat-icon.teal   { background: rgba(0,200,150,.15); }
.stat-icon.orange { background: rgba(255,183,77,.15); }
.stat-icon.pink   { background: rgba(255,101,132,.15); }
.stat-info { flex: 1; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text2); margin-top: 4px; }
.stat-change { font-size: 12px; margin-top: 4px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* === BADGES === */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success  { background: rgba(0,200,150,.12);  color: var(--success); }
.badge-danger   { background: rgba(255,82,82,.12);  color: var(--danger); }
.badge-warning  { background: rgba(255,183,77,.12); color: var(--warning); }
.badge-info     { background: rgba(62,207,207,.12); color: var(--info); }
.badge-secondary{ background: var(--bg2); color: var(--text2); }
.badge-admin    { background: rgba(108,99,255,.15); color: var(--primary); }
.badge-assistant{ background: rgba(62,207,207,.15); color: var(--info); }
.badge-data     { background: rgba(0,200,150,.15);  color: var(--success); }
.badge-auditor  { background: rgba(255,183,77,.15); color: var(--warning); }
.badge-visitor  { background: var(--bg2);           color: var(--text3); }

/* === TABLES === */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--card2);
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg2); }
.td-actions { display: flex; align-items: center; gap: 6px; }

/* === AVATAR === */
.avatar {
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 14px;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; border-radius: 50%; }
.avatar-md { width: 42px; height: 42px; font-size: 15px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-xl { width: 90px; height: 90px; font-size: 30px; }

/* === MODALS === */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  z-index: 900;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h4 { font-size: 17px; }
.modal-close {
  width: 30px; height: 30px;
  border: none; background: var(--bg2);
  border-radius: 8px; cursor: pointer;
  color: var(--text2); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans);
}
.modal-close:hover { background: var(--danger); color: #fff; }
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* === HOME PAGE (VISITOR) === */
.landing { min-height: 100vh; background: var(--bg); }
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.landing-nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.landing-nav-logo { width: 38px; height: 38px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.landing-nav-name { font-size: 18px; font-weight: 800; color: var(--text); }
.landing-nav-actions { display: flex; align-items: center; gap: 12px; }

.hero {
  padding: 80px 32px 60px;
  max-width: 1100px;
  margin: 0 auto;
  display: flex; align-items: center; gap: 60px;
}
.hero-text { flex: 1; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(108,99,255,.12); border: 1px solid rgba(108,99,255,.25); color: var(--primary); padding: 6px 14px; border-radius: 30px; font-size: 13px; font-weight: 600; margin-bottom: 20px; }
.hero h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.2; margin-bottom: 18px; }
.hero h1 span { background: linear-gradient(135deg, var(--primary), var(--info)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { font-size: 17px; color: var(--text2); margin-bottom: 32px; max-width: 480px; line-height: 1.8; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-image { flex-shrink: 0; width: 420px; }
.hero-card-stack { position: relative; }
.hero-main-card {
  background: linear-gradient(135deg, var(--primary) 0%, #3ECFCF 100%);
  border-radius: 24px;
  padding: 32px;
  color: #fff;
  box-shadow: 0 20px 60px rgba(108,99,255,.35);
}

.features-section { padding: 60px 32px; max-width: 1100px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 48px; }
.section-header h2 { font-size: 32px; margin-bottom: 10px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all var(--trans);
}
.feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.feature-icon { font-size: 36px; margin-bottom: 14px; }
.feature-card h3 { font-size: 17px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; }

.family-mgmt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.family-mgmt-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg2);
  text-decoration: none;
  color: inherit;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.family-mgmt-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.family-mgmt-icon { font-size: 32px; }
.family-mgmt-title { font-size: 17px; font-weight: 700; color: var(--text); }
.family-mgmt-desc { font-size: 12px; color: var(--text3); line-height: 1.5; }
.family-mgmt-count {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}
.family-mgmt-fathers:hover { border-color: #6C63FF; }
.family-mgmt-wives:hover { border-color: #FF6584; }
.family-mgmt-children:hover { border-color: #00C896; }
.family-mgmt-occasions:hover { border-color: #FFB74D; }

.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.btn-edit-sm {
  background: rgba(108, 99, 255, .12);
  color: var(--primary);
  border: 1px solid rgba(108, 99, 255, .25);
}
.btn-edit-sm:hover { background: var(--primary); color: #fff; }

/* ── بطاقات الآباء للزوار ── */
.fathers-showcase {
  background: linear-gradient(145deg, #0f0f1a 0%, #1a1a2e 55%, #2a2850 100%);
  border-radius: var(--radius);
  padding: 28px 26px;
  margin-bottom: 24px;
  border: 1px solid rgba(108, 99, 255, .25);
  box-shadow: var(--shadow-md);
}
.fathers-showcase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}
.fathers-showcase-head h2 {
  color: #fff;
  font-size: 20px;
  margin: 0;
}
.fathers-showcase-head p {
  color: rgba(255, 255, 255, .65);
  font-size: 13px;
  margin: 6px 0 0;
}
.fathers-showcase .btn-outline {
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
}
.fathers-showcase .btn-outline:hover {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}
.fathers-showcase .father-public-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 220px));
  justify-content: center;
  justify-items: center;
}
/* ── بحث الآباء (شريط بحث) ── */
.fathers-search-wrap {
  max-width: 720px;
  margin: 0 auto 28px;
}
.fathers-search-form {
  margin: 0;
}
.fathers-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 8px 6px 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06), 0 8px 24px rgba(108, 99, 255, .08);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.fathers-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(108, 99, 255, .18);
}
.fathers-search-icon {
  font-size: 20px;
  line-height: 1;
  opacity: .55;
  flex-shrink: 0;
}
.fathers-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 17px;
  font-family: inherit;
  color: var(--text);
  padding: 12px 4px;
  outline: none;
}
.fathers-search-input::placeholder {
  color: var(--text3);
}
.fathers-search-clear {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--bg2);
  color: var(--text2);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s;
}
.fathers-search-clear:hover {
  background: var(--border);
  color: var(--text);
}
.fathers-search-hint {
  text-align: center;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text3);
}
.fathers-search-empty {
  margin-top: 8px;
}

.father-public-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.father-public-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  box-shadow: var(--shadow);
}
.father-public-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.father-public-card-img-wrap {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg2);
  overflow: hidden;
}
.father-public-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.father-public-card-status {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  backdrop-filter: blur(6px);
}
.father-public-card-status.alive {
  background: rgba(0, 200, 150, .85);
  color: #fff;
}
.father-public-card-status.deceased {
  background: var(--danger);
  color: #fff;
}
.father-public-card-body { padding: 16px; }
.father-public-card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.father-public-card-name {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
  color: var(--text);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}
.father-public-card-status-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}
.father-public-card-status-badge.alive {
  background: rgba(76, 175, 80, .2);
  color: #2e7d32;
  border: 1px solid rgba(76, 175, 80, .45);
}
.father-public-card .father-public-card-status-badge.deceased {
  background: #e53935 !important;
  color: #fff !important;
  border: 1px solid #c62828 !important;
}
.father-public-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 10px;
}
.father-public-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}
/* ── بطاقة الأب الرئيسية ── */
.father-detail-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 28px;
  background: linear-gradient(135deg, var(--primary) 0%, #3a3580 100%);
  border-radius: var(--radius);
  padding: 32px 32px 32px 32px;
  color: #fff;
  margin-bottom: 24px;
  overflow: hidden;
}
.father-detail-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 260px; height: 260px;
  background: rgba(255,255,255,.07);
  border-radius: 50%;
  pointer-events: none;
}
.father-detail-hero::after {
  content: '';
  position: absolute;
  bottom: -80px; left: 40%;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
  pointer-events: none;
}
.father-detail-hero-media {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 1;
}
.father-detail-hero-photo,
.father-detail-hero-media img {
  display: block;
  width: 160px;
  height: 200px;
  border-radius: 14px;
  object-fit: cover;
  border: 5px solid rgba(255, 255, 255, .35);
  box-shadow: 0 8px 32px rgba(0,0,0,.3), 0 0 0 3px rgba(255,255,255,.1);
  cursor: zoom-in;
  transition: transform .2s, box-shadow .2s;
}
.father-detail-hero-photo:hover,
.father-detail-hero-media img:hover {
  transform: scale(1.04);
  box-shadow: 0 12px 40px rgba(0,0,0,.4), 0 0 0 4px rgba(255,255,255,.2);
}
.father-detail-views {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, .85);
  background: rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 4px 12px;
  white-space: nowrap;
}
.btn-print-family {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}
.btn-print-family:hover {
  background: rgba(255, 255, 255, .25);
}
.family-print-doc-header.print-only {
  display: none;
}
.print-table-continue,
.family-print-continuation.print-only {
  display: none;
}
.family-print-tables {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 24px;
}
.family-print-tables .card-wives {
  margin-bottom: 0;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.family-print-tables .card-children {
  margin-bottom: 0;
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}
.family-print-tables .card-children .card-header {
  border-top: 1px solid var(--border);
}
.family-print-tables .data-table thead th,
.family-print-tables .data-table tbody td {
  font-size: 16px;
}
.family-print-tables .data-table .badge {
  font-size: 14px;
}

/* جدول الأبناء — أعمدة ضيقة، ملاحظة تأخذ باقي العرض */
.card-children .children-data-table {
  table-layout: fixed;
  width: 100%;
}
.card-children .children-data-table col.col-num { width: 36px; }
.card-children .children-data-table col.col-gender { width: 48px; }
.card-children .children-data-table col.col-birth { width: 108px; }
.card-children .children-data-table col.col-death { width: 108px; }
.card-children .children-data-table col.col-name { width: 8%; }
.card-children .children-data-table col.col-mother { width: 7%; }
/* col-notes بدون عرض ثابت = يمتد لملء الجدول */
.card-children .children-data-table .col-num {
  text-align: center;
}
.card-children .children-data-table .col-gender {
  text-align: center;
  white-space: nowrap;
}
.card-children .children-data-table .col-birth,
.card-children .children-data-table .col-death {
  white-space: nowrap;
  text-align: center;
  padding-left: 6px;
  padding-right: 6px;
}
.card-children .children-data-table .col-notes {
  width: auto !important;
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.father-detail-hero-name-wrap {
  width: 100%;
}
.father-detail-hero-body {
  flex: 1;
  min-width: 0;
  z-index: 1;
}
/* موبايل: عمودي */
@media (max-width: 600px) {
  .father-detail-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 28px 20px;
    gap: 20px;
  }
  .father-detail-hero-media {
    width: 100%;
  }
  .father-detail-hero-photo,
  .father-detail-hero-media img {
    width: 130px;
    height: 165px;
    margin: 0 auto;
  }
  .father-detail-info-grid {
    justify-items: center;
  }
}
.father-detail-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 24px;
  margin-bottom: 10px;
  line-height: 1.35;
}
.father-detail-name {
  font-weight: 800;
  text-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.father-detail-title .father-detail-status {
  font-size: 14px;
  padding: 5px 12px;
  flex-shrink: 0;
}
.father-detail-title .father-detail-status--alive,
.father-mobile-status .father-detail-status--alive {
  background: #2e7d32;
  color: #fff;
  border: 1px solid #43a047;
}
.father-detail-title .father-detail-status--deceased,
.father-mobile-status .father-detail-status--deceased {
  background: #c62828;
  color: #fff;
  border: 1px solid #e53935;
  font-weight: 700;
}
.father-detail-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.father-detail-info-item {
  background: rgba(255, 255, 255, .1);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.father-detail-info-item .label { font-size: 11px; opacity: .75; }
.father-detail-info-item .val { font-size: 15px; font-weight: 700; margin-top: 4px; }

.cta-section {
  background: linear-gradient(135deg, var(--primary) 0%, #3ECFCF 100%);
  padding: 60px 32px;
  text-align: center;
  color: #fff;
}
.cta-section h2 { color: #fff; font-size: 32px; margin-bottom: 12px; }
.cta-section p  { color: rgba(255,255,255,.8); font-size: 16px; margin-bottom: 28px; }
.btn-white { background: #fff; color: var(--primary); font-weight: 700; }
.btn-white:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.2); color: var(--primary-dark); }

footer.landing-footer {
  background: var(--sidebar-bg);
  color: rgba(255,255,255,.5);
  text-align: center;
  padding: 24px 32px;
  font-size: 13px;
}

/* === PROFILE PAGE === */
.profile-header-card {
  background: linear-gradient(135deg, var(--primary) 0%, #3ECFCF 80%);
  border-radius: var(--radius);
  padding: 32px;
  color: #fff;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.profile-header-card::before {
  content: '';
  position: absolute;
  top: -40px; left: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}
.profile-header-inner { display: flex; align-items: center; gap: 24px; position: relative; }
.profile-header-card .avatar { border: 4px solid rgba(255,255,255,.3); }
.profile-name { font-size: 24px; font-weight: 800; color: #fff; }
.profile-role { font-size: 13px; opacity: .8; margin-top: 4px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.profile-meta-item { display: flex; align-items: center; gap: 7px; font-size: 13px; opacity: .9; }

/* === ACTIVITY PAGE === */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  border: 2px solid rgba(108,99,255,.2);
}
.activity-text { flex: 1; }
.activity-action { font-size: 14px; font-weight: 600; color: var(--text); }
.activity-desc   { font-size: 13px; color: var(--text2); margin-top: 2px; }
.activity-time   { font-size: 12px; color: var(--text3); white-space: nowrap; }

/* === SITE MANAGEMENT === */
.user-row { display: flex; align-items: center; gap: 12px; }

/* === SEARCH & FILTERS === */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.search-input-wrap { position: relative; flex: 1; min-width: 200px; }
.search-input-wrap .search-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text3); }
.search-input-wrap .form-control { padding-right: 38px; direction: rtl; }
.select-filter { padding: 10px 14px; background: var(--input-bg); border: 1.5px solid var(--input-border); border-radius: var(--radius-sm); color: var(--text); font-family: inherit; font-size: 14px; outline: none; cursor: pointer; transition: border-color var(--trans); }
.select-filter:focus { border-color: var(--primary); }

/* === PAGINATION === */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.page-btn:hover  { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state-icon { font-size: 56px; margin-bottom: 16px; opacity: .5; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text2); }
.empty-state p  { font-size: 14px; color: var(--text3); }

/* === FORGOT PASSWORD === */
.forgot-steps { display: flex; gap: 8px; margin-bottom: 28px; }
.step-item { flex: 1; text-align: center; }
.step-circle { width: 32px; height: 32px; border-radius: 50%; background: var(--input-bg); border: 2px solid var(--input-border); color: var(--text3); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; transition: all var(--trans); }
.step-item.active .step-circle { background: var(--primary); border-color: var(--primary); color: #fff; }
.step-item.done .step-circle { background: var(--success); border-color: var(--success); color: #fff; }
.step-label { font-size: 11px; color: var(--text3); }
.step-item.active .step-label { color: var(--primary); font-weight: 600; }

/* === UPLOAD ZONE === */
.upload-zone {
  border: 2px dashed var(--input-border);
  border-radius: var(--radius-sm);
  padding: 20px;
  cursor: pointer;
  transition: all var(--trans);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  background: var(--input-bg);
  overflow: hidden;
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-glow); }

/* === SIDEBAR OVERLAY (mobile) === */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 199; }

/* === ANIMATIONS === */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.slide-in { animation: slideIn .3s ease; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === UTILITIES === */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text3); }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-10 { gap: 10px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.p-20 { padding: 20px; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .auth-left { display: none; }
  .auth-right { width: 100%; padding: 32px 24px; }
  .hero { flex-direction: column; gap: 40px; text-align: center; padding: 50px 20px; }
  .hero-image { width: 100%; max-width: 380px; margin: 0 auto; }
  .hero p { margin: 0 auto 28px; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content {
    margin-right: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .topbar-menu-btn { display: flex; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { gap: 8px; }
  .landing-nav { padding: 14px 20px; }
  .features-section { padding: 40px 20px; }
  .hero { padding: 40px 20px 30px; }

  /* Cards */
  .card-header { padding: 14px 16px; }
  .card-body   { padding: 16px; }

  /* Auth header */
  .auth-header h2 { font-size: 22px; }

  /* Profile */
  .profile-header-card { padding: 20px; }
  .profile-header-inner { flex-direction: column; text-align: center; gap: 16px; }
  .profile-meta { justify-content: center; }

  /* Stat cards */
  .stat-card { padding: 16px 14px; gap: 12px; }
  .stat-icon { width: 46px; height: 46px; font-size: 20px; }
  .stat-value { font-size: 24px; }

  /* Page header */
  .page-header { margin-bottom: 18px; }
  .page-header h2 { font-size: 18px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content {
    padding: 14px 14px;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
  }
  .auth-right { padding: 22px 16px; }
  .auth-right-inner { max-width: 100%; }
  .auth-header { margin-bottom: 24px; }
  .auth-header h2 { font-size: 20px; }
  .auth-header p  { font-size: 13px; }
  .page-content { padding: 16px 12px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-title { font-size: 15px; }

  /* Phone group stays horizontal on mobile */
  .phone-group { flex-direction: row; gap: 6px; align-items: stretch; }
  .country-selector { flex-shrink: 0; }
  .country-btn { min-width: unset; width: auto; height: 48px; padding: 0 8px; gap: 4px; }
  .country-btn .flag { font-size: 15px; }
  .country-btn .code { font-size: 12px; }
  .country-btn .arrow { font-size: 9px; }
  .country-dropdown { width: 280px; right: auto; left: 0; }
  .phone-input-wrap { flex: 1; min-width: 0; }

  /* Larger tap targets */
  .btn-lg { font-size: 16px; padding: 14px 20px; }
  .form-group { margin-bottom: 16px; }

  /* Stat cards single info */
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 12px; }

  /* Profile two columns → one on small screens */
  .profile-grid-2col { grid-template-columns: 1fr !important; }

  /* Tables: shrink font size */
  tbody td { padding: 10px 10px; font-size: 13px; }
  thead th  { padding: 10px 10px; font-size: 11px; }

  /* Smaller summary chips */
  .landing-nav-name { font-size: 15px; }
}

/* ══════════════════════════════════════════════════
   نظام الإعلانات — Ads System Responsive Layout
   ══════════════════════════════════════════════════ */

/* تخطيط الشبكة: عمودان (نموذج + شريط جانبي) */
.ads-layout-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}
.ads-view-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}

/* ── رأس صفحة الإعلانات ── */
.ads-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}
.ads-page-header h2 { margin: 0; font-size: 22px; }
.ads-page-header .ads-page-header-sub { margin: 4px 0 0; color: var(--text3); font-size: 13px; }

/* ── شريط الفلترة + البحث ── */
.ads-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.ads-search-form {
  display: flex;
  gap: 8px;
  flex: 1;
  max-width: 360px;
}
.ads-search-form input { flex: 1; min-width: 0; }

/* ── إخفاء أعمدة الجدول على الشاشات الصغيرة ── */
.col-hide-sm  { }
.col-hide-xs  { }

/* ══ Breakpoints ══ */
@media (max-width: 960px) {
  .ads-layout-grid {
    grid-template-columns: 1fr;
  }
  .ads-view-grid {
    grid-template-columns: 1fr;
  }
  /* الشريط الجانبي يصعد فوق النموذج في التعديل/العرض */
  .ads-sidebar-top { order: -1; }
}

@media (max-width: 768px) {
  /* رأس الصفحة */
  .ads-page-header { flex-direction: column; align-items: flex-start; }
  .ads-page-header .btn { width: 100%; justify-content: center; }

  /* شريط البحث والفلترة */
  .ads-toolbar { flex-direction: column; align-items: stretch; }
  .filter-tabs { width: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .filter-tab  { flex-shrink: 0; }
  .ads-search-form { max-width: 100%; }

  /* إخفاء أعمدة الجدول */
  .col-hide-sm { display: none !important; }

  /* Social row */
  .social-row-top    { grid-template-columns: 1fr 1fr !important; }
  .social-row-bottom { grid-template-columns: 1fr 1fr 80px 40px !important; }

  /* إعلان hero */
  .ad-hero { min-height: 200px; }
  .ad-hero-img { max-height: 260px; }
}

@media (max-width: 540px) {
  /* إخفاء المزيد من الأعمدة */
  .col-hide-xs { display: none !important; }

  /* Social row عمود واحد */
  .social-row-top    { grid-template-columns: 1fr !important; }
  .social-row-bottom { grid-template-columns: 1fr 1fr !important; }

  /* أزرار الإجراءات في الجدول */
  .td-actions { flex-wrap: wrap; gap: 4px; }
  .td-actions .btn-sm { padding: 5px 8px; font-size: 12px; }

  /* معرض الصور */
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important; }
  .video-grid   { grid-template-columns: 1fr !important; }

  /* بطاقات التواصل */
  .social-links-row { gap: 8px; }
  .social-link-btn  { padding: 8px 12px; font-size: 13px; }

  /* جدول الإعلانات: صورة أصغر */
  .ad-cover           { width: 40px !important; height: 40px !important; }
  .ad-cover-placeholder { width: 40px !important; height: 40px !important; font-size: 18px !important; }

  /* فلاتر أصغر */
  .filter-tab { padding: 6px 10px; font-size: 11px; }
}

@media (max-width: 400px) {
  .ads-page-header h2 { font-size: 18px; }
  .social-link-btn { padding: 7px 10px; font-size: 12px; gap: 6px; }
  .social-link-btn i { font-size: 16px !important; }
}

/* ── طباعة بيانات العائلة (A3 أفقي — أبيض وأسود) ── */
@media print {
  @page {
    size: A3 landscape;
    margin: 12mm;
  }

  html, body {
    width: 100%;
    height: auto;
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: economy !important;
    print-color-adjust: economy !important;
  }

  .no-print,
  .sidebar,
  .sidebar-overlay,
  .topbar,
  .flash-msg,
  .page-header {
    display: none !important;
  }

  .app-layout,
  .main-content,
  .page-content,
  .family-print-area {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .family-print-doc-header.print-only {
    display: block !important;
    text-align: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #000;
  }
  .family-print-doc-header h2 {
    font-size: 22px;
    color: #000 !important;
    margin-bottom: 4px;
  }
  .family-print-doc-header p {
    font-size: 13px;
    color: #333 !important;
    margin: 0;
  }

  .father-detail-hero {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 20px !important;
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000;
    padding: 16px !important;
    margin-bottom: 16px !important;
    page-break-inside: avoid;
  }
  .father-detail-hero::before,
  .father-detail-hero::after { display: none !important; }
  .father-detail-hero-media {
    position: static !important;
    flex-shrink: 0 !important;
    width: 110px !important;
    filter: none !important;
    -webkit-filter: none !important;
  }
  .father-detail-hero-photo,
  .father-detail-hero-media img {
    width: 110px !important;
    height: 140px !important;
    border-radius: 10px !important;
    border: 2px solid #000 !important;
    box-shadow: none !important;
    filter: none !important;
    -webkit-filter: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .father-detail-title {
    color: #000 !important;
    font-size: 22px !important;
  }
  .father-detail-title .father-detail-status--alive,
  .father-detail-title .father-detail-status--deceased {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000 !important;
  }
  .father-detail-info-item {
    background: #f5f5f5 !important;
    border: 1px solid #000;
  }
  .father-detail-info-item .label,
  .father-detail-info-item .val {
    color: #000 !important;
    opacity: 1 !important;
  }

  .family-print-tables {
    margin-bottom: 0 !important;
    page-break-inside: auto;
  }
  .family-print-tables .card-wives {
    margin-bottom: 0 !important;
    border-bottom: none !important;
    page-break-after: avoid;
    break-after: avoid-page;
    page-break-inside: auto;
  }
  .family-print-tables .card-children {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    page-break-before: avoid;
    break-before: avoid-page;
    page-break-inside: auto;
  }
  .family-print-tables .card-children .card-header {
    border-top: 1px solid #000 !important;
  }

  .card {
    border: 1px solid #000 !important;
    box-shadow: none !important;
    background: #fff !important;
    margin-bottom: 14px !important;
    page-break-inside: auto;
  }
  .card-header {
    background: #eee !important;
    border-bottom: 1px solid #000 !important;
    color: #000 !important;
    page-break-after: avoid;
  }
  .card-header h3 {
    color: #000 !important;
    font-size: 16px !important;
  }

  .family-print-continuation.print-only:not(.print-skip-continuation) {
    display: block !important;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    padding: 10px 8px;
    border-top: 1px dashed #000;
    border-bottom: 1px dashed #000;
    background: #fff !important;
    color: #000 !important;
    page-break-after: avoid;
  }

  .print-table-continue:not(.print-skip-continuation) {
    display: table-row !important;
  }
  .print-table-continue th {
    text-align: center !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
    padding: 8px 10px !important;
  }
  .data-table thead {
    display: table-header-group;
  }

  .data-table {
    width: 100% !important;
    border-collapse: collapse !important;
  }
  .family-print-tables .data-table thead th {
    background: #ddd !important;
    color: #000 !important;
    border: 1px solid #000 !important;
    font-size: 16px !important;
  }
  .family-print-tables .data-table tbody td {
    color: #000 !important;
    border: 1px solid #000 !important;
    font-size: 16px !important;
    background: #fff !important;
  }
  .data-table .badge {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
  }

  a[href]:after {
    content: none !important;
  }
}
