/* ============================================================
   style.css — Design professionnel mairie (bleu institutionnel)
   ============================================================ */

:root {
  --primary:      #1a4a8a;   /* Bleu mairie */
  --primary-dark: #0f2d57;
  --primary-light:#2563b0;
  --accent:       #e8f0fc;
  --success:      #27ae60;
  --warning:      #e67e22;
  --danger:       #e74c3c;
  --gray-100:     #f8f9fa;
  --gray-200:     #e9ecef;
  --gray-600:     #6c757d;
  --text:         #212529;
  --radius:       8px;
  --shadow:       0 2px 12px rgba(0,0,0,.10);
  --transition:   .2s ease;
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--gray-100);
  color: var(--text);
  line-height: 1.6;
}

/* ─── Barre de navigation ────────────────────────────────── */

.navbar {
  background: var(--primary);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.navbar-brand {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.navbar-brand i { font-size: 1.4rem; }

.nav-links {
  display: flex;
  gap: .25rem;
  list-style: none;
}

.nav-links a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: .45rem .9rem;
  border-radius: var(--radius);
  font-size: .9rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: .4rem;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,.15);
  color: #fff;
}

.nav-auth { display: flex; gap: .5rem; align-items: center; }

/* ─── Layout principal ───────────────────────────────────── */

.main-content { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem; }

/* ─── Hero bannière accueil ──────────────────────────────── */

.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 3rem 2rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  text-align: center;
}

.hero h1 { font-size: 2rem; font-weight: 700; margin-bottom: .5rem; }
.hero p  { font-size: 1.1rem; opacity: .9; margin-bottom: 1.5rem; }

/* ─── Cartes de statistiques ─────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--primary);
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: .85rem;
  color: var(--gray-600);
  margin-top: .25rem;
}

/* ─── Cartes d'idées ─────────────────────────────────────── */

.ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.idea-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.idea-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
}

.idea-card-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1rem .5rem;
}

.idea-rank {
  background: var(--primary);
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.idea-category-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  padding: .25rem .6rem;
  border-radius: 20px;
  color: #fff;
  font-weight: 500;
}

.idea-card-body { padding: .5rem 1rem 1rem; flex: 1; }

.idea-card-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .4rem;
  line-height: 1.4;
}

.idea-card-body p {
  font-size: .875rem;
  color: var(--gray-600);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.idea-card-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

/* ─── Boutons de vote ────────────────────────────────────── */

.vote-buttons {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.btn-vote {
  border: 2px solid var(--gray-200);
  background: transparent;
  border-radius: 20px;
  padding: .3rem .75rem;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: .3rem;
}

.btn-vote.pour:hover, .btn-vote.pour.active {
  background: #e8f5e9;
  border-color: var(--success);
  color: var(--success);
}

.btn-vote.contre:hover, .btn-vote.contre.active {
  background: #ffebee;
  border-color: var(--danger);
  color: var(--danger);
}

.score-total {
  font-weight: 700;
  font-size: 1.1rem;
  min-width: 2rem;
  text-align: center;
}

.score-total.positive { color: var(--success); }
.score-total.negative { color: var(--danger); }

/* ─── Badges de statut ───────────────────────────────────── */

.badge-statut {
  font-size: .7rem;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.badge-soumise    { background: #e3f2fd; color: #1565c0; }
.badge-en_examen  { background: #fff3e0; color: #e65100; }
.badge-approuvee  { background: #e8f5e9; color: #2e7d32; }
.badge-en_cours   { background: #f3e5f5; color: #6a1b9a; }
.badge-realisee   { background: #e0f2f1; color: #00695c; }
.badge-rejetee    { background: #fce4ec; color: #880e4f; }

/* ─── Formulaires ────────────────────────────────────────── */

.form-group { margin-bottom: 1.2rem; }

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: .4rem;
  font-size: .9rem;
}

.form-control {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .95rem;
  transition: border-color var(--transition);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,74,138,.1);
}

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

/* ─── Boutons généraux ───────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  font-family: inherit;
}

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.9); }

.btn-outline   { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-sm        { padding: .35rem .75rem; font-size: .82rem; }

/* ─── Modal ──────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 { font-size: 1.2rem; }

.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-200); display: flex; gap: .75rem; justify-content: flex-end; }

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--gray-600);
  line-height: 1;
}

/* ─── Filtres et recherche ───────────────────────────────── */

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.filters-bar input, .filters-bar select {
  padding: .5rem .85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .9rem;
  background: #fff;
}

.filters-bar input { flex: 1; min-width: 200px; }

/* ─── Section détail d'une idée ──────────────────────────── */

.idea-detail {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.idea-detail h1 { font-size: 1.6rem; margin-bottom: .75rem; }

.idea-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .85rem;
  color: var(--gray-600);
  margin-bottom: 1.5rem;
}

.idea-meta span { display: flex; align-items: center; gap: .3rem; }

.idea-description { line-height: 1.8; color: #333; margin-bottom: 1.5rem; }

.admin-note {
  background: var(--accent);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
}

.admin-note strong { color: var(--primary); display: block; margin-bottom: .3rem; }

/* ─── Commentaires ───────────────────────────────────────── */

.comments-section { margin-top: 2rem; }
.comments-section h3 { margin-bottom: 1rem; font-size: 1.1rem; }

.comment-item {
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--gray-100);
  margin-bottom: .75rem;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .4rem;
  font-size: .85rem;
}

.comment-author { font-weight: 600; }
.comment-date   { color: var(--gray-600); }

/* ─── Pétitions ──────────────────────────────────────────── */

.petition-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.petition-card h3 { font-size: 1.05rem; margin-bottom: .5rem; }

.progress-bar-container {
  background: var(--gray-200);
  border-radius: 20px;
  height: 10px;
  overflow: hidden;
  margin: .75rem 0;
}

.progress-bar {
  height: 100%;
  background: var(--success);
  border-radius: 20px;
  transition: width .5s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  color: var(--gray-600);
}

/* ─── Budget participatif ────────────────────────────────── */

.budget-header {
  background: linear-gradient(135deg, #1a4a8a, #27ae60);
  color: #fff;
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.budget-total { font-size: 2rem; font-weight: 700; }

.projet-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.projet-rank {
  background: var(--primary);
  color: #fff;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.projet-info { flex: 1; }
.projet-info h3 { font-size: 1rem; margin-bottom: .3rem; }
.projet-cout { font-size: .85rem; color: var(--gray-600); margin-bottom: .5rem; }

/* ─── Dashboard admin ────────────────────────────────────── */

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-stat {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.admin-stat .number { font-size: 2.5rem; font-weight: 700; color: var(--primary); }
.admin-stat .label  { color: var(--gray-600); font-size: .9rem; }

.admin-table {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-table table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: .75rem 1rem; text-align: left; font-size: .88rem; }
.admin-table th { background: var(--primary); color: #fff; }
.admin-table tr:nth-child(even) { background: var(--gray-100); }
.admin-table tr:hover { background: var(--accent); }

/* ─── Alertes et messages ────────────────────────────────── */

.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
}

.alert-error   { background: #ffebee; color: #b71c1c; border-left: 4px solid #e74c3c; }
.alert-success { background: #e8f5e9; color: #1b5e20; border-left: 4px solid #27ae60; }
.alert-info    { background: var(--accent); color: var(--primary); border-left: 4px solid var(--primary); }

/* ─── État vide ──────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--gray-600);
}

.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state h3 { font-size: 1.2rem; margin-bottom: .5rem; }

/* ─── Chargement ─────────────────────────────────────────── */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 3rem;
  color: var(--gray-600);
}

.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast notification ─────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast {
  background: #333;
  color: #fff;
  padding: .85rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  animation: slideIn .25s ease;
  max-width: 320px;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

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

/* ─── Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero h1 { font-size: 1.4rem; }
  .ideas-grid { grid-template-columns: 1fr; }
  .main-content { padding: 1rem .75rem; }
  .admin-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Utilitaires ────────────────────────────────────────── */

.d-none    { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: .5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.w-100 { width: 100%; }
.text-muted { color: var(--gray-600); font-size: .875rem; }
