/* Toast notifications */
.bp-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 99999;
  background: #111827;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  font-size: 15px;
  max-width: 90vw;
  text-align: center;
}
.bp-toast.success { background: #16a34a; }
.bp-toast.error { background: #dc2626; }
.bp-toast.info { background: #2563eb; }

.bp-message {
  position: relative;
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 8px;
}
.bp-message.success { background: #ecfdf5; color: #065f46; }
.bp-message.error { background: #fef2f2; color: #991b1b; }
.bp-message.info { background: #eff6ff; color: #1e40af; }
/* === BUDGET PARTICIPATIF - STYLES === */

/* Variables CSS pour la cohérence */
:root {
  --bp-primary: #2563eb;
  --bp-primary-hover: #1d4ed8;
  --bp-success: #10b981;
  --bp-danger: #ef4444;
  --bp-warning: #f59e0b;
  --bp-gray-50: #f9fafb;
  --bp-gray-100: #f3f4f6;
  --bp-gray-200: #e5e7eb;
  --bp-gray-300: #d1d5db;
  --bp-gray-600: #4b5563;
  --bp-gray-800: #1f2937;
  --bp-gray-900: #111827;
  --bp-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --bp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --bp-radius: 12px;
  --bp-transition: all 0.3s ease;
}

/* === CONTRÔLES (RECHERCHE ET FILTRES) === */
.bp-controls {
  background: white;
  border-radius: var(--bp-radius);
  box-shadow: var(--bp-shadow);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--bp-gray-200);
}

.bp-search-container {
  position: relative;
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.bp-search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3.2rem;
  border: 2px solid var(--bp-gray-300);
  border-radius: var(--bp-radius);
  font-size: 1rem;
  transition: var(--bp-transition);
  background: white;
}

.bp-search-input:focus {
  outline: none;
  border-color: var(--bp-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.bp-search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bp-gray-600);
  z-index: 10;
  pointer-events: none;
  font-size: 1.2em;
}

.bp-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.bp-filter-btn {
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--bp-gray-300);
  background: white;
  color: var(--bp-gray-700);
  border-radius: 25px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--bp-transition);
  font-size: 0.9rem;
  text-transform: capitalize;
}

.bp-filter-btn:hover {
  border-color: var(--bp-primary);
  color: var(--bp-primary);
  transform: translateY(-2px);
  box-shadow: var(--bp-shadow);
}

.bp-filter-btn.active {
  background: var(--bp-primary);
  color: white;
  border-color: var(--bp-primary);
}

/* === GRILLE DES PROJETS === */
.bp-projects-grid,
.bp-projets-non-retenus {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin: 2rem 0;
  padding: 0;
  width: 100%;
}

/* S'assurer que le bloc d'intro des projets non retenus occupe toute la largeur */
.bp-projets-non-retenus > div:first-child {
  grid-column: 1 / -1;
}

/* Si la section des non retenus est rendue à l'intérieur de la grille principale,
   elle s'étend sur toute la largeur de la grille parente */
.bp-projects-grid .bp-projets-non-retenus {
  grid-column: 1 / -1;
}

@media (max-width: 1023px) {
  .bp-projects-grid,
  .bp-projets-non-retenus {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .bp-projects-grid,
  .bp-projets-non-retenus {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 1rem 0;
  }
}

/* === CARTE DE PROJET === */
.bp-project-card {
  background: white;
  border-radius: var(--bp-radius);
  box-shadow: var(--bp-shadow);
  overflow: hidden;
  transition: var(--bp-transition);
  border: 1px solid var(--bp-gray-200);
  position: relative;
}

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

/* === IMAGE DU PROJET === */
.bp-project-image {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.bp-project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--bp-transition);
}

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

/* === CONTENU DE LA CARTE === */
.bp-project-content {
  padding: 1.5rem;
}

.bp-project-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

/* Couleurs des catégories */
.bp-category-environnement {
  background-color: #d1fae5;
  color: #065f46;
}

.bp-category-social {
  background-color: #fef3c7;
  color: #92400e;
}

.bp-category-culture {
  background-color: #ede9fe;
  color: #5b21b6;
}

.bp-category-sport {
  background-color: #dbeafe;
  color: #1e40af;
}

.bp-category-education {
  background-color: #fed7d7;
  color: #c53030;
}

.bp-category-infrastructure {
  background-color: #e2e8f0;
  color: #2d3748;
}

.bp-project-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--bp-gray-900);
  margin: 0 0 1rem 0;
  line-height: 1.3;
}

.bp-project-excerpt {
  color: var(--bp-gray-600);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* === MÉTADONNÉES === */
.bp-project-meta {
  margin-bottom: 1.5rem;
}

.bp-meta-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.bp-meta-label {
  font-weight: 600;
  color: var(--bp-gray-800);
  min-width: 60px;
  margin-right: 0.5rem;
}

/* === ACTIONS === */
.bp-project-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--bp-gray-200);
}

.bp-vote-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bp-vote-count {
  font-size: 0.9rem;
  color: var(--bp-gray-600);
  font-weight: 500;
}

.bp-vote-btn {
  background: var(--bp-primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--bp-transition);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bp-vote-btn:hover {
  background: var(--bp-primary-hover);
  transform: translateY(-1px);
}

.bp-vote-btn:disabled,
.bp-vote-btn.bp-voted {
  background: var(--bp-success);
  cursor: not-allowed;
  opacity: 0.8;
}

.bp-vote-btn:disabled:hover,
.bp-vote-btn.bp-voted:hover {
  transform: none;
}

.bp-details-btn {
  background: transparent;
  color: var(--bp-primary);
  border: 2px solid var(--bp-primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--bp-transition);
  font-size: 0.9rem;
}

.bp-details-btn:hover {
  background: var(--bp-primary);
  color: white;
}

/* === DÉTAILS DU PROJET === */
.bp-project-details {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--bp-gray-200);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

.bp-details-content {
  color: var(--bp-gray-700);
  line-height: 1.6;
}

/* === MESSAGE AUCUN RÉSULTAT === */
.bp-no-results {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--bp-gray-600);
  font-size: 1.1rem;
  background: white;
  border-radius: var(--bp-radius);
  box-shadow: var(--bp-shadow);
  margin-top: 2rem;
}

.bp-no-results p {
  margin: 0;
  font-weight: 500;
}

/* === RÉSULTATS === */
.bp-results-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 0;
}

.bp-results-header {
  text-align: center;
  margin-bottom: 3rem;
}

.bp-results-header h2 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--bp-gray-900);
  margin-bottom: 1rem;
}

.bp-total-votes {
  font-size: 1.25rem;
  color: var(--bp-gray-600);
  font-weight: 500;
}

.bp-results-grid {
  display: grid;
  gap: 1.5rem;
}

.bp-result-card {
  background: white;
  border-radius: var(--bp-radius);
  box-shadow: var(--bp-shadow);
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  transition: var(--bp-transition);
  border: 1px solid var(--bp-gray-200);
}

.bp-result-card:hover {
  transform: translateX(8px);
  box-shadow: var(--bp-shadow-lg);
}

.bp-result-position {
  font-size: 2rem;
  font-weight: 800;
  color: var(--bp-primary);
  min-width: 60px;
}

.bp-result-content {
  flex: 1;
}

.bp-result-content h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bp-gray-900);
  margin: 0 0 0.5rem 0;
}

.bp-result-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.bp-result-budget {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--bp-success);
  margin-bottom: 1rem;
}

.bp-result-votes {
  width: 100%;
  max-width: 300px;
}

.bp-vote-bar {
  width: 100%;
  height: 8px;
  background: var(--bp-gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.bp-vote-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--bp-primary), var(--bp-primary-hover));
  transition: width 0.8s ease-out;
}

.bp-vote-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bp-vote-number {
  font-weight: 600;
  color: var(--bp-gray-800);
}

.bp-vote-percentage {
  font-weight: 500;
  color: var(--bp-gray-600);
}

/* === ÉTATS DE CHARGEMENT === */
.bp-loading {
  opacity: 0.6;
  pointer-events: none;
}

.bp-vote-btn.loading {
  background: var(--bp-gray-400);
  cursor: wait;
}

.bp-vote-btn.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* === ANIMATIONS SUPPLÉMENTAIRES === */
.bp-vote-count.updating {
  transform: scale(1.1);
  color: var(--bp-primary);
  font-weight: 600;
  transition: all 0.3s ease;
}

.bp-project-card.vote-success {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
}

.bp-vote-btn.error-shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.animate-in {
  animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === MESSAGES === */
.bp-message {
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  font-weight: 500;
}

.bp-message.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.bp-message.error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #ef4444;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .bp-controls {
    padding: 1.5rem;
  }
  
  .bp-filters {
    gap: 0.5rem;
  }
  
  .bp-filter-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
  
  .bp-projects-grid,
  .bp-projets-non-retenus {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 1rem 0;
  }
  
  .bp-project-card {
    margin: 0 1rem;
  }
  
  .bp-project-content {
    padding: 1rem;
  }
  
  .bp-project-actions {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .bp-vote-section {
    justify-content: center;
  }
  
  .bp-result-card {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .bp-result-position {
    min-width: auto;
  }
  
  .bp-results-header h2 {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .bp-search-container {
    margin-bottom: 1rem;
  }
  
  .bp-search-input {
    padding: 0.8rem 0.8rem 0.8rem 2.5rem;
    font-size: 0.9rem;
  }
  
  .bp-project-content {
    padding: 0.75rem;
  }
  
  .bp-project-title {
    font-size: 1.1rem;
  }
  
  .bp-vote-btn, .bp-details-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.bp-project-card {
  animation: fadeIn 0.5s ease-out;
}

.bp-project-card:nth-child(1) { animation-delay: 0.1s; }
.bp-project-card:nth-child(2) { animation-delay: 0.2s; }
.bp-project-card:nth-child(3) { animation-delay: 0.3s; }
.bp-project-card:nth-child(4) { animation-delay: 0.4s; }

/* === ACCESSIBILITÉ === */
.bp-vote-btn:focus,
.bp-details-btn:focus,
.bp-filter-btn:focus,
.bp-search-input:focus {
  outline: 2px solid var(--bp-primary);
  outline-offset: 2px;
}

/* === PRINT === */
@media print {
  .bp-controls,
  .bp-project-actions {
    display: none;
  }
  
  .bp-project-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid var(--bp-gray-300);
  }
}

.bp-propose-project-btn {
    padding: 10px 20px;
    background-color: #2271b1;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    margin-bottom: 20px;
}

.bp-project-contact {
    margin-top: 10px;
    font-style: italic;
}

.bp-project-contact .dashicons {
    margin-right: 5px;
}

/* === MODALES === */
#bp-propose-project-modal {
  display: none !important;
  position: fixed !important;
  z-index: 999999 !important;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  flex-direction: row;
}

#bp-propose-project-modal[style*="display: flex"] {
  display: flex !important;
}

#bp-propose-project-modal .bp-modal-content {
  background: #fff;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  border-radius: 12px;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  margin: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width:600px) {
  #bp-propose-project-modal .bp-modal-content {padding:1rem;}
}

/* Toggle switch styles for project selection */
input[type="checkbox"] {
    position: relative;
    width: 40px;
    height: 20px;
    -webkit-appearance: none;
    background: #c6c6c6;
    outline: none;
    border-radius: 20px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
    transition: .5s;
}

input:checked[type="checkbox"] {
    background: #2563eb;
}

input[type="checkbox"]:before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    top: 0;
    left: 0;
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: .5s;
}

input:checked[type="checkbox"]:before {
    left: 20px;
}
