body {
    margin: 0;
    font-family: 'Arial', sans-serif;
    background-color: #0f0b1c;
    color: white;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: auto;
    overflow-y: auto;
}

/* ✅ Correction pour éviter les débordements */
body, html {
    overflow-x: hidden;
}

header {
    background: #1a1033;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s ease;
    z-index: 1000;
    position: sticky;
    top: 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.controls button {
    padding: 0.5rem;
    background: #5b3fc3;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
}

#main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#map {
    flex: 1;
    height: 100%;
    transition: height 0.3s ease;
}

.sidebar {
    width: 350px;
    background: #1a1033;
    overflow-y: auto;
    padding: 1rem;
    /* ✅ Correction */
    box-sizing: border-box;
    max-width: 100vw;
    overflow-x: hidden;
}

.sidebar h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.search-bar {
    margin-bottom: 1rem;
}

.search-bar input {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: none;
    font-size: 0.95rem;
    /* ✅ Correction */
    box-sizing: border-box;
}

.event {
    background: #2a1f4b;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    /* ✅ Correction */
    box-sizing: border-box;
    width: 100%;
}

.event:hover {
    border-color: #5b3fc3;
    background-color: #34275f;
}

.event.active {
    border-color: #f88b29;
    background-color: #3b2c6e;
    transform: scale(1.02);
}

.event h3 {
    margin: 0 0 0.5rem;
}

.event p {
    margin: 0.4rem 0;
    font-size: 0.92rem;
    line-height: 1.4;
}

.event .voir-carte-btn {
    margin-top: 0.6rem;
    background: #f88b29;
    border: none;
    border-radius: 6px;
    color: white;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.event img {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

/* FOOTER */
footer {
    background: #1a1033;
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
}

.socials a {
    margin: 0 15px;
    color: #fff;
    display: inline-block;
}

.socials img {
    width: 32px;
    height: 32px;
    transition: transform 0.3s ease;
}

.socials img:hover {
    transform: scale(1.2);
}

/* Bouton bal */
.event-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap; /* pour que sur mobile ça passe en ligne suivante proprement */
}

.event-actions button, 
.event-actions .share-buttons button {
    background: #5b3fc3;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.95rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.event-actions button:hover, 
.event-actions .share-buttons button:hover {
    background: #7a5de4;
    transform: scale(1.05);
}

.share-buttons {
    display: flex;
    gap: 0.4rem;
}

/* ----------- Responsive ----------- */

@media (max-width: 768px) {
    #main {
        flex-direction: column;
    }

    #map {
        width: 100%;
        height: 250px;
        margin: 0;
        padding: 0;
        flex: none;
        display: block;
    }

    .sidebar {
        width: 100%;
        max-height: none;
        height: auto;
        padding: 1rem;
    }

    body {
        overflow: auto;
    }

    .controls {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
    }

    .controls button {
        width: 100%;
    }

    .search-bar input {
        font-size: 1rem;
    }

    .event {
        font-size: 0.95rem;
    }

    .event .voir-carte-btn {
        width: 100%;
        text-align: center;
    }

    footer {
        display: none !important;
    }

    .event-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem;
      }
    
      .event-actions button, 
      .share-buttons button {
        font-size: 0.85rem;
        padding: 0.3rem 0.6rem;
        border-radius: 5px;
      }
    
      .share-buttons {
        gap: 0.3rem;
      }
}

@media (max-width: 480px) {
    .sidebar h2 {
        font-size: 1.1rem;
    }

    .event h3 {
        font-size: 1.1rem;
    }

    header {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .logo {
        font-size: 1rem;
    }

    .controls {
        gap: 0.3rem;
    }

    .controls button {
        padding: 0.3rem 0.6rem;
        font-size: 0.85rem;
    }

    footer {
        display: none !important;
    }
    
    /* .event-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem;
      }
    
      .event-actions button, 
      .share-buttons button {
        font-size: 0.85rem;
        padding: 0.3rem 0.6rem;
        border-radius: 5px;
      }
    
      .share-buttons {
        gap: 0.3rem;
      } */
    .event-actions {
        flex-wrap: nowrap; /* Ne PAS wraper ! */
        justify-content: center;
        gap: 0.3rem;
      }
    
      .event-actions button, 
      .share-buttons button {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        border-radius: 5px;
        min-width: 0; /* Autorise à être compressé */
        flex-shrink: 1; /* Peut se réduire pour tenir */
      }
    
      .share-buttons {
        gap: 0.2rem;
      }
}

/* ----------- Header Hidden Mode corrigé ----------- */
body.header-hidden header {
    display: none;
}

body.header-hidden #main {
    margin-top: 0;
}

body.header-hidden #map {
    position: relative;
    top: 0;
    height: 250px;
    background-color: #0f0b1c;
}