/* =========================
   Calendrier Elementor - Base
   ========================= */

.calev-calendar {
    position: relative;
    width: 100%;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-family: inherit;
    overflow: hidden;
    box-sizing: border-box;
}

.calev-calendar *,
.calev-calendar *:before,
.calev-calendar *:after {
    box-sizing: border-box;
}

/* ---- Loading ---- */
.calev-calendar__loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 24px;
    border-radius: 4px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ---- Loading de la boucle ---- */
.calev-loop-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 120px;
    background: rgba(255, 255, 255, 0.85);
    grid-column: 1 / -1;
}

.calev-loop-loading__spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e5e5;
    border-top-color: #2c7be5;
    border-radius: 50%;
    animation: calev-spin 1s linear infinite;
}

@keyframes calev-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Header ---- */
.calev-calendar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e5e5;
}

.calev-calendar__month-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    text-transform: capitalize;
}

.calev-calendar__nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calev-calendar__nav button,
.calev-calendar__today {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    min-width: 36px;
    min-height: 36px;
}

.calev-calendar__nav button:hover,
.calev-calendar__today:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

.calev-calendar__nav button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.calev-calendar__reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    background: #2c7be5;
    border: 1px solid #2c7be5;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    min-height: 36px;
}

.calev-calendar__reset:hover {
    background: #1a5bb5;
    border-color: #1a5bb5;
}

.calev-loop--filtered .e-loop-item {
    transition: opacity 0.2s ease;
}

/* ---- Weekdays ---- */
.calev-calendar__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid #e5e5e5;
}

.calev-calendar__weekday {
    padding: 12px 4px;
    text-align: center;
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* ---- Days Grid ---- */
.calev-calendar__days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    gap: 1px;
}

.calev-calendar__day {
    position: relative;
    min-height: 100px;
    padding: 8px;
    background: #fff;
    border: 1px solid #eee;
    cursor: default;
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
}

.calev-calendar__day--other-month {
    background: #fafafa;
}

.calev-calendar__day--other-month .calev-calendar__day-number {
    color: #bbb;
}

.calev-calendar__day--today {
    background: #fff9e6;
}

.calev-calendar__day--today .calev-calendar__day-number {
    font-weight: 700;
    color: #e69c00;
}

.calev-calendar__day--has-event {
    cursor: pointer;
}

.calev-calendar__day--has-event:hover {
    background: #f0f7ff;
    transform: scale(1.01);
    z-index: 1;
}

.calev-calendar__day--selected {
    background: #e6f0ff;
    border-color: #2c7be5;
}

.calev-calendar__day--selected .calev-calendar__day-number {
    font-weight: 700;
    color: #2c7be5;
}

.calev-calendar__day-number {
    font-size: 1rem;
    color: #333;
    line-height: 1.2;
}

.calev-calendar__events {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    width: 100%;
}

.calev-calendar__event-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #2c7be5;
    border-radius: 50%;
    flex-shrink: 0;
}

.calev-calendar__event-count {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.75rem;
    color: #888;
    background: rgba(240, 240, 240, 0.8);
    padding: 2px 5px;
    border-radius: 10px;
    line-height: 1;
}

/* ---- Tooltip ---- */
.calev-tooltip {
    position: absolute;
    z-index: 1000;
    max-width: 280px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 12px;
}

.calev-tooltip__item {
    margin-bottom: 10px;
}

.calev-tooltip__item:last-child {
    margin-bottom: 0;
}

.calev-tooltip__title {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.calev-tooltip__date {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 6px;
}

.calev-tooltip__link {
    display: inline-block;
    font-size: 0.85rem;
    color: #2c7be5;
    text-decoration: underline;
}

/* ---- Modal ---- */
.calev-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calev-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.calev-modal__content {
    position: relative;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    z-index: 1;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.calev-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: #555;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.calev-modal__close:hover {
    background: #e0e0e0;
}

.calev-modal__close svg {
    width: 24px;
    height: 24px;
    display: block;
}

.calev-modal__item {
    margin-bottom: 20px;
}

.calev-modal__item:last-child {
    margin-bottom: 0;
}

.calev-modal__image {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 14px;
}

.calev-modal__title {
    margin: 0 0 6px 0;
    font-size: 1.3rem;
    color: #333;
}

.calev-modal__date {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 10px;
}

.calev-modal__desc {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 12px;
}

.calev-modal__link {
    display: inline-block;
    padding: 10px 18px;
    background: #2c7be5;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.calev-modal__link:hover {
    background: #1a5bb5;
}

/* ---- Shortcode événements du jour ---- */
.calev-jour-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.calev-jour-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.calev-jour-image {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 12px;
}

.calev-jour-title {
    margin: 0 0 6px 0;
    font-size: 1.2rem;
    color: #333;
}

.calev-jour-date {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    color: #888;
}

.calev-jour-desc {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 12px;
}

.calev-jour-link {
    display: inline-block;
    padding: 8px 14px;
    background: #2c7be5;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.calev-jour-link:hover {
    background: #1a5bb5;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .calev-calendar__day {
        min-height: 60px;
        padding: 4px;
    }

    .calev-calendar__day-number {
        font-size: 0.85rem;
    }

    .calev-calendar__weekday {
        font-size: 0.7rem;
        padding: 8px 2px;
    }

    .calev-calendar__header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .calev-calendar__month-title {
        font-size: 1.1rem;
    }
}

/* ---- Masquage initial de la boucle en filtre par mois ---- */
.calev-loop--month-filter-loading .e-loop-item {
    display: none;
}
