/* =========================================================
   PETITION PLATFORM — Design System
   Ait Aziza Association
   ========================================================= */

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

/* ─── CSS Custom Properties ─── */
:root {
  --font-arabic: 'Cairo', 'Inter', sans-serif;
  /* Colors — Light */
  --color-primary: #059669;
  --color-primary-light: #34d399;
  --color-primary-dark: #047857;
  --color-primary-50: #ecfdf5;
  --color-primary-100: #d1fae5;
  --color-primary-200: #a7f3d0;
  --color-primary-500: #10b981;
  --color-primary-900: #064e3b;

  --color-accent: #f59e0b;
  --color-accent-light: #fbbf24;
  --color-accent-dark: #d97706;

  --color-danger: #ef4444;
  --color-danger-light: #fca5a5;
  --color-warning: #f59e0b;
  --color-success: #10b981;
  --color-info: #3b82f6;

  /* Surfaces */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-dark: #0f172a;
  --bg-dark-secondary: #1e293b;
  --bg-dark-tertiary: #334155;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #f8fafc;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --glass-blur: blur(20px);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 40px rgba(5, 150, 105, 0.15);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-tooltip: 600;

  /* Container */
  --container-max: 1200px;
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
}

/* ─── Dark Mode ─── */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(51, 65, 85, 0.5);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(5, 150, 105, 0.25);
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-base), color var(--transition-base);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--color-primary-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ─── Utilities ─── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ─── Typography ─── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

.text-gradient {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 50%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.btn:hover::after { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(5, 150, 105, 0.5);
}

.btn-secondary {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-danger), #dc2626);
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.5);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  padding: 0.5rem 1rem;
}
.btn-ghost:hover {
  background: var(--bg-tertiary);
}

.btn-google {
  background: white;
  color: #444;
  border: 1px solid #ddd;
  box-shadow: var(--shadow-md);
  font-weight: 500;
  padding: 0.75rem 2rem;
}
.btn-google:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.btn-google svg {
  width: 20px;
  height: 20px;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: var(--radius-full);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ─── Navigation ─── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  transition: all var(--transition-base);
}

.navbar.scrolled {
  box-shadow: var(--shadow-md);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  padding: 0 var(--space-lg);
  max-width: var(--container-max);
  margin: 0 auto;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-xl);
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-brand .brand-icon {
  width: 2rem;
  height: 2rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  list-style: none;
}

.navbar-nav a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--color-primary);
  background: var(--color-primary-50);
}

[data-theme="dark"] .navbar-nav a:hover,
[data-theme="dark"] .navbar-nav a.active {
  background: rgba(5, 150, 105, 0.15);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-primary);
  object-fit: cover;
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.user-avatar:hover {
  transform: scale(1.1);
}

/* Mobile menu toggle */
.navbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  color: var(--text-primary);
}

.navbar-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  margin: 5px 0;
  transition: all var(--transition-base);
  border-radius: 2px;
}

/* User dropdown */
.user-dropdown {
  position: relative;
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 220px;
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-sm);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
  z-index: var(--z-dropdown);
}

.user-dropdown.open .user-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-menu .dropdown-header {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--bg-tertiary);
  margin-bottom: var(--space-xs);
}

.user-dropdown-menu .dropdown-header p {
  font-weight: 600;
  font-size: var(--text-sm);
}
.user-dropdown-menu .dropdown-header span {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.user-dropdown-menu a,
.user-dropdown-menu button {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 0.6rem var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  transition: all var(--transition-fast);
}

.user-dropdown-menu a:hover,
.user-dropdown-menu button:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.dropdown-divider {
  height: 1px;
  background: var(--bg-tertiary);
  margin: var(--space-xs) 0;
}

/* ─── Cards ─── */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base);
  box-shadow: var(--glass-shadow);
}

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

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.card:hover .card-image {
  transform: scale(1.05);
}

.card-image-wrapper {
  overflow: hidden;
  position: relative;
}

.card-badge {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
}

.card-body {
  padding: var(--space-lg);
}

.card-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-text {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Progress Bar ─── */
.progress-wrapper {
  margin: var(--space-md) 0;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: var(--space-xs);
}

.progress-count {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-2xl);
  color: var(--color-primary);
}

.progress-target {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ─── Signature Counter Animation ─── */
.counter-value {
  font-family: var(--font-heading);
  font-weight: 800;
  transition: all var(--transition-base);
}

.counter-value.bump {
  animation: counterBump 0.4s ease;
}

@keyframes counterBump {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); color: var(--color-primary-light); }
  100% { transform: scale(1); }
}

/* ─── Hero Section ─── */
.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: var(--space-4xl) 0;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #0d2818 50%, var(--bg-dark) 100%);
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(5, 150, 105, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(245, 158, 11, 0.1) 0%, transparent 40%);
  animation: heroFloat 15s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-0.5deg); }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
  padding: 0 var(--space-lg);
}

.hero h1 {
  color: var(--text-inverse);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-6xl));
  margin-bottom: var(--space-lg);
  letter-spacing: -0.02em;
}

.hero p {
  color: rgba(248, 250, 252, 0.8);
  font-size: var(--text-lg);
  margin-bottom: var(--space-2xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-3xl);
  margin-top: var(--space-3xl);
}

.hero-stat {
  text-align: center;
}

.hero-stat-value {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: 800;
  color: var(--color-primary-light);
  display: block;
}

.hero-stat-label {
  font-size: var(--text-sm);
  color: rgba(248, 250, 252, 0.6);
  margin-top: var(--space-xs);
}

/* Floating particles */
.hero-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--color-primary-light);
  border-radius: var(--radius-full);
  opacity: 0.3;
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.3; }
  90% { opacity: 0.3; }
  100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}

/* ─── Section ─── */
.section {
  padding: var(--space-4xl) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-header h2 {
  margin-bottom: var(--space-md);
}

.section-header p {
  color: var(--text-secondary);
  font-size: var(--text-lg);
  max-width: 600px;
  margin: 0 auto;
}

/* ─── Grid Layouts ─── */
.grid {
  display: grid;
  gap: var(--space-xl);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── Petition List ─── */
.petition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-xl);
}

.petition-card .card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}

.petition-card .card-meta .category-tag {
  padding: 0.15rem 0.5rem;
  background: var(--color-primary-50);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  font-weight: 600;
}

[data-theme="dark"] .petition-card .card-meta .category-tag {
  background: rgba(5, 150, 105, 0.15);
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1);
  background: var(--bg-primary);
}

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

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--space-xs);
}

/* ─── Tags ─── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  gap: var(--space-xs);
}

.tag-primary {
  background: var(--color-primary-50);
  color: var(--color-primary-dark);
}
.tag-accent {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-accent-dark);
}
.tag-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
}
.tag-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}
.tag-info {
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-info);
}

/* ─── Status Badges ─── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

.status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
}

.status-active { background: rgba(16, 185, 129, 0.1); color: var(--color-success); }
.status-active::before { background: var(--color-success); }
.status-pending { background: rgba(245, 158, 11, 0.1); color: var(--color-accent-dark); }
.status-pending::before { background: var(--color-accent); }
.status-closed { background: rgba(100, 116, 139, 0.1); color: var(--text-tertiary); }
.status-closed::before { background: var(--text-tertiary); }
.status-achieved { background: rgba(59, 130, 246, 0.1); color: var(--color-info); }
.status-achieved::before { background: var(--color-info); }

/* ─── Modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: var(--z-modal);
  background: var(--bg-primary);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: calc(100% - 2rem);
  max-height: 85vh;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal.active {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  visibility: visible;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--bg-tertiary);
}

.modal-header h3 {
  font-size: var(--text-xl);
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--text-xl);
  cursor: pointer;
  color: var(--text-tertiary);
  padding: var(--space-xs);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-xl);
}

.modal-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--bg-tertiary);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ─── Toast Notifications ─── */
.toast-container {
  position: fixed;
  top: 5rem;
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid;
  min-width: 300px;
  max-width: 450px;
  animation: toastSlide 0.4s var(--transition-spring);
}

.toast-success { border-color: var(--color-success); }
.toast-error { border-color: var(--color-danger); }
.toast-info { border-color: var(--color-info); }
.toast-warning { border-color: var(--color-warning); }

@keyframes toastSlide {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: var(--text-lg);
}

/* ─── Tables (Admin) ─── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
}

.table td {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--bg-tertiary);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: var(--bg-secondary);
}

/* ─── Admin Sidebar Layout ─── */
.admin-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 4rem;
}

.admin-sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--glass-border);
  padding: var(--space-lg);
  position: fixed;
  top: 4rem;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  transition: transform var(--transition-base);
}

.admin-sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.admin-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.65rem var(--space-md);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.admin-sidebar-nav a:hover,
.admin-sidebar-nav a.active {
  background: var(--color-primary-50);
  color: var(--color-primary);
}

[data-theme="dark"] .admin-sidebar-nav a:hover,
[data-theme="dark"] .admin-sidebar-nav a.active {
  background: rgba(5, 150, 105, 0.15);
}

.admin-sidebar-section {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: var(--space-lg) var(--space-md) var(--space-sm);
}

.admin-main {
  flex: 1;
  margin-left: 260px;
  padding: var(--space-2xl);
}

.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2xl);
}

.admin-page-header h1 {
  font-size: var(--text-3xl);
}

/* ─── Stat Cards ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  transition: all var(--transition-base);
}

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

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

.stat-card-icon.green { background: rgba(5, 150, 105, 0.1); }
.stat-card-icon.blue { background: rgba(59, 130, 246, 0.1); }
.stat-card-icon.amber { background: rgba(245, 158, 11, 0.1); }
.stat-card-icon.red { background: rgba(239, 68, 68, 0.1); }

.stat-card-value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
}

.stat-card-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: var(--space-4xl) var(--space-xl);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.empty-state h3 {
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

.empty-state p {
  color: var(--text-tertiary);
  margin-bottom: var(--space-xl);
}

/* ─── Footer ─── */
.footer {
  background: var(--bg-dark);
  color: var(--text-inverse);
  padding: var(--space-3xl) 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-xl);
}

.footer-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-lg);
}

.footer-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
}

.footer-links a {
  color: rgba(248, 250, 252, 0.6);
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-primary-light);
}

.footer-copy {
  text-align: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid rgba(248, 250, 252, 0.1);
  font-size: var(--text-sm);
  color: rgba(248, 250, 252, 0.4);
}

/* ─── Signature Success Animation ─── */
.signature-success {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.signature-success.active {
  opacity: 1;
}

.checkmark-circle {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: checkPop 0.5s var(--transition-spring);
  box-shadow: 0 0 60px rgba(5, 150, 105, 0.5);
}

@keyframes checkPop {
  0% { transform: scale(0); }
  80% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.checkmark-circle svg {
  width: 50px;
  height: 50px;
  stroke: white;
  stroke-width: 3;
  fill: none;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: checkDraw 0.5s ease forwards 0.3s;
}

@keyframes checkDraw {
  to { stroke-dashoffset: 0; }
}

/* ─── Confetti ─── */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  z-index: var(--z-modal);
  pointer-events: none;
  animation: confettiFall 2s ease forwards;
}

@keyframes confettiFall {
  0% { 
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
  100% { 
    opacity: 0;
    transform: translateY(100vh) rotate(720deg) scale(0);
  }
}

/* ─── Search & Filter Bar ─── */
.search-filter-bar {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-input-wrapper input {
  padding-left: 2.75rem;
}

.filter-chips {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.filter-chip {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip.active,
.filter-chip:hover {
  background: var(--color-primary);
  color: white;
}

/* ─── Loading Skeleton ─── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease infinite;
  border-radius: var(--radius-md);
}

@keyframes skeletonPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: var(--space-sm);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-title {
  height: 1.5rem;
  width: 80%;
  margin-bottom: var(--space-md);
}

.skeleton-image {
  height: 200px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* ─── Petition Detail Page ─── */
.petition-detail {
  padding-top: 6rem;
}

.petition-detail-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-2xl);
  align-items: start;
}

.petition-detail-content h1 {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-lg);
}

.petition-detail-image {
  width: 100%;
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-xl);
}

.petition-detail-body {
  font-size: var(--text-lg);
  line-height: 1.8;
  color: var(--text-secondary);
}

.petition-detail-body p {
  margin-bottom: var(--space-lg);
}

/* Signature sidebar */
.signature-panel {
  position: sticky;
  top: 6rem;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
}

.signature-panel h3 {
  margin-bottom: var(--space-lg);
}

.recent-signers {
  margin-top: var(--space-lg);
}

.recent-signers h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.signer-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

.signer-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.signer-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-xs);
  font-weight: 700;
}

.signer-name {
  font-size: var(--text-sm);
  font-weight: 500;
}

.signer-time {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-left: auto;
}

/* ─── Auth Page ─── */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #0d2818 100%);
  padding: var(--space-xl);
}

.auth-card {
  background: var(--bg-primary);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-3xl);
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.auth-card h2 {
  margin-bottom: var(--space-sm);
}

.auth-card p {
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
}

/* ─── Theme Toggle ─── */
.theme-toggle {
  background: var(--bg-tertiary);
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
}

.theme-toggle:hover {
  background: var(--color-primary-50);
  color: var(--color-primary);
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .petition-detail-grid {
    grid-template-columns: 1fr;
  }

  .signature-panel {
    position: static;
  }

  .admin-sidebar {
    transform: translateX(-100%);
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
  }

  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .navbar-nav {
    display: none;
  }

  .navbar-toggle {
    display: block;
  }

  .navbar-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    padding: var(--space-md);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
  }

  .hero h1 {
    font-size: var(--text-3xl);
  }

  .hero-stats {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .petition-grid {
    grid-template-columns: 1fr;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .search-filter-bar {
    flex-direction: column;
  }

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

  .modal {
    max-width: calc(100% - 1rem);
  }

  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-md);
  }

  .hero {
    min-height: 70vh;
  }

  .btn-lg {
    padding: 0.85rem 1.5rem;
    font-size: var(--text-sm);
  }
}

/* ─── Print ─── */
@media print {
  .navbar, .footer, .btn, .theme-toggle {
    display: none !important;
  }

  body {
    color: #000;
    background: #fff;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ─── Selection ─── */
::selection {
  background: var(--color-primary);
  color: white;
}

/* ─── Focus Visible ─── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Language Switcher Button ─── */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-tertiary);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
}

.lang-btn {
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-btn.active {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

/* ─── RTL (Arabic) Support ─── */
[dir="rtl"] {
  font-family: var(--font-arabic);
}

[dir="rtl"] h1, 
[dir="rtl"] h2, 
[dir="rtl"] h3, 
[dir="rtl"] h4, 
[dir="rtl"] h5, 
[dir="rtl"] h6 {
  font-family: var(--font-arabic);
}

[dir="rtl"] .search-input-wrapper .search-icon {
  left: auto;
  right: 1rem;
}

[dir="rtl"] .search-input-wrapper input {
  padding-left: 1rem;
  padding-right: 2.75rem;
}

[dir="rtl"] .toast {
  border-left: none;
  border-right: 4px solid;
}

[dir="rtl"] .toast-close {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .signer-time {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .user-dropdown-menu {
  right: auto;
  left: 0;
}

