/* ========================================
   Site Mairie - Styles publics
   ======================================== */

/* Variables */
:root {
  --primary: #1a3a5c;
  --primary-light: #2a5a8c;
  --primary-dark: #0f2540;
  --accent: #c8a84e;
  --accent-light: #e8d08e;
  --bg: #f8f9fa;
  --bg-alt: #eef1f5;
  --text: #2c3e50;
  --text-light: #6c7a89;
  --white: #ffffff;
  --border: #dde2e8;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #3498db;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --transition: 0.2s ease;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

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

/* Bannière d'alerte */
.alert-banner {
  background: var(--warning);
  color: #333;
  padding: 12px 20px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  position: relative;
}

.alert-banner .close-alert {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #333;
  padding: 4px 8px;
}

/* Header */
.site-header {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  background: var(--primary-dark);
  padding: 6px 0;
  font-size: 0.85rem;
}

.header-top .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-top a {
  color: rgba(255,255,255,0.8);
  font-size: 0.85rem;
}

.header-top a:hover {
  color: var(--white);
}

.header-main {
  padding: 16px 0;
  position: relative;
}

.header-main .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--white);
}

.site-logo .logo-icon {
  width: 50px;
  height: 50px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  flex-shrink: 0;
}

.site-logo .logo-img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--accent);
  background: var(--white);
}

.site-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
}

.site-logo .subtitle {
  font-size: 0.8rem;
  opacity: 0.8;
  font-weight: 400;
}

/* Navigation */
.main-nav ul {
  display: flex;
  list-style: none;
  gap: 4px;
}

.main-nav a {
  color: rgba(255,255,255,0.9);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
}

.nav-toggle {
  display: none;
  background: none;
  border: 2px solid rgba(255,255,255,0.5);
  color: var(--white);
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.2rem;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  padding: 60px 0;
  text-align: center;
}

.hero h2 {
  font-size: 2.2rem;
  margin-bottom: 12px;
  font-weight: 700;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 700px;
  margin: 0 auto;
}

/* Hero avec image de fond - page accueil */
.hero-image {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
}

.hero-image .hero-bg {
  position: absolute;
  top: -20%;
  left: 0;
  width: 100%;
  height: 140%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  will-change: transform;
  z-index: 0;
  animation: heroZoomIn 1.2s ease-out forwards;
}

@keyframes heroZoomIn {
  from {
    transform: scale(1.08);
    opacity: 0.7;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.hero-image .hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 58, 92, 0.65);
  z-index: 1;
}

.hero-image .hero-content {
  position: relative;
  z-index: 2;
  padding: 80px 20px;
  text-align: center;
  color: var(--white);
  max-width: var(--max-width);
  width: 100%;
  animation: heroFadeUp 0.8s ease-out 0.3s both;
}

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

.hero-image .hero-content h2 {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 16px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
  letter-spacing: -0.5px;
}

.hero-image .hero-content p {
  font-size: 1.2rem;
  max-width: 650px;
  margin: 0 auto;
  text-shadow: 0 1px 10px rgba(0,0,0,0.3);
  line-height: 1.7;
}

.hero-image .hero-content .hero-cta {
  margin-top: 30px;
}

.hero-image .hero-content .btn {
  text-shadow: none;
}

/* Hero sans image (fallback dégradé bleu) */
.hero-image.no-image .hero-bg {
  display: none;
}

.hero-image.no-image .hero-overlay {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.hero-image.no-image .hero-content h2,
.hero-image.no-image .hero-content p {
  text-shadow: none;
}

@media (max-width: 1024px) {
  .hero-image {
    min-height: 350px;
  }

  .hero-image .hero-content h2 {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .hero-image {
    min-height: 300px;
  }

  .hero-image .hero-content {
    padding: 50px 20px;
  }

  .hero-image .hero-content h2 {
    font-size: 1.8rem;
  }

  .hero-image .hero-content p {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .hero-image {
    min-height: 280px;
  }

  .hero-image .hero-content h2 {
    font-size: 1.5rem;
  }
}

/* Sections */
.section {
  padding: 50px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: 1.6rem;
  color: var(--primary);
  margin-bottom: 30px;
  text-align: center;
  font-weight: 700;
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--accent);
  margin: 12px auto 0;
  border-radius: 2px;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card h3 {
  font-size: 1.2rem;
  color: var(--primary);
  margin-bottom: 12px;
}

/* Grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}

/* Accueil - accès rapide */
.quick-access {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.quick-access-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  border: 2px solid transparent;
}

.quick-access-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.quick-access-card .icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.quick-access-card h3 {
  font-size: 1.05rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.quick-access-card p {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* Mot du maire */
.maire-section {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.maire-photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--bg-alt);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--primary);
  border: 4px solid var(--accent);
}

img.maire-photo-img {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 4px solid var(--accent);
}

.maire-content h3 {
  color: var(--primary);
  font-size: 1.3rem;
  margin-bottom: 5px;
}

.maire-content .maire-name {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 15px;
  display: block;
}

/* Infos pratiques */
.info-box {
  background: var(--white);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 24px;
  margin-bottom: 20px;
}

.info-box h3 {
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.info-box p {
  margin-bottom: 6px;
  color: var(--text);
}

/* Conseil municipal */
.council-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.council-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

.council-card:hover {
  box-shadow: var(--shadow-lg);
}

.council-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 16px;
  display: block;
  border: 3px solid var(--accent);
}

.council-photo-default {
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--primary);
}

.council-card h3 {
  font-size: 1.05rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.council-role {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.council-desc {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 1.5;
}

.info-box .label {
  font-weight: 600;
  color: var(--primary);
}

/* Actualités */
.news-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.news-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

.news-card:hover {
  box-shadow: var(--shadow-lg);
}

.news-card-body {
  padding: 20px;
}

.news-card .news-date {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

.news-card h3 {
  font-size: 1.05rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.news-card p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.5;
}

/* Boutons */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  line-height: 1.4;
}

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

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

.btn-accent {
  background: var(--accent);
  color: var(--primary-dark);
}

.btn-accent:hover {
  background: var(--accent-light);
  color: var(--primary-dark);
}

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

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

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

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

/* Formulaire état civil */
.form-section {
  max-width: 800px;
  margin: 0 auto;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.95rem;
}

.form-group label .required {
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--transition);
  background: var(--white);
  color: var(--text);
}

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

/* Fix inputs sur iOS Safari */
select.form-control,
input.form-control,
textarea.form-control {
  font-size: 16px; /* empêche le zoom auto sur iOS */
}

.form-control.error {
  border-color: var(--danger);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.form-help {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 4px;
}

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.form-group.has-error .form-error {
  display: block;
}

.form-group.has-error .form-control {
  border-color: var(--danger);
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.form-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.form-fieldset {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 30px;
}

.form-fieldset legend {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
  padding: 0 10px;
}

/* Messages flash */
.flash-message {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-weight: 500;
}

.flash-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.flash-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Page commune */
.commune-intro {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text);
  max-width: 800px;
}

.commune-history {
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin: 30px 0;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.service-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
}

.service-card .icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.service-card h3 {
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.service-card p {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Galerie */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 30px;
}

.gallery-item {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 4/3;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* FAQ */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  background: var(--white);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.faq-question {
  padding: 18px 24px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--transition);
}

.faq-question:hover {
  background: var(--bg-alt);
}

.faq-question::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--primary);
  transition: transform var(--transition);
}

.faq-item.open .faq-question::after {
  content: '−';
}

.faq-answer {
  padding: 0 24px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.open .faq-answer {
  padding: 0 24px 18px;
  max-height: 500px;
}

/* Footer */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.85);
  padding: 50px 0 20px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}

.footer-col h3 {
  color: var(--accent);
  margin-bottom: 16px;
  font-size: 1.05rem;
}

.footer-col p {
  margin-bottom: 8px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer-col a {
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 20px;
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Confirmation */
.confirmation-box {
  text-align: center;
  padding: 60px 30px;
}

.confirmation-box .icon {
  font-size: 4rem;
  color: var(--success);
  margin-bottom: 20px;
}

.confirmation-box h2 {
  color: var(--primary);
  margin-bottom: 12px;
}

.confirmation-box .reference {
  background: var(--bg-alt);
  display: inline-block;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary);
  margin: 16px 0;
}

/* Responsive */
/* Tablette + mobile */
@media (max-width: 1025px) {
  .nav-toggle {
    display: block;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
  }

  .main-nav.open {
    display: block;
  }

  .main-nav ul {
    flex-direction: column;
  }

  .main-nav a {
    display: block;
    padding: 12px 16px;
  }

  .hero h2 {
    font-size: 1.6rem;
  }

  .hero p {
    font-size: 1rem;
  }

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

  .form-row {
    grid-template-columns: 1fr;
  }

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

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

  .header-top {
    display: none;
  }
}

@media (max-width: 768px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  .maire-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .maire-photo, img.maire-photo-img {
    width: 140px;
    height: 140px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .section {
    padding: 35px 0;
  }

  .card {
    padding: 20px;
  }

  .news-list {
    grid-template-columns: 1fr;
  }

  .council-grid {
    grid-template-columns: 1fr;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }

  .quick-access {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 40px 0;
  }

  .hero h2 {
    font-size: 1.4rem;
  }

  .btn-lg {
    padding: 14px 28px;
    font-size: 0.95rem;
  }
}

/* Print */
@media print {
  .site-header, .site-footer, .alert-banner, .nav-toggle {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .card, .section {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
