/* Calendario de vuelos (/schedule). Referencia visual: docs/plans/calendario/ (capturas y fuentes/calendario.css). */

/* ── Syncfusion ─────────────────────────────────────────────────────────────── */

/* El tema pone overflow:hidden en .e-schedule y el popup de fecha de la cabecera se posiciona dentro: con pocas
   aeronaves el calendario queda recortado. */
.wt-sched.e-schedule {
    overflow: visible;
}

.wt-sched.e-schedule .e-timeline-view .e-appointment {
    height: 110px !important;
}

/* La tarjeta la pinta la plantilla: fuera el fondo, el borde y el color por aeronave de la cita. */
.wt-sched.e-schedule .e-appointment,
.wt-sched.e-schedule .e-appointment.e-appointment-border,
.wt-sched.e-schedule .e-appointment:focus {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: inherit !important;
}

.wt-sched.e-schedule .e-appointment .e-appointment-details {
    padding: 0 !important;
    height: 100%;
    width: 100%;
}

/* Agenda: la cita ocupa su fila, sin altura impuesta. */
.wt-sched.e-schedule .e-agenda-view .wt-event,
.wt-sched.e-schedule .e-agenda-view .wt-unavail {
    height: auto;
    min-height: 40px;
}

/* Columna de recurso (aeronave): por defecto Syncfusion reserva 200px, de sobra para una matrícula. */
.wt-sched.e-schedule .e-timeline-view .e-resource-left-td {
    width: 110px !important;
}

/* Vista de día: encaja todas las horas visibles en el ancho disponible, sin scroll horizontal. */
.wt-day-fit.e-schedule .e-timeline-view .e-date-header-wrap,
.wt-day-fit.e-schedule .e-timeline-view .e-content-wrap {
    overflow-x: hidden !important;
}

.wt-day-fit.e-schedule .e-timeline-view .e-date-header-wrap table,
.wt-day-fit.e-schedule .e-timeline-view .e-content-wrap table {
    width: 100% !important;
    table-layout: fixed !important;
}

.wt-day-fit.e-schedule .e-timeline-view .e-date-header-wrap table col,
.wt-day-fit.e-schedule .e-timeline-view .e-content-wrap table col {
    width: auto !important;
}

/* Tooltip: lo pinta la plantilla (.wt-tt); el contenedor de Syncfusion queda transparente. */
.e-schedule-event-tooltip.e-tooltip-wrap {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    max-width: 340px !important;
}

.e-schedule-event-tooltip.e-tooltip-wrap .e-tip-content {
    padding: 0 !important;
}

.e-schedule-event-tooltip.e-tooltip-wrap .e-arrow-tip {
    display: none !important;
}

/* ── Colores por tipo de vuelo: franja / fondo / texto (contraste AA) ──────── */

.wt-type-ins  { --a: #185FA5; --b: #E6F1FB; --t: #0C447C; }
.wt-type-solo { --a: #0F6E56; --b: #E1F5EE; --t: #085041; }
.wt-type-alq  { --a: #854F0B; --b: #FAEEDA; --t: #633806; }
.wt-type-tec  { --a: #5F5E5A; --b: #F1EFE8; --t: #444441; }
.wt-type-tur  { --a: #534AB7; --b: #EEEDFE; --t: #3C3489; }
.wt-type-none { --a: #9E9E9E; --b: #FAFAFA; --t: #424242; }

/* ── Tarjeta ────────────────────────────────────────────────────────────────── */

/* width: 100% es obligatorio: con container-type: inline-size la tarjeta no toma el ancho de su contenido y, dentro
   de la cita de Syncfusion, se encogería a su relleno. */
.wt-event {
    container-type: inline-size;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-left: 4px solid var(--a);
    background: var(--b);
    color: var(--t);
    border-radius: 0 3px 3px 0;
    padding: 4px 6px;
    font-size: 12px;
    line-height: 16px;
    text-align: left;
}

.wt-type-none.wt-event {
    border: 1px dashed var(--a);
    border-left: 4px dashed var(--a);
}

.wt-event svg.i,
.wt-tt svg.i {
    width: 12px;
    height: 12px;
    vertical-align: -2px;
    flex-shrink: 0;
}

.wt-event .ln {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
}

.wt-event .ln span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.wt-event .strong {
    font-weight: 600;
    font-size: 12.5px;
}

.wt-event .rem,
.wt-tt .rem {
    font-style: italic;
}

.wt-event .chip {
    font-size: 10.5px;
    font-weight: 600;
    padding: 0 4px;
    border-radius: 3px;
    background: var(--a);
    color: #fff;
    line-height: 15px;
}

.wt-event .pr,
.wt-tt .pr {
    font-size: 10px;
    font-weight: 600;
    padding: 0 3px;
    border-radius: 3px;
    border: 1px solid var(--a);
    color: var(--t);
    line-height: 13px;
}

.wt-event .sp {
    flex: 1;
}

.wt-event .chip,
.wt-event .pr,
.wt-event .xc {
    flex-shrink: 0;
}

/* Variantes por ancho: la plantilla pinta todas y las container queries eligen (ancha ≥ 150 px, media 80–150,
   estrecha < 80). Sin JS. */
.wt-event .v-mid,
.wt-event .v-narrow,
.wt-event .t-start,
.wt-event .icons-narrow {
    display: none;
}

@container (max-width: 149px) {
    .wt-event .v-wide,
    .wt-event .t-full,
    .wt-event .t-type,
    .wt-event .pr,
    .wt-event .xc,
    .wt-event .st-text {
        display: none;
    }

    .wt-event .v-mid,
    .wt-event .t-start {
        display: inline;
    }
}

@container (max-width: 79px) {
    .wt-event .v-mid,
    .wt-event .t-start {
        display: none;
    }

    .wt-event .v-narrow {
        display: inline;
    }

    .wt-event .icons-narrow {
        display: flex;
    }

    .wt-event .v-wide-line {
        display: none;
    }
}

/* ── No disponible ──────────────────────────────────────────────────────────── */

.wt-unavail {
    box-sizing: border-box;
    height: 100%;
    overflow: hidden;
    padding: 4px 6px;
    font-size: 12px;
    line-height: 16px;
    color: #444441;
    text-align: left;
    border: 1px solid #B4B2A9;
    border-radius: 3px;
    /* Franja bloqueada: diagonales grises (plan del calendario, F4). */
    background: repeating-linear-gradient(45deg, #F1EFE8 0 7px, #D3D1C7 7px 9px);
    cursor: pointer;
}

.wt-unavail b {
    font-weight: 600;
}

/* ── Tooltip ────────────────────────────────────────────────────────────────── */

.wt-tt {
    width: 330px;
    max-width: 330px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #D3D1C7;
    border-radius: 6px;
    font-size: 12.5px;
    line-height: 1.45;
    color: #2C2C2A;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
    text-align: left;
    white-space: normal;
}

.wt-tt .h {
    border-left: 4px solid var(--a);
    padding: 8px 10px;
    background: var(--b);
    color: var(--t);
}

.wt-tt .h .t1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
}

.wt-tt .sec {
    padding: 6px 10px;
    border-top: 1px solid #EEEEEE;
}

.wt-tt table {
    width: 100%;
    border-collapse: collapse;
}

.wt-tt td {
    padding: 1px 0;
    vertical-align: top;
}

.wt-tt td.k {
    color: #757575;
    width: 82px;
}

.wt-tt .fn {
    font-size: 10.5px;
    padding: 0 4px;
    border: 1px solid #BDBDBD;
    border-radius: 3px;
    color: #616161;
    margin-left: 5px;
}

.wt-tt .foot {
    color: #757575;
    font-size: 11.5px;
}

/* ── Luz diurna (F5): franja informativa, las celdas siguen siendo clicables ── */

.wt-sched.e-schedule .e-work-cells.wt-night,
.wt-legend .sw.wt-night {
    background-color: rgba(38, 50, 72, .16) !important;
}

.wt-sched.e-schedule .e-work-cells.wt-twilight,
.wt-legend .sw.wt-twilight {
    background-color: rgba(38, 50, 72, .07) !important;
}

.wt-legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #616161;
    white-space: nowrap;
}

.wt-legend .sw {
    display: inline-block;
    width: 14px;
    height: 12px;
    border: 1px solid #ddd;
}

.wt-legend .sw + .sw,
.wt-legend .sw:not(:first-child) {
    margin-left: 8px;
}

.wt-date-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 10px;
}

.wt-date-head .wt-sun {
    color: #757575;
    font-size: 12px;
}

/* ── Planificado frente a real (F6) ─────────────────────────────────────────── */

.wt-event .st-ok {
    color: #0F6E56;
    font-weight: 600;
    flex-shrink: 0;
}

.wt-event .st-live {
    color: #A32D2D;
    font-weight: 600;
    flex-shrink: 0;
    text-decoration: none;
}

.wt-event .st-none {
    color: #757575;
    flex-shrink: 0;
}

/* Barra calzo a calzo al pie, colocada en proporción al intervalo de la reserva. */
.wt-event .wt-bar {
    position: absolute;
    bottom: 3px;
    height: 6px;
    background: var(--a);
    border-radius: 0 3px 3px 0;
}

.wt-event .wt-bar.live {
    background: #A32D2D;
}

/* En vuelo: contorno rojo. */
.wt-event.wt-live {
    outline: 2px solid #A32D2D;
    outline-offset: -2px;
}

/* Pasada y sin vuelo: fondo blanco, borde discontinuo y contenido atenuado. */
.wt-event.wt-noflight {
    background: #fff;
    border: 1px dashed var(--a);
    border-left: 4px dashed var(--a);
}

.wt-event.wt-noflight .strong,
.wt-event.wt-noflight .ln:not(:first-child) {
    opacity: .55;
}

/* Vuelo sin reserva: cita propia, de solo lectura. */
.wt-actual {
    container-type: inline-size;
    box-sizing: border-box;
    width: 100%;
    height: 40px;
    overflow: hidden;
    padding: 3px 5px;
    font-size: 11px;
    line-height: 16px;
    color: #444441;
    text-align: left;
    border: 1.5px dashed #888780;
    border-radius: 3px;
    background: #fff;
    white-space: nowrap;
    cursor: pointer;
}

.wt-actual.live {
    border-color: #A32D2D;
    color: #A32D2D;
}

.wt-actual .a-short {
    display: none;
}

@container (max-width: 110px) {
    .wt-actual .a-long {
        display: none;
    }

    .wt-actual .a-short {
        display: inline;
    }
}

.wt-tt .foot .live {
    color: #A32D2D;
}

/* Mantenimiento (plan de mantenimiento, F4): llave en las reservas con aviso de proyección y en los bloques de
   mantenimiento. */
.wt-event .mx, .wt-unavail .mx { color: var(--mud-palette-warning); display: inline-flex; align-items: center; gap: 2px; }
.wt-tt .mx-sec { color: var(--mud-palette-warning-darken); }

/* ── Calendario de la ficha del usuario (docs/plans/plan-calendario-usuario.md) ─────────────────────────────── */

/* Mes: tarjeta de una línea (U4): chip, hora, matrícula, la otra persona y el estado; el resto, en el tooltip. */
.wt-compact.wt-event {
    padding: 2px 4px;
}

.wt-compact .chip,
.wt-compact .c-time,
.wt-compact .st-ok,
.wt-compact .st-live,
.wt-compact .st-none {
    flex-shrink: 0;
}

.wt-compact .c-reg,
.wt-compact .cp {
    min-width: 0;
}

.wt-compact .cp {
    font-weight: 600;
}

/* Con poco ancho cede primero la matrícula (está en el tooltip) y, si aún no cabe, la otra persona. */
@container (max-width: 199px) {
    .wt-compact .c-reg {
        display: none;
    }
}

@container (max-width: 109px) {
    .wt-compact .cp {
        display: none;
    }
}

/* Agenda sin agrupar por aeronave: la cita no toma ancho por sí sola y la tarjeta (container-type) se quedaría en 0. */
.wt-user-cal.e-schedule .e-agenda-view .e-appointment {
    width: 100% !important;
}

.wt-compact.wt-actual {
    height: 100%;
    padding: 1px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
}
