/* ===== Styles généraux ===== */
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
}

/* ===== Carrousel ===== */
.photo-header {
  position: relative;
  overflow: hidden;
}

.photo-track {
    display: flex;
    width: 200%;
    animation: scroll 60s linear infinite;
}

.photo-track img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: inline-block;
}

.carousel-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-weight: bold;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
  background: rgba(0,0,0,0.3);
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  z-index: 10;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90%;
  font-size: clamp(1rem, 5vw, 2rem);
}

@media (max-width: 768px) {
  .carousel-text {
    font-size: 1.2rem;  
    padding: 0.3rem 0.6rem;
  }
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ===== Menu principal ===== */
nav ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

nav li.menu {
    position: relative;
}

nav li.menu > a {
    display: block;
    padding: 1rem;
    color: white;
    font-weight: 600;
}

nav li.menu ul {
    display: none;
    position: absolute;
    top: 100%;
    background-color: #0a9396;
    min-width: 200px;
    z-index: 100;
    flex-direction: column;
}

nav li.menu.open ul {
    display: flex;
}

nav li.menu ul li a {
    padding: 0.5rem 1rem;
    display: block;
    color: white;
}

/* Social contact */
.social-contact {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.5rem 1rem;
}

.social-contact img {
    width: 24px;
    height: 24px;
}

/* ===== Blocs info ===== */
.info-blocks {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
}

/* Trois blocs alignés */
.contact-block, .calendar-block, .events-block {
    background-color: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    flex: 1 1 30%;
    min-width: 250px;
    box-sizing: border-box;
}

/* Photos */
.img-maire, .img-mairie-batiment {
    width: 50%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* ===================== CALENDRIER ===================== */
#calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    width: 100%;
}

/* Chaque jour */
.calendar-day {
    background:#e8f0f5;
    border-radius:6px;
    padding:0.2rem 0.2rem;
    min-height:41px;
    height:41px;
    font-size:0.75rem;
    position:relative;
    cursor:pointer;
    overflow:visible;
    display:flex;
    flex-direction:column;
    justify-content: flex-start;
}

.calendar-block {
    overflow: visible;
}

/* Texte des événements dans le calendrier */
.calendar-day .event span {
    display: block;
    white-space: nowrap;   /* Pas de retour à la ligne */
    overflow: hidden;      /* Coupe le texte qui dépasse */
    text-overflow: ellipsis; /* Affiche "..." si trop long */
    max-width: 100%;       /* Ne dépasse pas la case */
}

#calendar * {
    min-width: 0;
}

.calendar-block select {
    max-width: 100%;
}

.calendar-day:hover {
    background: #d0e4f0;
    transform: scale(1.02);
    z-index: 2;
}

.calendar-block h3 {
    color: #2c3e50;
}

/* Numéro du jour */
.calendar-day .day-number {
    font-weight: bold;
    margin-bottom: 0.1rem;
    color: #2c3e50;
}

/* Aujourd'hui */
.calendar-day.today .day-number {
    color: #2c3e50;
}

/* Conteneur d'événements */
.calendar-day .events-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 22px;
}

/* Événements */
.calendar-day .event {
    position: relative;
    background: #2c3e50;
    color: #fff;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.65rem;
    line-height: 1;
    min-height: 10px;
    display: flex;
    align-items: center;
    cursor: pointer;
    white-space: nowrap;
    text-overflow: ellipsis;   /* ✅ ajoute "..." */
    overflow: visible;            /* visible */
    flex-direction: row; /* ou column si tu veux empiler texte et popup */        
   
}

/* Popup */
.calendar-day .event-popup {
    display: none;         /* Par défaut caché */
    position: absolute;
    top: 110%;
    left: 0;
    background: #4ca1af;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    width: max-content;
    max-width: 250px;      /* Limite la largeur */
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    z-index: 9999;
    white-space: normal;   /* Texte multi-lignes si besoin */
    word-wrap: break-word;
}

.calendar-day .event span.event-text {
    display: block;
    max-width: 100%;  /* limite la largeur à la case */
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden; /* ellipsis fonctionne */
}

.calendar-day .event:hover .event-popup {
    display: block;
}

/* Jours de la semaine (header) */
.calendar-day.header-day {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #2c3e50;
    color: #fff;
    font-weight: bold;
    font-size: 0.85rem;
    height: 30px;
    border-radius: 6px 6px 0 0;
}

.calendar-day .event.past {
    background:#888;
    color:#eee;
}

.calendar-day.today {
    background:#cce7ff;
    border:2px solid #f39c12;
}
/* ===== Vignettes événements à venir horizontales ===== */
.events-block .event-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #fff;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    position: relative; /* nécessaire pour popup */
}

.events-block .event-preview:hover {
    transform: translateY(-2px);
}

.events-block .event-preview img {
    width: 100px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.events-block .event-preview-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.events-block .event-preview-text strong {
    font-size: 0.95rem;
    color: #2196f3;
}

.events-block .event-preview-text small {
    font-size: 0.75rem;
    color: #555;
}

/* ===== Popup événement (fonction au clic) ===== */
.events-block .event-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.97);
    color: #333;
    padding: 0.5rem;
    border-radius: 6px;
    width: 220px;
    max-width: calc(100% - 10px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    font-size: 0.75rem;
    overflow-wrap: break-word;
}

/* ===== Cars bleus ===== */
.cars-bleus {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 0;
}

.cars-bleus .car-item {
    text-align: center;
}

.cars-bleus .car-item img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
}

.car-text {
    margin-top: 0.5rem;
}

/* ===== Actualités ===== */
.home-section {
    margin: 2rem;
}

.news-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.news-item {
    background-color: white;
    flex: 1 1 30%;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.news-image img {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.news-text button {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background-color: #005f73;
    color: white;
    border-radius: 5px;
    transition: background 0.3s;
}

.news-text button:hover {
    background-color: #0a9396;
}

/* ===== Événements ===== */
.events-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.event-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    flex: 1 1 22%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.event-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.event-info {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.event-info button {
    margin-top: auto;
    padding: 0.4rem 0.8rem;
    background: #4ca1af;
    color: #fff;
    border-radius: 6px;
    font-size: 0.75rem;
    transition: background 0.3s;
}

.event-info button:hover {
    background: #3b8f98;
}

/* ===== Modals ===== */
#modal-bg {
    display: none;
    position: fixed;
    top:0; left:0;
    width:100%; height:100%;
    background: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

#modal-bg > div {
    background: #fff;
    padding: 1rem;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90%;
    overflow: auto;
    position: relative;
    text-align: center;
}

#modal-bg span {
    position: absolute;
    top:10px; right:15px;
    cursor:pointer;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Footer */
.footer-bar, .footer-counter {
    text-align: center;
    padding: 1rem;
    background-color: #005f73;
    color: white;
    font-weight: bold;
}

/* ===== Responsive ===== */
@media screen and (max-width: 1024px) {
    .contact-block, .calendar-block, .events-block {
        flex: 1 1 100%;
    }
}

.top-bar {
    display: flex;
    align-items: center;          
    justify-content: space-between; 
    padding: 0.5rem 1rem;
    background-color: #4ca1af;
    color: #fff;
    flex-wrap: wrap;
}

.top-menu ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.top-menu ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    transition: background 0.3s;
}

.top-menu ul li a:hover {
    background-color: #007f8f;
}

.contact-facebook {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.contact-facebook .contact,
.contact-facebook .facebook {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-facebook a img {
    width: 24px;
    height: 24px;
}

@media screen and (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    .top-menu ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0.8rem 1rem;
        width: 100%;
        justify-content: flex-start;
        margin: 0;
        padding: 0;
    }

    .top-menu ul li {
        flex: 1 1 auto;
    }

    .top-menu ul li a {
        display: block;
        text-align: center;
        padding: 0.6rem 0.8rem;
        background-color: #007f8f;
        color: #fff;
        font-weight: bold;
        border-radius: 6px;
        transition: background 0.3s, transform 0.2s;
    }

    .top-menu ul li a:hover {
        background-color: #0099a6;
        transform: translateY(-2px);
    }

    .contact-facebook {
        display: flex;
        gap: 1rem;
        margin-top: 0.5rem;
        flex-wrap: wrap;
    }

    .contact-facebook a img {
        width: 20px;
        height: 20px;
    }
}

.events-footer {
    margin-top: 1rem;
    text-align: right;
}

.events-footer a {
    font-weight: 600;
    color: #2196f3;
    text-decoration: none;
    transition: color 0.3s, transform 0.2s;
}

.events-footer a:hover {
    color: #0a9396;
    text-decoration: underline;
    transform: translateY(-2px);
}























/* ===== MODAL ÉVÉNEMENTS À VENIR ===== */

/* Fond sombre */
#modal-bg {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

/* Boîte principale */
.modal-content {
    background: #fff;
    padding: 1rem;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90%;
    overflow: auto;
    position: relative;
    text-align: center;
}

/* Bouton fermeture (croix) */
.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Image événement */
#modal-img {
    max-width: 100%;
    margin: 1rem 0;
    border-radius: 12px;
}

/* Texte événement */
#modal-text {
    text-align: justify;
    color: #333;
}

/* Bouton Fermer */
.modal-btn {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #4ca1af;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.modal-btn:hover {
    background: #3b8f98;
}


.contact-btn{
    display:inline-block;
    margin-top:0.8rem;
    padding:0.4rem 0.8rem;
    background:#4ca1af; /* bleu clair */
    color:#fff !important;
    text-decoration:none;
    border-radius:8px;
    font-weight:bold;
    transition: background 0.3s ease;
}
.contact-btn:hover{
    background:#3b8f98; /* couleur hover légèrement plus foncée */
}