/* ==========================================
   Fiche Familiale DZ - Premium Design System V3.0
   HIGH-END • GOVERNMENT PORTAL GRADE • RESPONSIVE
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Cairo:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700;800&display=swap');

/* ==========================================
   1. DESIGN TOKENS & CSS VARIABLES
   ========================================== */
:root {
  /* Algerian national colors */
  --dz-green: #006233;
  --dz-green-dark: #004122;
  --dz-green-deep: #002814;
  --dz-green-light: #e8f5e9;
  --dz-green-50: #f0fdf4;
  --dz-red: #d21034;
  --dz-gold: #c5a059;
  --dz-gold-light: #f7f1e3;

  /* Neutral palette */
  --bg-body: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f8fafc;
  --bg-muted: #f1f5f9;
  --border-light: rgba(0,0,0,0.06);
  --border-medium: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* Gradients */
  --gradient-green: linear-gradient(135deg, #004122 0%, #006233 50%, #00823f 100%);
  --gradient-green-hover: linear-gradient(135deg, #003019 0%, #004d28 50%, #006233 100%);
  --gradient-hero: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 30%, #d1fae5 100%);
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.7));
  --gradient-tricolor: linear-gradient(90deg, var(--dz-green) 0%, var(--dz-gold) 50%, var(--dz-red) 100%);

  /* Shadows — Refined depth system */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 12px -2px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 28px -4px rgba(0,0,0,0.08), 0 4px 8px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 24px 48px -12px rgba(0,0,0,0.12);
  --shadow-green: 0 8px 24px -4px rgba(0, 98, 51, 0.25);
  --shadow-green-sm: 0 4px 12px -2px rgba(0, 98, 51, 0.15);
  --shadow-green-glow: 0 0 20px rgba(0, 98, 51, 0.2);

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

  /* Transition */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --duration-fast: 200ms;
  --duration-normal: 350ms;
  --duration-slow: 500ms;
}

/* ==========================================
   2. BASE / RESET
   ========================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', 'Inter', -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[dir="rtl"] body {
  font-family: 'Cairo', 'Amiri', serif;
}

::selection {
  background: var(--dz-green);
  color: #fff;
}

/* Custom scrollbar global */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ==========================================
   3. PAGE LOADING OVERLAY — PREMIUM
   ========================================== */
.page-loader {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 99999;
  transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}
.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-content {
  text-align: center;
}
.loader-spinner {
  width: 52px;
  height: 52px;
  border: 4px solid var(--dz-green-light);
  border-top-color: var(--dz-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader-text {
  margin-top: 18px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--dz-green);
  animation: loaderFade 1.5s ease-in-out infinite;
}
@keyframes loaderFade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ==========================================
   4. NAVBAR — STICKY GLASSMORPHISM
   ========================================== */
.navbar-dz {
  background: var(--gradient-green);
  box-shadow: 0 4px 24px rgba(0, 66, 34, 0.35);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 1030;
  transition: all var(--duration-normal) var(--ease-out);
  backdrop-filter: blur(12px);
}
.navbar-dz.scrolled {
  padding: 0.45rem 0;
  box-shadow: 0 2px 16px rgba(0, 66, 34, 0.45);
}

.navbar-brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  transition: transform var(--duration-fast) var(--ease-out);
}
.navbar-brand-wrapper:hover {
  transform: scale(1.02);
  color: #fff;
}

.brand-icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
  animation: floatBrand 3s ease-in-out infinite;
}
@keyframes floatBrand {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.brand-text-group {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.brand-badge {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  padding: 2px 12px;
  border-radius: var(--radius-full);
  font-size: 0.66rem;
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.12);
  width: fit-content;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-link-dz {
  color: rgba(255,255,255,0.85) !important;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 18px !important;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
}
.nav-link-dz::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 18px;
  height: 2px;
  background: var(--dz-gold);
  border-radius: 2px;
  transition: transform 0.3s var(--ease-spring);
}
.nav-link-dz:hover,
.nav-link-dz.active {
  color: #fff !important;
  background: rgba(255,255,255,0.12);
}
.nav-link-dz.active::after {
  transform: translateX(-50%) scaleX(1);
}

.lang-switcher-btn {
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(255,255,255,0.18) !important;
  color: #fff !important;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 7px 18px;
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-out);
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(4px);
}
.lang-switcher-btn:hover {
  background: rgba(255,255,255,0.18) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Mobile hamburger */
.navbar-toggler-dz {
  border: 1px solid rgba(255,255,255,0.25);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  transition: all var(--duration-fast);
}
.navbar-toggler-dz:hover,
.navbar-toggler-dz:focus {
  background: rgba(255,255,255,0.15);
  box-shadow: none;
}

/* ==========================================
   5. HERO SECTION — ANIMATED GRADIENT
   ========================================== */
.hero-section {
  background: var(--gradient-hero);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  padding: 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  animation: heroSlideIn 0.7s var(--ease-out);
}
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 2px 2px, rgba(0, 98, 51, 0.035) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
}
.hero-section::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 98, 51, 0.04) 0%, transparent 70%);
  pointer-events: none;
}
@keyframes heroSlideIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 98, 51, 0.06);
  border: 1px solid rgba(0, 98, 51, 0.12);
  color: var(--dz-green);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 1rem;
  animation: pillPop 0.5s var(--ease-spring) 0.2s both;
}
@keyframes pillPop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.hero-title {
  font-size: 2.1rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 0.75rem;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 600px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 1.5rem;
}

.hero-icon-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.hero-icon-box::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-green);
  transform: scaleX(0);
  transition: transform 0.4s var(--ease-out);
}
.hero-icon-box:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}
.hero-icon-box:hover::before {
  transform: scaleX(1);
}
.hero-icon-box .icon-big {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
}

/* ==========================================
   6. BUTTONS — ULTRA PREMIUM
   ========================================== */
.btn-dz-primary {
  background: var(--gradient-green);
  color: #fff;
  border: none;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-green-sm);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.2px;
}
.btn-dz-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  transition: left 0.6s;
}
.btn-dz-primary:hover {
  background: var(--gradient-green-hover);
  color: #fff;
  transform: translateY(-3px);
  box-shadow: var(--shadow-green), var(--shadow-green-glow);
}
.btn-dz-primary:hover::before { left: 100%; }
.btn-dz-primary:active {
  transform: translateY(0) scale(0.97);
}

.btn-dz-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid #e2e8f0;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.btn-dz-outline::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--dz-green-50);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease-out);
  z-index: -1;
}
.btn-dz-outline:hover {
  border-color: var(--dz-green);
  color: var(--dz-green);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 98, 51, 0.08);
}
.btn-dz-outline:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}

.btn-dz-warning {
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #d97706);
  color: #fff;
  border: none;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
  transition: all var(--duration-fast) var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.btn-dz-warning::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.6s;
}
.btn-dz-warning:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
  color: #fff;
}
.btn-dz-warning:hover::before { left: 100%; }

.btn-dz-danger-outline {
  background: transparent;
  color: #ef4444;
  border: 2px solid #fecaca;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-dz-danger-outline:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
}

/* ==========================================
   7. WIZARD STEPS — PREMIUM CONNECTED BAR
   ========================================== */
.wizard-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 22px 28px;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.wizard-wrapper::-webkit-scrollbar { display: none; }

.wizard-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 620px;
}
.wizard-steps::before {
  content: '';
  position: absolute;
  top: 22px;
  left: 40px;
  right: 40px;
  height: 3px;
  background: #e2e8f0;
  z-index: 1;
  border-radius: 3px;
}

.wizard-progress-bar {
  position: absolute;
  top: 22px;
  left: 40px;
  height: 3px;
  background: var(--gradient-green);
  z-index: 2;
  border-radius: 3px;
  transition: width var(--duration-slow) var(--ease-out);
  box-shadow: 0 0 12px rgba(0, 98, 51, 0.35);
}

.step-item {
  position: relative;
  z-index: 3;
  background: transparent;
  padding: 0 8px;
  text-align: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform var(--duration-fast) var(--ease-out);
}
.step-item:hover { transform: translateY(-3px); }

.step-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 3px solid #cbd5e1;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0 auto 8px;
  transition: all var(--duration-normal) var(--ease-spring);
  position: relative;
  box-shadow: var(--shadow-xs);
}

.step-item.active .step-circle {
  border-color: var(--dz-green);
  background: linear-gradient(135deg, var(--dz-green), var(--dz-green-dark));
  color: #fff;
  box-shadow: 0 0 0 6px rgba(0, 98, 51, 0.1), var(--shadow-green-sm);
  transform: scale(1.12);
}
.step-item.active .step-circle::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 2px solid rgba(0, 98, 51, 0.12);
  animation: ringPulse 2s ease-in-out infinite;
}
@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0; }
}

.step-item.completed .step-circle {
  border-color: var(--dz-green);
  background: var(--dz-green-light);
  color: var(--dz-green);
}

.step-label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--duration-fast);
  white-space: nowrap;
}
.step-item.active .step-label {
  color: var(--dz-green);
  font-weight: 800;
}
.step-item.completed .step-label {
  color: var(--text-secondary);
}

/* ==========================================
   8. FORM CARD — ELEVATED GLASS PANEL
   ========================================== */
.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-out);
}
.form-card:hover {
  box-shadow: var(--shadow-lg);
}
.form-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-tricolor);
}

.section-title {
  position: relative;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dz-green-dark);
  padding-bottom: 12px;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--dz-green-light);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 50px;
  height: 3px;
  background: var(--gradient-green);
  border-radius: 3px;
}
[dir="rtl"] .section-title::after { left: auto; right: 0; }

.section-title i {
  color: var(--dz-green);
  font-size: 1.1rem;
}

/* Step content transitions */
.step-content {
  animation: stepFadeIn 0.5s var(--ease-out);
}
.step-content.d-none { display: none !important; }
@keyframes stepFadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   9. PREMIUM FORM CONTROLS
   ========================================== */
.form-control,
.form-select {
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
  font-size: 0.9rem;
  background: var(--bg-surface);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.form-control:hover,
.form-select:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--dz-green);
  box-shadow: 0 0 0 4px rgba(0, 98, 51, 0.08), 0 2px 4px rgba(0,0,0,0.04);
  outline: none;
  background: #fff;
}
.form-control::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.form-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.form-label i {
  color: var(--dz-green);
  font-size: 0.9rem;
}

/* Input group addons */
.input-group-text {
  background: var(--bg-muted);
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-sm);
  color: var(--dz-green);
  font-weight: 700;
}

/* ==========================================
   10. LIVE PREVIEW PANEL — ELEVATED
   ========================================== */
.preview-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-out);
}
.preview-panel:hover {
  box-shadow: var(--shadow-lg);
}
.preview-header {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid var(--border-light);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.preview-header-title {
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.preview-dot.live {
  background: #22c55e;
  animation: dotPulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}
.preview-body {
  padding: 18px;
  max-height: 78vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,98,51,0.2) transparent;
}
.preview-body::-webkit-scrollbar { width: 5px; }
.preview-body::-webkit-scrollbar-track { background: transparent; }
.preview-body::-webkit-scrollbar-thumb {
  background: rgba(0, 98, 51, 0.2);
  border-radius: 5px;
}
.preview-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 98, 51, 0.4);
}

/* Preview Loading Skeleton */
.preview-skeleton {
  text-align: center;
  padding: 3rem 1rem;
}
.skeleton-card {
  width: 100%;
  height: 300px;
  background: linear-gradient(90deg, var(--bg-muted) 25%, #e2e8f0 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  animation: shimmer 1.5s infinite;
  margin-bottom: 12px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================
   11. OFFICIAL CARD TEMPLATE
   ========================================== */
.official-card-container {
  background: #ffffff;
  border: 4px double var(--dz-green);
  border-radius: 4px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
  position: relative;
  color: #1a252f;
  background-image: radial-gradient(rgba(0, 98, 51, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  animation: cardAppear 0.5s var(--ease-out);
}
@keyframes cardAppear {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.official-header {
  text-align: center;
  border-bottom: 3px double var(--dz-green);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.official-republic {
  font-family: 'Amiri', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dz-green-dark);
  margin-bottom: 4px;
}

.official-sub-republic {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.official-admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
  background: var(--dz-green-light);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0,98,51,0.12);
  font-size: 0.8rem;
  font-weight: 700;
}

.official-title-box {
  background: var(--gradient-green);
  color: #ffffff;
  text-align: center;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 800;
  margin: 12px 0;
  box-shadow: var(--shadow-green-sm);
  letter-spacing: 0.3px;
}

.official-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
  font-size: 0.82rem;
}
.official-table th, .official-table td {
  border: 1px solid #334155;
  padding: 7px 12px;
  vertical-align: middle;
}
.official-table th {
  background-color: var(--bg-muted);
  color: var(--text-primary);
  font-weight: 700;
}

.stamp-box {
  border: 2px dashed var(--border-medium);
  height: 90px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  font-weight: 600;
}

/* ==========================================
   12. CHILDREN TABLE — PREMIUM
   ========================================== */
.children-table-wrapper {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.children-table-wrapper table { margin-bottom: 0; }
.children-table-wrapper thead th {
  background: linear-gradient(135deg, var(--bg-muted), #e9edf2);
  font-size: 0.82rem;
  font-weight: 700;
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
  padding: 12px 10px;
  color: var(--text-secondary);
}
.child-row-item {
  animation: childRowIn 0.35s var(--ease-out);
  transition: background 0.2s;
}
@keyframes childRowIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
.child-row-item:hover {
  background: var(--dz-green-50);
}

.btn-remove-child {
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid #fecaca;
  background: transparent;
  color: #ef4444;
  transition: all var(--duration-fast) var(--ease-out);
}
.btn-remove-child:hover {
  background: #fef2f2;
  border-color: #ef4444;
  transform: scale(1.15) rotate(90deg);
}

/* ==========================================
   13. TOAST NOTIFICATIONS — ANIMATED
   ========================================== */
.toast-dz {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  animation: toastIn 0.5s var(--ease-spring);
}
[dir="rtl"] .toast-dz { right: auto; left: 28px; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(24px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast-dz-inner {
  background: var(--dz-green);
  color: #fff;
  padding: 16px 26px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 400px;
  backdrop-filter: blur(8px);
}
.toast-dz-inner .toast-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

/* ==========================================
   14. INFO/ALERT BANNERS
   ========================================== */
.info-banner {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #93c5fd;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.85rem;
  color: #1e40af;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.info-banner i {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ==========================================
   15. FINAL STEP — DOWNLOAD AREA
   ========================================== */
.download-box {
  background: var(--gradient-hero);
  border: 2px solid rgba(0, 98, 51, 0.1);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.download-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 2px 2px, rgba(0, 98, 51, 0.02) 1px, transparent 0);
  background-size: 20px 20px;
  pointer-events: none;
}
.download-box-icon {
  font-size: 4rem;
  color: var(--dz-green);
  margin-bottom: 16px;
  display: block;
  animation: iconBounce 2.5s var(--ease-spring) infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 98, 51, 0.2));
}
@keyframes iconBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.download-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 1.5rem;
}

/* ==========================================
   16. FOOTER — HIGH CONTRAST & CRYSTAL CLEAR
   ========================================== */
footer, .gov-footer, .footer-dz {
  background: #0f172a !important; /* Solid Dark Slate */
  color: #f8fafc !important;
  padding: 3.5rem 0 1.5rem !important;
  margin-top: 4rem !important;
  border-top: 4px solid #c5a059 !important;
  position: relative;
  z-index: 10;
}

.gov-footer-brand-title, .footer-brand-name {
  font-size: 1.25rem !important;
  font-weight: 800 !important;
  color: #ffffff !important;
}

.gov-footer-desc, .footer-desc {
  font-size: 0.88rem !important;
  line-height: 1.7 !important;
  color: #cbd5e1 !important; /* High contrast silver text */
  max-width: 380px;
}

.gov-footer-badge {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #4ade80 !important;
  border: 1px solid rgba(34, 197, 94, 0.3) !important;
  padding: 6px 16px !important;
  border-radius: 9999px !important;
  font-weight: 700 !important;
  font-size: 0.8rem !important;
  display: inline-flex !important;
  align-items: center !important;
}

.gov-footer-title, .footer-heading {
  color: #c5a059 !important; /* Gold */
  font-weight: 800 !important;
  font-size: 1.05rem !important;
  margin-bottom: 1.2rem !important;
  position: relative;
  padding-bottom: 8px !important;
}
.gov-footer-title::after, .footer-heading::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 40px; height: 3px;
  background: #006233;
  border-radius: 3px;
}
[dir="ltr"] .gov-footer-title::after,
[dir="ltr"] .footer-heading::after { right: auto; left: 0; }

.footer-links {
  list-style: none;
  padding: 0; margin: 0;
}
.footer-links li { margin-bottom: 8px; }
.footer-links a {
  color: #cbd5e1 !important; /* High contrast link */
  text-decoration: none;
  font-size: 0.88rem !important;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.footer-links a:hover {
  color: #c5a059 !important;
  transform: translateX(6px);
}
[dir="rtl"] .footer-links a:hover { transform: translateX(-6px); }

.footer-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.footer-feature-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(0, 98, 51, 0.25) !important;
  color: #4ade80 !important;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}

.footer-feature-text {
  font-size: 0.85rem !important;
  color: #e2e8f0 !important; /* High contrast text */
  font-weight: 600 !important;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1) !important;
  margin-top: 2.5rem !important;
  padding-top: 1.5rem !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copyright, .footer-made-with {
  font-size: 0.82rem !important;
  color: #94a3b8 !important; /* Crisp slate text */
}
.footer-made-with .heart {
  color: var(--dz-red);
  animation: heartbeat 1.2s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ==========================================
   17. ANIMATIONS — UTILITY CLASSES
   ========================================== */
.fade-in {
  animation: fadeIn 0.4s var(--ease-out);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s var(--ease-out);
}
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger animation for children */
.stagger-item { opacity: 0; transform: translateY(12px); transition: all 0.4s var(--ease-out); }
.stagger-item.visible { opacity: 1; transform: translateY(0); }
.stagger-item:nth-child(1) { transition-delay: 0s; }
.stagger-item:nth-child(2) { transition-delay: 0.08s; }
.stagger-item:nth-child(3) { transition-delay: 0.16s; }
.stagger-item:nth-child(4) { transition-delay: 0.24s; }
.stagger-item:nth-child(5) { transition-delay: 0.32s; }
.stagger-item:nth-child(6) { transition-delay: 0.4s; }

/* Ripple effect on buttons */
.ripple { position: relative; overflow: hidden; }
.ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0; left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,0.25) 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.5s, opacity 0.8s;
}
.ripple:active::after {
  transform: scale(0, 0);
  opacity: 0.3;
  transition: 0s;
}

/* Floating label effect */
.form-floating-dz {
  position: relative;
}
.form-floating-dz .form-control {
  padding-top: 1.6rem;
  padding-bottom: 0.5rem;
}
.form-floating-dz label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: all 0.2s var(--ease-out);
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}
.form-floating-dz .form-control:focus ~ label,
.form-floating-dz .form-control:not(:placeholder-shown) ~ label {
  top: 8px;
  transform: translateY(0);
  font-size: 0.7rem;
  color: var(--dz-green);
  font-weight: 700;
}

/* ==========================================
   18. STAT CARDS — PREMIUM GLASSMORPHISM
   ========================================== */
.stat-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.8));
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-card-icon.green {
  background: var(--dz-green-50);
  color: var(--dz-green);
}
.stat-card-icon.gold {
  background: var(--dz-gold-light);
  color: var(--dz-gold);
}
.stat-card-icon.red {
  background: #fef2f2;
  color: var(--dz-red);
}
.stat-card-icon.blue {
  background: #eff6ff;
  color: #2563eb;
}
.stat-card-value {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  color: var(--text-primary);
}
.stat-card-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================
   19. RESPONSIVE — MOBILE FIRST
   ========================================== */
@media (max-width: 991.98px) {
  .hero-section { padding: 1.5rem; }
  .hero-title { font-size: 1.5rem; }
  .hero-subtitle { font-size: 0.88rem; }

  .col-form-main,
  .col-preview-main {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  .preview-panel { margin-top: 1.5rem; }
  .footer-dz { padding: 2.5rem 0 1rem; }
}

@media (max-width: 767.98px) {
  .hero-section {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
  }
  .hero-title { font-size: 1.3rem; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .hero-icon-box { display: none; }

  .wizard-wrapper { padding: 14px 16px; margin-bottom: 1rem; }
  .step-label { font-size: 0.63rem; max-width: 56px; overflow: hidden; text-overflow: ellipsis; }

  .form-card { border-radius: var(--radius-lg); }
  .form-card > div,
  .form-card > form { padding: 1rem !important; }

  .step-nav-buttons { flex-direction: column; gap: 8px; }
  .step-nav-buttons .btn { width: 100%; justify-content: center; }

  .official-card-container { padding: 14px; font-size: 0.8rem; }
  .official-republic { font-size: 1rem; }
  .official-title-box { font-size: 0.95rem; padding: 8px; }
  .official-admin-grid { grid-template-columns: 1fr; gap: 4px; font-size: 0.78rem; }
  .official-table th, .official-table td { padding: 4px 6px; font-size: 0.75rem; }
  .stamp-box { height: 70px; font-size: 0.72rem; }

  .children-table-wrapper { overflow-x: auto; }

  .download-box { padding: 1.25rem; }
  .download-actions { flex-direction: column; }
  .download-actions .btn { width: 100%; justify-content: center; }

  .footer-bottom { flex-direction: column; text-align: center; }

  .toast-dz { bottom: 16px; right: 16px; left: 16px; }
  [dir="rtl"] .toast-dz { right: 16px; left: 16px; }
  .toast-dz-inner { max-width: 100%; }

  .brand-name { font-size: 1rem; }
  .brand-badge { display: none; }

  .stat-card { padding: 1rem; gap: 12px; }
  .stat-card-value { font-size: 1.2rem; }
}

@media (max-width: 575.98px) {
  .hero-title { font-size: 1.15rem; }
  .step-circle { width: 38px; height: 38px; font-size: 0.8rem; }
  .wizard-steps::before { top: 19px; }
  .wizard-progress-bar { top: 19px; }
}

/* ==========================================
   20. PRINT STYLES
   ========================================== */
@media print {
  body { background: #fff !important; }
  .no-print,
  .navbar-dz,
  .hero-section,
  .wizard-wrapper,
  .footer-dz,
  .toast-dz,
  .page-loader,
  .back-to-top,
  .scroll-progress-bar {
    display: none !important;
  }
  .official-card-container {
    box-shadow: none !important;
    border: 3px double #000 !important;
    page-break-after: always;
    margin: 0;
    padding: 20px;
  }
}

/* ==========================================
   21. HORIZONTAL SWIPE PREVIEW TRACK
   ========================================== */
.horizontal-preview-track {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  gap: 16px;
  padding-bottom: 12px;
}
.horizontal-preview-track::-webkit-scrollbar {
  height: 6px;
}
.horizontal-preview-track::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.horizontal-preview-track::-webkit-scrollbar-thumb {
  background: #006233;
  border-radius: 4px;
}
.horizontal-page-slide {
  flex: 0 0 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  scroll-snap-align: start;
  box-sizing: border-box;
}
.slide-nav-btn.active {
  background-color: #ffc107 !important;
  color: #000 !important;
  border-color: #ffc107 !important;
}
