/* --------------------
   Base mobile-first
-------------------- */
html, body {
    margin:0;
    padding:0;
    font-family: Arial, sans-serif;
    background: #f7f7f7;
    font-size:12px;
    width:100%;
}

header {
    text-align: center;
    padding: 0.5em 0;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    font-weight: bold;
    font-size: 1rem;
}

.agenda-wrapper {
    width: 100%;
    overflow-x: hidden;
    padding: 0;
    margin: 0;
}

/* --------------------
   Grid / tableau
-------------------- */
.grid {
    display: grid;
    grid-template-columns: 3em repeat(3, 1fr); /* Jour + 3 mois */
    width: 100%;
    outline: 3px solid red;
    gad: 0;
}

/* Entêtes */
.head {
    text-align: center;
    font-weight: bold;
    padding: 0.5em 0;
    background: #eee;
    border-bottom: 1px solid #ccc;
    font-size: 1.4rem;
}

/* Colonne Jour */
.day {
    text-align: center;
    font-weight: bold;
    padding: 0.5em 0;
    border-bottom: 1px solid #ddd;
    font-size: 1.2rem;
}

/* Cellules mois */
.cell {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.3em 0.2em;
    min-height: 2.7rem; /* suffisant pour 2 lignes */
    font-size: 1.4rem; /* très lisible sur mobile */
    cursor: default;
    overflow: hidden;
    border-bottom:1px solid #fff;
}

.cell[data-clickable="1"] {
    cursor: pointer;
}

.event-block {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.event-meta {
    display: flex;
    align-items: center;
    gap: 0.4em;
    font-size: 1.1rem;
    margin-bottom: 0.2em;
}

/* Initiale à gauche */
.day-initial {
    font-weight: bold;
}

.day-initial.sunday {
    color: #c00;
}

/* Ligne de l'événement */
.event-title {
    flex: 1 1 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}
/*
.event-time {
    font-size: 0.75rem; /* légèrement plus petit que titre pour lisibilité */
    color: #333;
}
*/

.event-time {
    white-space: nowrap;
    opacity: 0.9;
}

/*
.event-name {
	font-size: 1.1rem;
	color: #000;
	background: inherit;
	text-wrap: nowrap;
	border-radius: 0.5rem;
	padding: 0.1rem 0.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
*/
.event-name {
    width: 100%;
    padding: 0.1em 0.4em;
    border-radius: 0.4em;
    font-weight: 600;
    text-align: center;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Puces à droite */
.dots {
    flex: 0 0 auto;
    display: flex;
    gap: 1px;
}

.dots i {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
}

/* Couleurs des mois */
.month1 { background: #fff9c4; }
.month2 { background: #c8e6c9; }
.month3 { background: #bbdefb; }

/* Jour courant */
.today { background: #ffe0b2; }

/* Initiale dimanche en rouge */
/*
.cell[data-date] .day-initial:first-child {
    color: red;
}
*/

/* Popup */
#overlay {
    display: none;
    position: fixed;
    top:0; left:0; right:0; bottom:0;
    background: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
    z-index: 999;
}

#popup {
    background: #fff;
    padding: 0.5em;
    max-width: 95%;
    max-height: 90%;
    overflow-y: auto;
    font-size:1.2rem;
    border-radius: 0.3em;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

#close {
    position: absolute;
    top: 0.3em;
    right: 0.3em;
    border: none;
    background: transparent;
    font-size: 1.5em;
    cursor: pointer;
}

/* Desktop */
@media(min-width: 768px){
    .agenda-wrapper {
        display: flex;
        justify-content: center;
        padding: 1em 0;
    }
    .grid {
        max-width: 900px;
        grid-template-columns: 3em repeat(3, 1fr);
    }
    .cell {
        font-size: 24px;
        min-height: 4em;
    }
}

