.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#current-month {
    margin: 0;
    font-size: 24px;
    color: {{ site.colors.primary }};
}

#calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #bbb;
    border: 1px solid #bbb;
}

.calendar-day {
    background-color: white;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #ccc;
    position: relative;
    cursor: pointer;
}

.calendar-day:hover {
    filter: brightness(0.9);
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.calendar-day.other-month {
    background-color: #f9f9f9;
    color: #999;
}

.calendar-day.other-month:hover {
    background-color: #eeeeee !important;
    filter: none;
}


.calendar-day.has-event:after {
    content: '';
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background-color: {{ site.colors.primary }};
    border-radius: 50%;
}

/* Verde claro para días de cursada - lower priority than events */
.calendar-day.period-lectures {
    background-color: #c8f5c8;
}
.calendar-day.period-lectures:hover {
    background-color: #b0e6b0;
    filter: none;
}

/* Rojo claro para semanas de evaluaciones integradoras - lower priority than events */
.calendar-day.period-exams {
    background-color: #ffcdd2;
}
.calendar-day.period-exams:hover {
    background-color: #ffb3ba;
    filter: none;
}

/* Violeta para días de eventos especiales - lower priority than events */
.calendar-day.period-special {
    background-color: #e1bee7;
}
.calendar-day.period-special:hover {
    background-color: #d1a3d8;
    filter: none;
}

/* Holidays take highest precedence - bright red with gold border */
.calendar-day.holiday {
    background-color: #ffecb3 !important;
    border: 1px solid #ff9800 !important;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.5) !important;
}
.calendar-day.holiday:hover {
    background-color: #ffd54f !important;
    filter: none;
}

/* Events take precedence over periods */
.calendar-day.has-event {
    background-color: #c5e3fd !important;
}
.calendar-day.has-event:hover {
    background-color: #a3d1f7 !important;
    filter: none;
}

/* Cancelled event styling */
.calendar-day.cancelled-event {
    background-color: #ffcdd2 !important;
    position: relative;
}

.calendar-day.cancelled-event:hover {
    background-color: #ffb3ba !important;
    filter: none;
}

.calendar-day.cancelled-event::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background-color: #f44336;
    transform: rotate(-15deg);
    z-index: 1;
}

.calendar-day.cancelled-event .day-number {
    text-decoration: line-through;
    opacity: 0.7;
}

/* Special event highlighting */
.calendar-day.special-event {
    border: 2px solid #9c27b0;
    box-shadow: 0 0 5px rgba(156, 39, 176, 0.3);
}
.calendar-day.special-event:after {
    background-color: #9c27b0;
    width: 10px;
    height: 10px;
}

.day-number {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.event-preview {
    font-size: 11px;
    color: {{ site.colors.secondary }};
    line-height: 1.2;
    margin-top: 5px;
}

.holiday-preview {
    font-size: 10px;
    color: #e65100;
    font-weight: bold;
    line-height: 1.2;
    margin-top: 5px;
    text-align: center;
}

.event-details {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.event-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

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

.close:hover {
    color: #333;
}

.event-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.event-type.workshop { background-color: #4caf50; color: white; }
.event-type.competition { background-color: #ff9800; color: white; }
.event-type.lecture { background-color: #2196f3; color: white; }
.event-type.hackathon { background-color: #9c27b0; color: white; }
.event-type.meeting { background-color: #607d8b; color: white; }
.event-type.presentation { background-color: #e91e63; color: white; }
.event-type.exam { background-color: #f44336; color: white; }

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #2c3e50;
    margin-bottom: 1px;
}

.weekday {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: bold;
}

/* Tooltip styles */
.calendar-tooltip {
    position: absolute;
    background-color: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.calendar-tooltip.show {
    opacity: 1;
}

.calendar-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
}

.period-info {
    background-color: #f0f0f0;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    border-left: 4px solid {{ site.colors.primary }};
}

.holiday-info {
    background-color: #fff3e0;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 6px solid #ff9800;
    text-align: center;
    font-size: 16px;
}

.special-badge {
    display: inline-block;
    background-color: #9c27b0;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 5px;
}

/* Mobile responsiveness - fit to screen */
@media (max-width: 768px) {
    .calendar-day {
        min-height: 60px;
        padding: 4px;
    }

    .weekday {
        padding: 8px 4px;
        font-size: 12px;
    }

    .day-number {
        font-size: 12px;
        margin-bottom: 2px;
    }

    .event-preview {
        font-size: 8px;
        line-height: 1.0;
        margin-top: 2px;
    }

    .calendar-header {
        margin-bottom: 10px;
    }

    #current-month {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .calendar-day {
        min-height: 50px;
        padding: 2px;
    }

    .weekday {
        padding: 6px 2px;
        font-size: 10px;
    }

    .day-number {
        font-size: 11px;
        margin-bottom: 1px;
    }

    .event-preview {
        font-size: 7px;
        line-height: 1.0;
        margin-top: 1px;
    }

    #current-month {
        font-size: 16px;
    }
}
