/* Agenda / dietario (issue #5, ADR-0011).
 * Hoja del módulo: cada módulo tiene la suya (issue #27). */

.mdo-agenda {
    --mdo-fila: 1.375rem;
    --mdo-superficie: #ffffff;
    --mdo-campo-borde: #c7d3dc;
    --mdo-col-min: 9.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dark .mdo-agenda {
    --mdo-superficie: rgb(var(--gray-900));
    --mdo-linea: rgba(255, 255, 255, 0.1);
    --mdo-linea-suave: rgba(255, 255, 255, 0.05);
    --mdo-campo-borde: rgba(255, 255, 255, 0.2);
    --mdo-texto-2: rgb(var(--gray-400));
}

.mdo-agenda-barra {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.mdo-agenda-titulo {
    margin: 0;
    font-family: var(--mdo-display);
    font-weight: 400;
    font-size: 1.25rem;
    flex: 1 1 16rem;
}

.mdo-agenda-resumen {
    margin: 0;
    color: var(--mdo-texto-2);
}

.mdo-agenda-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.mdo-agenda-fecha {
    width: auto;
}

/* Huecos encontrados */
.mdo-huecos {
    padding: 0.875rem 1rem;
}

.mdo-huecos-cabecera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.mdo-huecos ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 0.5rem;
}

.mdo-huecos li button {
    width: 100%;
    text-align: start;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--mdo-campo-borde);
    font-weight: 600;
}

.mdo-huecos li button:hover,
.mdo-huecos li button:focus-visible {
    border-color: rgb(var(--primary-500));
    background: rgba(3, 161, 226, 0.08);
}

/* Rejilla */
.mdo-agenda-rejilla-scroll {
    overflow: auto;
    max-height: calc(100vh - 13rem);
    min-height: 24rem;
}

.mdo-agenda-rejilla {
    display: grid;
    grid-template-columns: 3.5rem repeat(var(--mdo-cols), minmax(var(--mdo-col-min), 1fr));
    grid-template-rows: auto calc(var(--mdo-fila) * var(--mdo-filas));
    min-width: max-content;
}

.mdo-agenda-esquina,
.mdo-agenda-cab {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--mdo-superficie);
    border-bottom: 1px solid var(--mdo-linea);
}

.mdo-agenda-esquina {
    left: 0;
    z-index: 4;
}

.mdo-agenda-cab {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 3.25rem;
    padding: 0.375rem 0.75rem;
    border-inline-start: 1px solid var(--mdo-linea-suave);
    box-shadow: inset 0 3px 0 var(--mdo-color);
    font-weight: 600;
}

.mdo-agenda-cab-boton {
    text-align: start;
    font-weight: 600;
}

.mdo-agenda-cab-boton:hover {
    color: rgb(var(--primary-600));
}

.mdo-agenda-horas {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--mdo-superficie);
    display: grid;
    grid-auto-rows: var(--mdo-fila);
}

.mdo-agenda-horas span {
    font-size: 0.6875rem;
    color: var(--mdo-texto-2);
    text-align: end;
    padding-inline-end: 0.5rem;
    transform: translateY(-0.45em);
}

.mdo-agenda-horas span.es-hora {
    font-weight: 600;
    color: inherit;
}

.mdo-agenda-col {
    position: relative;
    display: grid;
    grid-auto-rows: var(--mdo-fila);
    border-inline-start: 1px solid var(--mdo-linea-suave);
}

.mdo-agenda-hueco {
    display: block;
    width: 100%;
    border-top: 1px dashed var(--mdo-linea-suave);
    background: transparent;
    cursor: copy;
}

.mdo-agenda-hueco.es-hora {
    border-top-style: solid;
    border-top-color: var(--mdo-linea);
}

.mdo-agenda-hueco.es-cerrado {
    background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(19, 33, 46, 0.035) 6px 12px);
}

.dark .mdo-agenda-hueco.es-cerrado {
    background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255, 255, 255, 0.03) 6px 12px);
}

.mdo-agenda-hueco:hover,
.mdo-agenda-hueco:focus-visible {
    background: rgba(3, 161, 226, 0.12);
    box-shadow: inset 3px 0 0 var(--mdo-cian);
}

/* Citas */
.mdo-cita {
    position: absolute;
    left: 3px;
    right: 3px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    overflow: hidden;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    text-align: start;
    font-size: 0.75rem;
    line-height: 1.2;
    background: #eaf6fc;
    color: #13212e;
    box-shadow: inset 3px 0 0 var(--mdo-color), 0 0 0 1px rgba(3, 161, 226, 0.25);
}

.mdo-cita:hover,
.mdo-cita:focus-visible {
    z-index: 2;
    box-shadow: inset 3px 0 0 var(--mdo-color), 0 0 0 2px rgb(var(--primary-500)), 0 6px 16px rgba(19, 33, 46, 0.15);
}

.mdo-cita-hora {
    font-size: 0.6875rem;
    color: #3d4f5e;
}

.mdo-cita-nombre {
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mdo-cita-detalle {
    color: #3d4f5e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mdo-cita-estado {
    font-size: 0.6875rem;
    font-weight: 600;
}

.mdo-cita--confirmada { background: #dff0fa; }

.mdo-cita--realizada { background: #e3f1e8; box-shadow: inset 3px 0 0 #1e6b3a, 0 0 0 1px rgba(30, 107, 58, 0.25); }

.mdo-cita--realizada .mdo-cita-estado { color: #1e6b3a; }

.mdo-cita--pendiente { background: #fff7e8; box-shadow: inset 3px 0 0 var(--mdo-color), 0 0 0 1px rgba(180, 83, 9, 0.25); }

.mdo-cita--no_show { background: #fde8e7; opacity: 0.75; }

.mdo-cita--no_show .mdo-cita-estado { color: #b42318; }

.mdo-cita--cancelada { background: #eef2f5; opacity: 0.6; text-decoration: line-through; }

.dark .mdo-cita { background: rgba(3, 161, 226, 0.16); color: #ffffff; }

.dark .mdo-cita-hora,
.dark .mdo-cita-detalle { color: rgb(var(--gray-300)); }

.dark .mdo-cita--realizada { background: rgba(50, 160, 90, 0.18); }

.dark .mdo-cita--pendiente { background: rgba(245, 158, 11, 0.14); }

.dark .mdo-cita--no_show { background: rgba(240, 68, 56, 0.16); }

.dark .mdo-cita--cancelada { background: rgba(255, 255, 255, 0.06); }

/* Línea de «ahora» con el gesto anaglifo */
.mdo-agenda-ahora {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 2;
    height: 2px;
    background: var(--mdo-rojo);
    box-shadow: 0 2px 0 rgba(3, 161, 226, 0.7);
    pointer-events: none;
}

.mdo-agenda-ayuda {
    margin: 0;
}

/* Citas cortas (≤ 30 min): hora y nombre en una línea. */
.mdo-cita.is-corta {
    flex-direction: row;
    align-items: center;
    gap: 0.375rem;
    padding-block: 0;
    white-space: nowrap;
}

.mdo-cita.is-corta .mdo-cita-hora-fin,
.mdo-cita.is-corta .mdo-cita-detalle,
.mdo-cita.is-corta .mdo-cita-estado {
    display: none;
}

.mdo-cita.is-corta .mdo-cita-nombre {
    min-width: 0;
}
