/* ============================================
   Annuaire-Médiateur — Main Stylesheet
   ============================================ */

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

:root {
  --blue: #2563EB;
  --blue-dark: #1D4ED8;
  --blue-light: #DBEAFE;
  --green: #10B981;
  --green-dark: #059669;
  --green-light: #D1FAE5;
  --orange: #F59E0B;
  --orange-dark: #D97706;
  --white: #FFFFFF;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 40px -10px rgba(0,0,0,0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--gray-800);
  background: var(--white);
  line-height: 1.7;
  overflow-x: hidden;
}

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

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

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--gray-900);
}
h1 { font-size: 2.5rem; margin-bottom: 1rem; }
h2 { font-size: 2rem; margin-bottom: 0.8rem; }
h3 { font-size: 1.5rem; margin-bottom: 0.6rem; }
p { margin-bottom: 1rem; color: var(--gray-600); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Header / Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  transition: var(--transition);
}
.navbar.scrolled {
  box-shadow: var(--shadow);
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  gap: 1rem;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--blue);
  text-decoration: none;
  white-space: nowrap;
}
.navbar-brand:hover { color: var(--blue-dark); }
.navbar-brand .brand-icon {
  font-size: 1.6rem;
}

/* Search bar in header */
.navbar-search {
  flex: 1;
  max-width: 500px;
  position: relative;
}
.navbar-search input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  border: 2px solid var(--gray-200);
  border-radius: 50px;
  font-size: 0.95rem;
  transition: var(--transition);
  background: var(--gray-50);
}
.navbar-search input:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.navbar-search .search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
}
.navbar-search .search-results-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: none;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
}
.navbar-search .search-results-dropdown.active { display: block; }

/* Nav links */
.nav-links {
  display: flex;
  gap: 0.3rem;
  list-style: none;
  align-items: center;
}
.nav-links a {
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: var(--transition);
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--blue);
  background: var(--blue-light);
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-700);
  padding: 0.3rem;
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563EB 100%);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.2;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(30,58,95,0.85) 0%, rgba(37,99,235,0.7) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
  text-align: center;
  color: var(--white);
}
.hero h1 {
  font-size: 3rem;
  color: var(--white);
  margin-bottom: 1.2rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.hero p {
  font-size: 1.2rem;
  color: rgba(255,255,255,0.9);
  margin-bottom: 2rem;
}

/* Hero search */
.hero-search {
  max-width: 600px;
  margin: 0 auto 2rem;
  position: relative;
}
.hero-search input {
  width: 100%;
  padding: 1rem 1.2rem 1rem 3rem;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  box-shadow: var(--shadow-xl);
}
.hero-search input:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.3), var(--shadow-xl);
}
.hero-search .search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 1.2rem;
}
.hero-search button {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--blue);
  color: var(--white);
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.hero-search button:hover { background: var(--blue-dark); }

/* --- Sections --- */
.section {
  padding: 5rem 0;
}
.section-alt {
  background: var(--gray-50);
}
.section-title {
  text-align: center;
  margin-bottom: 3rem;
}
.section-title h2 {
  font-size: 2.2rem;
  position: relative;
  display: inline-block;
}
.section-title h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: var(--blue);
  border-radius: 2px;
}
.section-title p {
  margin-top: 1rem;
  font-size: 1.1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Cards --- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid var(--gray-100);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}
.card-img {
  height: 180px;
  overflow: hidden;
}
.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.card:hover .card-img img { transform: scale(1.05); }
.card-body {
  padding: 1.5rem;
}
.card-body h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.card-body p { font-size: 0.95rem; }

/* --- Mediator List --- */
.mediator-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.mediator-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  transition: var(--transition);
  flex-wrap: wrap;
  gap: 0.8rem;
}
.mediator-item:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow);
}
.mediator-name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 1rem;
}
.mediator-phone {
  color: var(--green);
  font-weight: 500;
  white-space: nowrap;
}
.mediator-phone a { color: var(--green); }
.mediator-phone a:hover { color: var(--green-dark); }
.mediator-link {
  background: var(--blue);
  color: var(--white) !important;
  padding: 0.4rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}
.mediator-link:hover {
  background: var(--blue-dark);
  color: var(--white) !important;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 0.5rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: var(--transition);
}
.pagination a:hover { background: var(--blue-light); border-color: var(--blue); }
.pagination .active {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}
.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* --- Stats / Counters --- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  text-align: center;
}
.stat-item {
  padding: 2rem;
}
.stat-number {
  font-size: 3rem;
  font-weight: 800;
  color: var(--blue);
  display: block;
}
.stat-label {
  font-size: 1rem;
  color: var(--gray-500);
  margin-top: 0.5rem;
}

/* --- Breadcrumb --- */
.breadcrumb {
  padding: 1rem 0;
  font-size: 0.9rem;
  color: var(--gray-400);
}
.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb .separator { margin: 0 0.5rem; }

/* --- Fiche Mediateur --- */
.fiche {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}
.fiche-main { }
.fiche-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.fiche-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.fiche-card h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--blue-light);
}
.fiche-info {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}
.fiche-info .icon {
  color: var(--blue);
  min-width: 20px;
  text-align: center;
  margin-top: 2px;
}
.fiche-description {
  line-height: 1.8;
  white-space: pre-line;
}
.fiche-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}
.tag {
  background: var(--blue-light);
  color: var(--blue-dark);
  padding: 0.3rem 0.8rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
}
.social-links {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-600);
  transition: var(--transition);
  font-size: 1.1rem;
}
.social-links a:hover {
  background: var(--blue);
  color: var(--white);
}

/* Stars */
.stars { color: var(--orange); font-size: 1.1rem; }

/* Hours table */
.hours-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.hours-table td {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.hours-table td:first-child {
  font-weight: 500;
  text-transform: capitalize;
}
.hours-table .closed { color: var(--gray-400); font-style: italic; }

/* --- FAQ Accordion --- */
.accordion { max-width: 800px; margin: 0 auto; }
.accordion-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
  overflow: hidden;
  transition: var(--transition);
}
.accordion-item:hover { border-color: var(--blue-light); }
.accordion-header {
  padding: 1.2rem 1.5rem;
  background: var(--white);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 1rem;
  color: var(--gray-800);
  transition: var(--transition);
}
.accordion-header:hover { color: var(--blue); }
.accordion-header .icon {
  transition: transform 0.3s ease;
  font-size: 1.2rem;
  color: var(--blue);
}
.accordion-item.active .accordion-header .icon { transform: rotate(45deg); }
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}
.accordion-body-inner {
  padding: 0 1.5rem 1.2rem;
  color: var(--gray-600);
  line-height: 1.7;
}

/* --- Testimonials --- */
.testimonial-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  position: relative;
}
.testimonial-card::before {
  content: '"';
  font-size: 4rem;
  color: var(--blue-light);
  position: absolute;
  top: 0.5rem;
  left: 1rem;
  font-family: Georgia, serif;
  line-height: 1;
}
.testimonial-text {
  font-style: italic;
  color: var(--gray-600);
  margin-bottom: 1rem;
  padding-top: 1.5rem;
}
.testimonial-author {
  font-weight: 600;
  color: var(--gray-800);
}
.testimonial-meta {
  font-size: 0.85rem;
  color: var(--gray-400);
}

/* --- Blog --- */
.blog-card .card-body { padding: 1.5rem; }
.blog-meta {
  font-size: 0.85rem;
  color: var(--gray-400);
  margin-bottom: 0.5rem;
}
.blog-excerpt {
  font-size: 0.95rem;
  color: var(--gray-600);
  margin-bottom: 1rem;
}
.read-more {
  font-weight: 600;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.read-more:hover { gap: 0.6rem; }

/* Blog article */
.article-content {
  max-width: 800px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.8;
}
.article-content h2 { margin-top: 2.5rem; margin-bottom: 1rem; font-size: 1.6rem; }
.article-content h3 { margin-top: 2rem; margin-bottom: 0.8rem; font-size: 1.3rem; }
.article-content p { margin-bottom: 1.2rem; color: var(--gray-700); }
.article-content ul, .article-content ol {
  margin: 1rem 0 1.5rem 1.5rem;
  color: var(--gray-700);
}
.article-content li { margin-bottom: 0.5rem; }
.article-content blockquote {
  border-left: 4px solid var(--blue);
  padding: 1rem 1.5rem;
  background: var(--blue-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
  font-style: italic;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--gray-700);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--white);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-group textarea { resize: vertical; min-height: 120px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.8rem;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--blue);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--blue-dark);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.btn-secondary {
  background: var(--white);
  color: var(--blue);
  border: 2px solid var(--blue);
}
.btn-secondary:hover {
  background: var(--blue);
  color: var(--white);
}
.btn-orange {
  background: var(--orange);
  color: var(--white);
}
.btn-orange:hover {
  background: var(--orange-dark);
  color: var(--white);
}

/* Honeypot */
.hp-field { position: absolute; left: -9999px; }

/* --- Footer --- */
.footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 4rem 0 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}
.footer h4 {
  color: var(--white);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}
.footer ul { list-style: none; }
.footer li { margin-bottom: 0.5rem; }
.footer a { color: var(--gray-400); }
.footer a:hover { color: var(--white); }
.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--gray-700);
  font-size: 0.9rem;
}

/* --- Animations (scroll reveal) --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}
.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Stagger children */
.stagger-children .reveal:nth-child(1) { transition-delay: 0.1s; }
.stagger-children .reveal:nth-child(2) { transition-delay: 0.2s; }
.stagger-children .reveal:nth-child(3) { transition-delay: 0.3s; }
.stagger-children .reveal:nth-child(4) { transition-delay: 0.4s; }
.stagger-children .reveal:nth-child(5) { transition-delay: 0.5s; }

/* Parallax */
.parallax-bg {
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
}

/* --- Rate Limit Alert --- */
.rate-limit-alert {
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  color: #92400E;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  text-align: center;
  margin: 1rem 0;
  display: none;
}
.rate-limit-alert.visible { display: block; }

/* --- Page Header (inner pages) --- */
.page-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563EB 100%);
  padding: 4rem 0;
  text-align: center;
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.page-header h1 {
  color: var(--white);
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.page-header p {
  color: rgba(255,255,255,0.8);
  font-size: 1.1rem;
}
.page-header-bg {
  position: absolute;
  inset: 0;
  opacity: 0.1;
  background-size: cover;
  background-position: center;
}

/* --- Two Column Layout --- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.two-col img {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* --- Region/Dept/City Grid --- */
.location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.location-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.2rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  transition: var(--transition);
  text-decoration: none;
  color: var(--gray-800);
}
.location-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  color: var(--blue);
}
.location-card .count {
  background: var(--blue-light);
  color: var(--blue);
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: auto;
}

/* --- Admin --- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table th {
  background: var(--gray-100);
  padding: 0.8rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--gray-200);
}
.admin-table td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--gray-100);
}
.admin-table tr:hover { background: var(--gray-50); }
.admin-actions {
  display: flex;
  gap: 0.5rem;
}
.admin-actions a, .admin-actions button {
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  border: 1px solid;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .fiche { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  .hero h1 { font-size: 2.2rem; }
  .hero { min-height: 70vh; }
  
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem;
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  
  .navbar-search { max-width: 100%; order: 3; flex-basis: 100%; }
  .navbar-inner { flex-wrap: wrap; }
  
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat-number { font-size: 2.2rem; }
  
  .section { padding: 3rem 0; }
}

@media (max-width: 480px) {
  .mediator-item { flex-direction: column; align-items: flex-start; }
  .stats { grid-template-columns: 1fr; }
  .hero-search button { position: static; transform: none; width: 100%; margin-top: 0.5rem; border-radius: 50px; }
  .hero-search { display: flex; flex-direction: column; }
}
