* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 5px;
    padding-bottom: 80px; /* Espace pour le menu en bas */
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 8px;
    padding: 8px;
}

header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 5.4px;
    padding: 4.5px;
}

.month-calendar {
    background: white;
    border-radius: 7.2px;
    padding: 5.4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.month-calendar:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.month-header {
    text-align: center;
    font-size: 0.765rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 3.6px;
    padding-bottom: 3.6px;
    border-bottom: 1px solid #667eea;
    transition: all 0.2s;
    user-select: none;
}

.month-header:hover {
    background-color: rgba(102, 126, 234, 0.1);
    border-radius: 4px;
    transform: scale(1.05);
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1.8px;
    margin-bottom: 3.6px;
}

.weekday {
    text-align: center;
    font-size: 0.54rem;
    font-weight: 600;
    color: #667eea;
    padding: 1.8px;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1.8px;
}

.day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.585rem;
    color: #333;
    border-radius: 3.6px;
    transition: background-color 0.2s;
    cursor: pointer;
}

.day:hover {
    background-color: #f0f0f0;
}

.day.other-month {
    color: #ccc;
    opacity: 0.5;
}

.day.today {
    background-color: #667eea;
    color: white;
    font-weight: 600;
}

.day.has-period {
    background-color: var(--period-color, inherit) !important;
    position: relative;
}

/* Légende globale (en dehors des calendriers) */
.global-legend {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 10.8px;
    margin-top: 13.5px;
    padding: 10.8px;
    background: white;
    border-radius: 7.2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 0.675rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5.4px;
}

.legend-color {
    width: 10.8px;
    height: 10.8px;
    border-radius: 1.8px;
    flex-shrink: 0;
}

.legend-label {
    color: #333;
    white-space: nowrap;
    font-weight: 500;
}

/* Matrice de statistiques */
.stats-matrix {
    grid-column: 1 / -1;
    background: white;
    border-radius: 7.2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 13.5px;
    padding: 10.8px;
    overflow-x: auto;
}

.stats-row {
    display: grid;
    grid-template-columns: 120px repeat(12, 1fr) 50px;
    gap: 1px;
    margin-bottom: 1px;
}

.stats-row:last-child {
    margin-bottom: 0;
}

.stats-cell {
    padding: 6px 4px;
    text-align: center;
    font-size: 0.675rem;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-header .stats-cell {
    background-color: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.stats-label-cell {
    justify-content: flex-start;
    text-align: left;
    padding-left: 8px;
    font-weight: 500;
}

.stats-month-header,
.stats-total-header {
    background-color: #f5f5f5;
    font-weight: 600;
}

.stats-month-cell {
    color: #333;
}

.stats-total-cell {
    background-color: #f9f9f9;
    font-weight: 500;
}

.stats-color-square {
    width: 10.8px;
    height: 10.8px;
    border-radius: 1.8px;
    margin-right: 6px;
    flex-shrink: 0;
}

.stats-totals-row .stats-cell {
    background-color: #f5f5f5;
    font-weight: 600;
}

.stats-bold {
    font-weight: 600;
}

/* Responsive pour très petits écrans */
@media (max-width: 480px) {
    body {
        padding: 2px;
        padding-bottom: 75px;
    }
    
    .notes-section {
        padding: 7.2px;
        margin-top: 9px;
    }
    
    .notes-section label {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    
    .notes-section textarea {
        font-size: 0.8rem;
        padding: 8px;
        min-height: 104px; /* Augmenté de 30% (80px -> 104px) */
    }
    
    header {
        margin-bottom: 2px;
        padding: 4px;
    }
    
    header h1 {
        font-size: 1rem;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.7px;
        padding: 1.8px;
    }
    
    .month-calendar {
        padding: 2.7px;
        border-radius: 5.4px;
    }
    
    .month-header {
        font-size: 0.585rem;
        margin-bottom: 1.8px;
        padding-bottom: 1.8px;
    }
    
    .weekdays {
        gap: 0.9px;
        margin-bottom: 1.8px;
    }
    
    .weekday {
        font-size: 0.45rem;
        padding: 0.9px;
    }
    
    .days {
        gap: 0.9px;
    }
    
    .day {
        font-size: 0.495rem;
        border-radius: 1.8px;
    }
    
    .global-legend {
        gap: 7.2px;
        margin-top: 9px;
        padding: 7.2px;
        font-size: 0.585rem;
    }
    
    .legend-color {
        width: 9px;
        height: 9px;
    }
    
    .stats-matrix {
        padding: 7.2px;
        margin-top: 9px;
    }
    
    .stats-row {
        grid-template-columns: 90px repeat(12, 1fr) 40px;
        gap: 0.5px;
    }
    
    .stats-cell {
        padding: 4px 2px;
        font-size: 0.585rem;
    }
    
    .stats-label-cell {
        padding-left: 4px;
        font-size: 0.55rem;
    }
    
    .stats-color-square {
        width: 8px;
        height: 8px;
        margin-right: 4px;
    }
}

/* Pour les écrans moyens (tablettes) */
@media (min-width: 481px) and (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4.5px;
    }
}

/* Pour les écrans plus grands */
@media (min-width: 769px) {
    .calendar-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 5.4px;
    }
}

@media (min-width: 1200px) {
    .calendar-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 7.2px;
    }
    
    .month-calendar {
        padding: 7.2px;
    }
    
    .month-header {
        font-size: 0.81rem;
    }
    
    .day {
        font-size: 0.63rem;
    }
    
    .global-legend {
        font-size: 0.72rem;
        gap: 13.5px;
        padding: 13.5px;
    }
    
    .legend-color {
        width: 12.6px;
        height: 12.6px;
    }
    
    .stats-matrix {
        padding: 13.5px;
        margin-top: 15px;
    }
    
    .stats-row {
        grid-template-columns: 150px repeat(12, 1fr) 60px;
    }
    
    .stats-cell {
        padding: 8px 6px;
        font-size: 0.75rem;
    }
    
    .stats-label-cell {
        padding-left: 10px;
        font-size: 0.7rem;
    }
    
    .stats-color-square {
        width: 12px;
        height: 12px;
        margin-right: 8px;
    }
}


/* Champ de notes */
.notes-section {
    grid-column: 1 / -1;
    background: white;
    border-radius: 7.2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 13.5px;
    padding: 10.8px;
}

.notes-section label {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.notes-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 130px; /* Augmenté de 30% (100px -> 130px) */
    box-sizing: border-box;
    transition: border-color 0.2s;
    line-height: 1.5;
}

.notes-section textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Sections de notes spécifiques pour Cedric */
.cedric-notes-sections {
    margin-top: 8px;
}

.cedric-notes-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    background-color: #f5f5f5;
    margin-top: 6px;
    user-select: none;
}

.cedric-notes-section-header:hover {
    background-color: #e9e9e9;
}

.cedric-notes-section-icon {
    font-size: 0.8rem;
}

/* Menu de navigation en bas */
.mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e0e0e0;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 8px 0;
    justify-content: space-around;
    align-items: center;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #666;
    padding: 8px 12px;
    transition: color 0.2s;
    flex: 1;
    min-width: 0;
}

.nav-item:active,
.nav-item.active {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ajustements pour les écrans plus grands */
@media (min-width: 769px) {
    .nav-icon {
        font-size: 1.6rem;
    }
    
    .nav-label {
        font-size: 0.75rem;
    }
    
    .nav-item {
        padding: 10px 16px;
    }
}

/* Boutons d'action dans le header */
.add-event-button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.add-event-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.add-event-button:active {
    transform: scale(0.95);
}

.add-event-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.add-event-button:active {
    transform: scale(0.95);
}

@media (max-width: 480px) {
    .add-event-button {
        width: 35px;
        height: 35px;
        font-size: 1.3rem;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.modal-fullscreen {
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content-fullscreen {
    background-color: white;
    margin: 0;
    padding: 20px;
    width: 100%;
    height: 100vh;
    box-shadow: none;
    position: relative;
    overflow-y: auto;
    box-sizing: border-box;
    padding-top: 80px; /* Espace pour le bouton de fermeture */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-large {
    max-width: 700px;
}

.modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 10px;
}

.modal-close:hover,
.modal-close:focus {
    color: #000;
}

/* Modal plein écran pour le mois */
.modal-content-fullscreen .modal-close {
    position: fixed;
    right: 20px;
    top: 20px;
    z-index: 2001;
    font-size: 40px;
    color: white;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
    border: none;
}

.modal-content-fullscreen .modal-close:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Calendrier du mois dans la modal plein écran */
.month-modal-calendar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.month-modal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    margin-bottom: 2px;
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
}

.month-modal-weekday {
    text-align: center;
    font-weight: 600;
    font-size: 1.2rem;
    color: #333;
    padding: 10px;
    box-sizing: border-box;
    min-width: 0;
}

.month-modal-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    width: 100%;
    box-sizing: border-box;
}

.month-modal-day {
    min-height: 120px;
    padding: 8px;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.month-modal-day:hover {
    background-color: #f0f0f0;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.month-modal-day.month-modal-other-month {
    background-color: #fafafa;
    color: #ccc;
    opacity: 0.6;
}

.month-modal-day.month-modal-today {
    background-color: #e3f2fd;
    border: 2px solid #667eea;
    font-weight: 600;
}

.month-modal-day.month-modal-has-period {
    color: white;
    font-weight: 600;
}

.month-modal-day-number {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.month-modal-day-events {
    font-size: 0.85rem;
    line-height: 1.4;
    flex: 1;
    overflow-y: auto;
}

/* Responsive pour la modal plein écran */
@media (max-width: 768px) {
    .month-modal-calendar {
        padding: 10px;
    }
    
    .month-modal-weekdays {
        padding: 8px;
    }
    
    .month-modal-weekday {
        font-size: 0.9rem;
        padding: 8px 4px;
    }
    
    .month-modal-day {
        min-height: 80px;
        padding: 6px;
    }
    
    .month-modal-day-number {
        font-size: 0.9rem;
    }
    
    .month-modal-day-events {
        font-size: 0.75rem;
    }
    
    .modal-content-fullscreen {
        padding: 10px;
    }
    
    .modal-content-fullscreen .modal-close {
        right: 10px;
        top: 10px;
        width: 40px;
        height: 40px;
        font-size: 30px;
    }
    
    #month-modal-content h2 {
        font-size: 1.8rem !important;
        padding: 15px !important;
        margin-bottom: 20px !important;
    }
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: white;
}

.form-group select {
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.form-group input[type="color"] {
    width: 60px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
}

/* Styles pour la liste des lieux */
.location-item {
    transition: background-color 0.2s;
}

.location-item:hover {
    background-color: #eeeeee !important;
}

.location-action-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.location-action-btn:active {
    transform: scale(0.95);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-cancel,
.btn-submit,
.btn-delete {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-cancel {
    background-color: #e0e0e0;
    color: #333;
}

.btn-cancel:hover {
    background-color: #d0d0d0;
}

.btn-submit {
    background-color: #667eea;
    color: white;
}

.btn-submit:hover {
    background-color: #5568d3;
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background-color: #c0392b;
}

/* Ajustements pour très petits écrans */
@media (max-width: 480px) {
    .modal-content {
        margin: 20% auto;
        padding: 15px;
        width: 95%;
    }
    
    .modal-content h2 {
        font-size: 1.2rem;
    }
    
    .form-group input {
        font-size: 0.9rem;
        padding: 8px;
    }
    
    .btn-cancel,
    .btn-submit,
    .btn-delete {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .nav-icon {
        font-size: 1.3rem;
    }
    
    .nav-label {
        font-size: 0.65rem;
    }
    
    .nav-item {
        padding: 6px 8px;
    }
}

