/* === BASE.CSS — Variables, reset, typographie, composants globaux === */

:root {
  /* Couleurs principales */
  --magenta: #E5007D;
  --magenta-light: #FFF0F7;
  --magenta-dark: #B30062;
  --magenta-10: rgba(229, 0, 125, 0.1);

  /* Surfaces */
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --surface-hover: #F5F5F3;
  --surface-active: #EEEEEC;

  /* Bordures */
  --border: #E8E8E4;
  --border-focus: #E5007D;
  --border-light: #F0F0EC;

  /* Textes */
  --text: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-tertiary: #999999;
  --text-inverse: #FFFFFF;

  /* Statuts */
  --success: #0D9F6E;
  --success-bg: #ECFDF5;
  --success-border: #A7F3D0;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;
  --info: #2563EB;
  --info-bg: #EFF6FF;
  --info-border: #BFDBFE;

  /* Agences */
  --blue-dark: #1a2a5e;
  --blue-mid: #2c3e8c;
  --blue-accent: #3b5cc6;
  --blue-light: #e8edf8;
  --gold: #c9a84c;
  --gold-light: #f5eed6;

  /* Dimensions */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Ombres */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);

  /* Typographie */
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --font-pdf: 'Source Sans 3', 'Helvetica Neue', sans-serif;
  --font-pdf-title: 'Playfair Display', serif;

  /* Transitions */
  --transition: all 0.2s ease;
  --transition-slow: all 0.3s ease;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Typographie */
h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.4; }

a { color: var(--magenta); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--magenta);
  color: var(--text-inverse);
}
.btn-primary:hover {
  background: var(--magenta-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--text-tertiary);
}

.btn-ghost {
  background: transparent;
  color: var(--magenta);
  padding: 8px 16px;
}
.btn-ghost:hover {
  background: var(--magenta-light);
}

.btn-success {
  background: var(--success);
  color: var(--text-inverse);
}
.btn-success:hover {
  background: #0b8a5e;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: var(--text-inverse);
}

.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

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

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

/* Step badge */
.step-badge {
  width: 28px;
  height: 28px;
  background: var(--magenta);
  color: white;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Status badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status.sent { background: var(--info-bg); color: var(--info); }
.status.sent .status-dot { background: var(--info); }
.status.delivered { background: var(--warning-bg); color: var(--warning); }
.status.delivered .status-dot { background: var(--warning); }
.status.completed { background: var(--success-bg); color: var(--success); }
.status.completed .status-dot { background: var(--success); }
.status.declined { background: var(--danger-bg); color: var(--danger); }
.status.declined .status-dot { background: var(--danger); }
.status.voided { background: #f3f4f6; color: #6b7280; }
.status.voided .status-dot { background: #6b7280; }

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--text);
  color: var(--text-inverse);
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition-slow);
  z-index: 10000;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast-icon { color: var(--success); font-size: 18px; }

/* Loading overlay */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.loading-overlay.active { display: flex; }

.loading-content {
  text-align: center;
  color: white;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: var(--magenta);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 15px;
  font-weight: 600;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 5000;
  overflow-y: auto;
  padding: 32px;
}
.modal-overlay.active { display: flex; align-items: flex-start; justify-content: center; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 700px;
  box-shadow: var(--shadow-lg);
  margin-top: 40px;
}
.modal.modal-lg { max-width: 960px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 700; font-size: 16px; }
.modal-header-actions { display: flex; gap: 8px; align-items: center; }
.modal-close {
  width: 32px; height: 32px;
  border: none; background: var(--surface-hover);
  border-radius: var(--radius-sm);
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Empty state */
.empty-state {
  text-align: center;
  color: var(--text-tertiary);
  padding: 40px 20px;
  font-size: 14px;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: var(--transition);
}
.filter-chip:hover { border-color: var(--magenta); color: var(--magenta); }
.filter-chip.active {
  background: var(--magenta);
  color: white;
  border-color: var(--magenta);
}

/* Required star */
.required { color: var(--danger); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* === MOBILE RESPONSIVE === */
@media (max-width: 480px) {
  body { font-size: 13px; }

  .card { padding: 16px; margin-bottom: 14px; }
  .card-title { font-size: 14px; margin-bottom: 14px; }

  .btn { padding: 10px 16px; font-size: 13px; }
  .btn-lg { padding: 12px 20px; font-size: 14px; }
  .btn-sm { padding: 6px 12px; font-size: 12px; }

  .toast {
    right: 12px;
    left: 12px;
    bottom: 16px;
    font-size: 13px;
    padding: 12px 16px;
  }

  .modal-overlay { padding: 8px; }
  .modal {
    margin-top: 8px;
    border-radius: var(--radius);
  }
  .modal-header { padding: 14px 16px; }
  .modal-title { font-size: 14px; }
  .modal-body {
    padding: 16px;
    max-height: 80vh;
  }
  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .modal-footer .btn { flex: 1; min-width: 0; justify-content: center; }

  .step-badge { width: 24px; height: 24px; font-size: 12px; }

  .filter-bar { gap: 4px; }
  .filter-chip { padding: 5px 10px; font-size: 12px; }
}
