/* ═══════════════════════════════════════════════════════════
   Agenda Calendar — v1.1
   · Días con eventos: punto de color + fondo acentuado
   · Clic en día → panel de detalle debajo del calendario
   ═══════════════════════════════════════════════════════════ */

/* Fallback si el tema no define --primary */
:root {
    /* colores del calendario */
    --ac-color: #cf3d3d;
    --ac-bg: #f0f1e8;
    --ac-bg-hover: #e5e7d4;
}

/* ── Wrapper ──────────────────────────────────────────────── */
.agenda-calendar {
    max-width: 900px;
    margin: 0 auto;
    font-family: inherit;
}

/* ── Cabecera (mes + navegación) ──────────────────────────── */
.agenda-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.agenda-calendar-title {
    margin: 0;
    font-size: 1.4em;
    text-transform: capitalize;
}
.agenda-calendar-prev,
.agenda-calendar-next {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1.4em;
    line-height: 1;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.agenda-calendar-prev:hover,
.agenda-calendar-next:hover {
    background: #f0f0f0;
}

/* ── Wrapper único para cabecera días + celdas (alineación garantizada) ── */
.agenda-calendar-grid-wrap {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0 4px;
}

/* ── Días de la semana ────────────────────────────────────── */
.agenda-calendar-weekdays {
    display: contents; /* los hijos entran directamente en el grid padre */
}
.agenda-calendar-weekday {
    text-align: center;
    font-weight: 600;
    color: #666;
    padding: 6px 2px;
    font-size: 0.82em;
}

/* ── Grid de días ─────────────────────────────────────────── */
.agenda-calendar-days {
    display: contents; /* los hijos entran directamente en el grid padre */
}

/* Celda base */
.agenda-calendar-day {
    min-height: 70px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 6px 4px 6px;
    background: #fff;
    cursor: default;
    transition: background 0.12s ease, border-color 0.12s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 4px;
    min-width: 0; /* permite que las celdas se encojan */
    overflow: hidden;
}

/* Celda vacía (relleno) */
.agenda-calendar-day-empty {
    background: transparent;
    border: none;
    cursor: default;
}

/* Hoy */
.agenda-calendar-today {
    background: #fff8e1;
    border-color: #ffca28;
}
.agenda-calendar-today .agenda-calendar-daynum {
    color: #f57c00;
}

/* Número del día */
.agenda-calendar-daynum {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    color: #999;
    margin-bottom: 4px;
    line-height: 1;
}

/* ── Días CON eventos: fondo acentuado + cursor pointer ───── */
.agenda-calendar-has-events {
    background: #f0f1e8;
    border-color: #d4d6b8;
    cursor: pointer;
}
.agenda-calendar-has-events:hover {
    background: #e5e7d4;
    border-color: #c4c79e;
}
/* Fallback para navegadores sin color-mix (Firefox < 113, Safari < 16.2) */
@supports not (color: color-mix(in srgb, red 10%, blue)) {
    .agenda-calendar-has-events {
        background: #f0f1e8;
        border-color: #d4d6b8;
    }
    .agenda-calendar-has-events:hover {
        background: #e5e7d4;
        border-color: #c4c79e;
    }
}

/* ── Etiquetas dentro de la celda (dot + texto wpcf-que-es) ─ */
.agenda-calendar-labels {
    list-style: none;
    margin: 2px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    min-width: 0;
}
.agenda-calendar-label {
    display: flex;
    align-items: center;  /* dot y texto centrados verticalmente */
    gap: 3px;
    min-width: 0;
    line-height: 1;       /* evita line-height heredado grande */
}
.agenda-calendar-label-dot {
    display: inline-block;
    flex-shrink: 0;
    align-self: center;   /* siempre centrado respecto al texto */
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cf3d3d;
}
.agenda-calendar-label-text {
    font-size: 0.70em;
    font-weight: 600;
    color: #cf3d3d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
}

/* ── Día seleccionado ─────────────────────────────────────── */
.agenda-calendar-selected {
    background: #fdf0f0 !important;
    border-color: #cf3d3d !important;
    box-shadow: 0 0 0 2px rgba(207, 61, 61, 0.25);
}
@supports not (color: color-mix(in srgb, red 10%, blue)) {
    .agenda-calendar-selected {
        background: #fdf0f0 !important;
        border-color: #cf3d3d !important;
    }
}
.agenda-calendar-selected .agenda-calendar-daynum {
    color: #cf3d3d;
}

/* ── Estado de carga del grid ─────────────────────────────── */
.agenda-calendar-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Panel de detalle ─────────────────────────────────────── */
.agenda-calendar-detail {
    margin-top: 16px;
    border: 1px solid #e8c8c8;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    animation: agendaDetailIn 0.18s ease;
}
@supports not (color: color-mix(in srgb, red 10%, blue)) {
    .agenda-calendar-detail {
        border-color: #e8c8c8;
    }
}
@keyframes agendaDetailIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Cabecera del panel */
.agenda-calendar-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fdf6f6;
    border-bottom: 1px solid #f0d8d8;
}
@supports not (color: color-mix(in srgb, red 10%, blue)) {
    .agenda-calendar-detail-header {
        background: #fdf6f6;
        border-bottom-color: #f0d8d8;
    }
}
.agenda-calendar-detail-date {
    font-weight: 700;
    font-size: 0.95em;
    color: #cf3d3d;
    text-transform: capitalize;
}
.agenda-calendar-detail-close {
    background: none;
    border: none;
    font-size: 1.2em;
    line-height: 1;
    cursor: pointer;
    color: #888;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.12s, background 0.12s;
}
.agenda-calendar-detail-close:hover {
    color: #333;
    background: rgba(0,0,0,0.06);
}

/* Lista de actividades del día */
.agenda-calendar-detail-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}
.agenda-calendar-detail-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
}
.agenda-calendar-detail-item:last-child {
    border-bottom: none;
}
.agenda-calendar-detail-item:hover {
    background: #fafafa;
}
/* .agenda-calendar-detail-time moved to date block section */
.agenda-calendar-detail-item a {
    color: #222;
    text-decoration: none;
    font-size: 0.95em;
    line-height: 1.4;
}
.agenda-calendar-detail-item a:hover {
    color: #cf3d3d;
    text-decoration: underline;
}

/* Bloque de fechas en el panel de detalle */
.agenda-calendar-detail-dates {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
    min-width: 60px;
}
/* Evento de un día: solo la hora */
.agenda-calendar-detail-time {
    font-size: 0.82em;
    font-weight: 700;
    color: #cf3d3d;
    white-space: nowrap;
}
/* Evento multidia: dos líneas Data inici / Data fi */
.agenda-calendar-detail-date-line {
    display: block;
    font-size: 0.78em;
    color: #555;
    white-space: nowrap;
    line-height: 1.4;
}
.agenda-calendar-detail-date-line strong {
    color: #cf3d3d;
    font-weight: 700;
}

/* Mensajes de carga / vacío */
.agenda-calendar-detail-loading,
.agenda-calendar-detail-empty {
    padding: 14px 16px;
    color: #888;
    font-size: 0.9em;
}

/* ── Responsive ───────────────────────────────────────────── */

/* Tablet (≤ 700px): texto más pequeño, nombres de día abreviados a 1 letra via CSS */
@media (max-width: 700px) {
    .agenda-calendar-weekday {
        font-size: 0.70em;
        padding: 4px 1px;
    }
    .agenda-calendar-day {
        min-height: 58px;
        padding: 4px 3px 5px;
    }
    .agenda-calendar-label-text {
        font-size: 0.65em;
    }
}

/* Mobile (≤ 480px): ocultar texto del label, solo punto; ocultar nombre del día */
@media (max-width: 480px) {
    .agenda-calendar-weekday {
        font-size: 0;          /* oculta el texto (Lun, Mar…) */
        padding: 3px 0;
    }
    .agenda-calendar-weekday::first-letter {
        font-size: 10px;       /* muestra solo la inicial */
        font-weight: 700;
        color: #666;
    }
    .agenda-calendar-day {
        min-height: 44px;
        padding: 3px 2px 4px;
        border-radius: 4px;
    }
    .agenda-calendar-daynum {
        font-size: 0.72em;
    }
    .agenda-calendar-label-text {
        display: none;         /* solo el punto en móvil */
    }
    .agenda-calendar-label-dot {
        width: 6px;
        height: 6px;
        margin: 0 auto;
    }
    .agenda-calendar-detail-time {
        display: none;
    }
}
