/* ============================================
   DESIGN SYSTEM — Charte EG2026
   ============================================ */

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

:root {
  /* Brand Colors */
  --pink: #E1396C;
  --pink-dark: #c22d5a;
  --pink-light: #f06b94;
  --yellow: #FFD504;
  --yellow-dark: #e6bf00;
  --green: #039660;
  --green-dark: #027a4e;
  --green-light: #04b874;
  --blue: #3b82f6;
  --red: #ef4444;

  /* Gradient */
  --gradient: linear-gradient(90deg, #FFD504, #E93D77, #039660);
  --gradient-reverse: linear-gradient(90deg, #039660, #E93D77, #FFD504);

  /* Neutrals */
  --bg-dark: #0f1117;
  --bg-card: #1a1d27;
  --bg-card-hover: #222633;
  --bg-input: #252937;
  --bg-light: #f5f5f7;
  --text-white: #ffffff;
  --text-light: #c8cad0;
  --text-muted: #8b8d96;
  --text-dark: #1a1d27;
  --border: #2d3040;
  --border-light: #e0e0e4;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.35);
  --shadow-glow-pink: 0 0 20px rgba(225, 57, 108, 0.3);
  --shadow-glow-green: 0 0 20px rgba(3, 150, 96, 0.3);

  /* Glass */
  --glass-bg: rgba(26, 29, 39, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(20px);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ============================================
   LIGHT THEME
   ============================================ */

[data-theme="light"] {
  --bg-dark: #f5f5f7;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f0f3;
  --bg-input: #eeeef1;
  --text-white: #1a1d27;
  --text-light: #4a4d57;
  --text-muted: #7a7d86;
  --border: #dddde2;
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
  --shadow-glow-pink: 0 2px 12px rgba(225, 57, 108, 0.2);
  --shadow-glow-green: 0 2px 12px rgba(3, 150, 96, 0.2);
}

[data-theme="light"] .card {
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .modal {
  box-shadow: var(--shadow-lg);
}

[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .btn-secondary {
  color: var(--text-light);
  border-color: var(--border);
}

[data-theme="light"] .btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--pink);
}

[data-theme="light"] .btn-primary {
  color: #fff;
}

[data-theme="light"] .btn-success {
  color: #fff;
}

[data-theme="light"] .toast-info {
  background: var(--bg-card);
  color: var(--text-white);
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .tab.active {
  color: #fff;
}

/* Gradient header bar for light theme */
.theme-gradient-header {
  display: none;
  height: 5px;
  background: var(--gradient);
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
}

[data-theme="light"] .theme-gradient-header {
  display: block;
}

[data-theme="light"] .admin-container,
[data-theme="light"] .bureau-container {
  padding-top: 25px;
}

/* Theme toggle button */
.theme-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 100px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  border-color: var(--pink);
  transform: scale(1.05);
}

/* ============================================
   RESET & BASE
   ============================================ */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-white);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.1rem;
}

a {
  color: var(--pink);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--pink-light);
}

/* ============================================
   GRADIENT BAR
   ============================================ */

.gradient-bar {
  height: 4px;
  background: var(--gradient);
  width: 100%;
}

.gradient-bar-thick {
  height: 6px;
  background: var(--gradient);
  width: 100%;
  border-radius: 3px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  text-transform: none;
  letter-spacing: 0;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--pink);
  color: var(--text-white);
  box-shadow: var(--shadow-glow-pink);
}

.btn-primary:hover {
  background: var(--pink-dark);
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(225, 57, 108, 0.4);
}

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

.btn-secondary {
  background: transparent;
  color: var(--text-white);
  border: 1px solid var(--border);
}

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

.btn-success {
  background: var(--green);
  color: var(--text-white);
  box-shadow: var(--shadow-glow-green);
}

.btn-success:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
}

.btn-danger {
  background: #dc3545;
  color: var(--text-white);
}

.btn-danger:hover {
  background: #c82333;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 16px 36px;
  font-size: 1.1rem;
}

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

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--glass-border);
}

.card-glass {
  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-md);
  padding: 24px;
}

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

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-white);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(225, 57, 108, 0.15);
}

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

.form-input[type="number"] {
  -moz-appearance: textfield;
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
}

.form-input[type="number"]::-webkit-inner-spin-button,
.form-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.form-error {
  color: #ff4757;
  font-size: 0.85rem;
  margin-top: 6px;
}

/* ============================================
   BADGES & TAGS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-waiting {
  background: rgba(139, 141, 150, 0.2);
  color: var(--text-muted);
}

.badge-progress {
  background: rgba(255, 213, 4, 0.15);
  color: var(--yellow);
}

.badge-done {
  background: rgba(3, 150, 96, 0.15);
  color: var(--green-light);
}

.badge-representative {
  background: rgba(255, 213, 4, 0.15);
  color: var(--yellow);
}

.badge-tag {
  cursor: pointer;
  opacity: 0.3;
  transition: all 0.2s;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  user-select: none;
}
.badge-tag.active {
  opacity: 1;
}

.badge-fi {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}
.badge-ps {
  background: rgba(225, 57, 108, 0.15);
  color: var(--pink);
}
.badge-verts {
  background: rgba(3, 150, 96, 0.15);
  color: var(--green);
}
.badge-droite {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 4px;
  transition: width var(--transition-slow);
  min-width: 0;
}

.progress-fill-pink {
  background: var(--pink);
}

.progress-fill-green {
  background: var(--green);
}

/* ============================================
   TABLE
   ============================================ */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  background: var(--bg-input);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--transition-fast);
}

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

tbody tr.flash-update {
  animation: flashRow 1.5s ease;
}

@keyframes flashRow {
  0% {
    background: rgba(3, 150, 96, 0.3);
  }

  100% {
    background: transparent;
  }
}

/* ============================================
   STAT CARDS
   ============================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  margin: 8px 0;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-sub {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* ============================================
   TABS
   ============================================ */

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.tab.active {
  background: var(--pink);
  color: var(--text-white);
}

.tab:hover:not(.active) {
  color: var(--text-white);
  background: var(--bg-card-hover);
}

/* ============================================
   TOGGLE
   ============================================ */

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-input);
  border-radius: 24px;
  transition: var(--transition);
  border: 1px solid var(--border);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--pink);
  border-color: var(--pink);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(20px);
  background: white;
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================
   ALERT / TOAST
   ============================================ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 3s forwards;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.toast-success {
  background: var(--green);
  color: white;
}

.toast-error {
  background: #dc3545;
  color: white;
}

.toast-info {
  background: var(--bg-card);
  color: var(--text-white);
  border: 1px solid var(--border);
}

@keyframes toastIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ============================================
   UTILITIES
   ============================================ */

.text-pink {
  color: var(--pink);
}

.text-green {
  color: var(--green);
}

.text-yellow {
  color: var(--yellow);
}

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

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

.text-right {
  text-align: right;
}

.text-mono {
  font-variant-numeric: tabular-nums;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.gap-24 {
  gap: 24px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.hidden {
  display: none !important;
}

.w-full {
  width: 100%;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

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

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.animate-slide-up {
  animation: slideUp 0.4s ease;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

/* Live indicator */
.live-dot {
  width: 8px;
  height: 8px;
  background: #ff4757;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
  display: inline-block;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.4rem;
  }

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

  .card {
    padding: 16px;
  }

  .btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}