/* =========================================================
   VÍA-MON
   SINÓPTICO DE VÍA — LÍNEA 1
   ========================================================= */

.sinoptico-principal {
    padding: 22px;
    background:
        radial-gradient(circle at top, rgba(0, 217, 255, 0.05), transparent 35%),
        #020814;
    min-height: calc(100vh - 130px);
}


/* =========================================================
   CABECERA DEL SINÓPTICO
   ========================================================= */

.sinoptico-cabecera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;

    margin-bottom: 18px;
    padding: 18px 22px;

    background: rgba(7, 20, 38, 0.88);
    border: 1px solid rgba(0, 217, 255, 0.22);
    border-radius: 10px;
}

.sinoptico-kicker {
    display: block;
    margin-bottom: 5px;

    color: #00d9ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.sinoptico-cabecera h1 {
    margin: 0;

    color: #f3f8ff;
    font-size: 23px;
    letter-spacing: 0.5px;
}

.sinoptico-cabecera p {
    margin: 7px 0 0;

    color: #8ea3ba;
    font-size: 13px;
}


/* =========================================================
   LEYENDA RLST
   ========================================================= */

.sinoptico-leyenda {
    display: flex;
    align-items: center;
    gap: 18px;

    color: #aebed0;
    font-size: 11px;
    font-weight: 700;
}

.sinoptico-leyenda > div {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.estado-via {
    width: 26px;
    height: 5px;
    display: inline-block;
    border-radius: 5px;
}

.estado-via.libre {
    background: #00e676;
    box-shadow: 0 0 7px rgba(0, 230, 118, 0.7);
}

.estado-via.ocupado {
    background: #ff3b4d;
    box-shadow: 0 0 7px rgba(255, 59, 77, 0.7);
}

.estado-via.sin-dato {
    background: #66717f;
}


/* =========================================================
   ENCLAVAMIENTOS
   ========================================================= */

.sinoptico-enclavamiento {
    margin-bottom: 16px;

    background: rgba(4, 14, 29, 0.94);
    border: 1px solid rgba(84, 112, 145, 0.30);
    border-radius: 10px;

    overflow: hidden;
}

.enclavamiento-titulo {
    min-height: 52px;

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 0 16px;

    background: linear-gradient(
        90deg,
        rgba(0, 217, 255, 0.10),
        rgba(0, 217, 255, 0.015)
    );

    border-bottom: 1px solid rgba(0, 217, 255, 0.16);
}

.numero-enclavamiento {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 31px;
    height: 31px;

    border: 1px solid rgba(0, 217, 255, 0.55);
    border-radius: 6px;

    color: #00d9ff;

    font-size: 12px;
    font-weight: 900;
}

.enclavamiento-titulo div {
    display: flex;
    flex-direction: column;
}

.enclavamiento-titulo small {
    color: #617991;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.4px;
}

.enclavamiento-titulo strong {
    margin-top: 2px;

    color: #dcecff;
    font-size: 14px;
    letter-spacing: 0.7px;
}


/* =========================================================
   ÁREA DONDE SE DIBUJARÁ LA TOPOLOGÍA SVG
   ========================================================= */

.area-via {
    position: relative;

    min-height: 190px;
    width: 100%;

    overflow-x: auto;
    overflow-y: hidden;

    background:
        linear-gradient(rgba(53, 82, 111, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(53, 82, 111, 0.05) 1px, transparent 1px);

    background-size: 30px 30px;
}

.sinoptico-construccion {
    position: absolute;

    left: 50%;
    top: 50%;

    transform: translate(-50%, -50%);

    color: #536c85;

    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;

    white-space: nowrap;
}


/* =========================================================
   PREPARADO PARA LOS FUTUROS CIRCUITOS SVG
   ========================================================= */

.circuito-via {
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.circuito-via:hover {
    opacity: 0.72;
}

.circuito-libre {
    stroke: #00e676;
}

.circuito-ocupado {
    stroke: #ff3b4d;
}

.circuito-sin-dato {
    stroke: #66717f;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 850px) {

    .sinoptico-principal {
        padding: 12px;
    }

    .sinoptico-cabecera {
        align-items: flex-start;
        flex-direction: column;
    }

    .sinoptico-leyenda {
        width: 100%;
        overflow-x: auto;
    }

    .area-via {
        min-height: 170px;
    }

}

/* =========================================================
   SINÓPTICO — APROVECHAR ANCHO COMPLETO DE PANTALLA
   ========================================================= */

body #app {
    width: 100%;
    max-width: none;
}

body .viamon-header {
    width: calc(100% - 32px);
    max-width: none;
    margin-left: 16px;
    margin-right: 16px;
}

.sinoptico-principal {
    width: auto;
    max-width: none;
    margin: 0 16px;
    padding: 14px 0 24px;
}

/* El dibujo ferroviario podrá ser más ancho que la pantalla */
.area-via {
    width: 100%;
    max-width: none;
    overflow-x: auto;
}

/* En pantallas grandes aprovechamos todavía más espacio */
@media (min-width: 1400px) {
    body .viamon-header {
        width: calc(100% - 40px);
        margin-left: 20px;
        margin-right: 20px;
    }

    .sinoptico-principal {
        margin-left: 20px;
        margin-right: 20px;
    }
}

/* En celular reducimos los márgenes */
@media (max-width: 850px) {
    body .viamon-header {
        width: calc(100% - 16px);
        margin-left: 8px;
        margin-right: 8px;
    }

    .sinoptico-principal {
        margin-left: 8px;
        margin-right: 8px;
    }
}

/* =========================================================
   SINÓPTICO — CABECERA RESPONSIVE
   Conserva el aspecto original de VÍA-MON
   ========================================================= */

/*
 * El sinóptico utiliza una cabecera de ancho completo.
 * La imagen mantiene COVER como en el dashboard principal
 * y conserva el degradado original de .header-tren:before.
 */

body .header-superior {
    grid-template-columns:
        minmax(190px, 0.75fr)
        1px
        minmax(300px, 1fr)
        minmax(500px, 2fr)
        minmax(210px, 0.75fr);
}

/* Tren: mismo comportamiento visual que VÍA-MON */
body .header-tren {
    width: 100%;
    height: 130px;
    overflow: hidden;
}

body .header-tren img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 42%;
}

/* Difuminado lateral sobre la fotografía */
body .header-tren::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        linear-gradient(
            90deg,
            #03101d 0%,
            rgba(3,16,29,.70) 5%,
            transparent 18%,
            transparent 82%,
            rgba(2,9,20,.70) 95%,
            #020914 100%
        );
    pointer-events: none;
}

/* Laptop */
@media (max-width: 1500px) {
    body .header-superior {
        grid-template-columns:
            minmax(180px,.8fr)
            1px
            minmax(270px,1fr)
            minmax(420px,1.8fr)
            minmax(195px,.75fr);
    }
}

/* Tablet y móvil: priorizar información operacional */
@media (max-width: 1050px) {
    body .header-tren {
        display: none;
    }
}

/* =========================================================
   VÍA-MON — TOPOLOGÍA FERROVIARIA SVG
   ========================================================= */

.sinoptico-svg {
    display: block;
    width: 2400px;
    height: 260px;
    min-width: 2400px;
}

.sinoptico-svg .via-base {
    fill: none !important;
    stroke: #64748b !important;
    stroke-width: 7px !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}


/* =========================================================
   VÍA-MON — ETIQUETAS DE CIRCUITOS DEL SINÓPTICO
   ========================================================= */

.sinoptico-svg .etiqueta-circuito {
    fill: #cbd5e1;
    font-size: 15px;
    font-weight: 700;
    font-family: Arial, sans-serif;
    pointer-events: none;
    user-select: none;
}


/* VES necesita mayor altura por su topología ferroviaria */
#sinopticoVES .sinoptico-svg {
    height: 520px;
}


/* VÍA-MON — escala de trabajo del enclavamiento VES */
#sinopticoVES .sinoptico-svg {
    width: 3600px;
    min-width: 3600px;
    height: 520px;
}

#sinopticoVES .etiqueta-via {
    fill: #94a3b8;
    font-size: 18px;
    font-weight: 800;
    font-family: Arial, sans-serif;
    letter-spacing: 1px;
    pointer-events: none;
}



/* VES: etiquetas legibles LAB */
#sinopticoVES .sinoptico-svg .etiqueta-circuito {
    font-size: 22px;
}


/* VIAMON FICHA INTERACTIVA LAB */
.circuito-zona-click {
    fill: none;
    stroke: transparent;
    stroke-width: 24px;
    pointer-events: stroke;
    cursor: pointer;
}

.circuito-zona-click:focus {
    stroke: rgba(34,211,238,0.25);
    outline: none;
}

.ficha-circuito-sinoptico {
    width: min(440px, calc(100vw - 32px));
    box-sizing: border-box;
    border: 1px solid #22d3ee;
    border-radius: 12px;
    padding: 22px;
    background: #071827;
    color: #e2e8f0;
    box-shadow: 0 15px 50px rgba(0,0,0,0.6);
}

.ficha-circuito-sinoptico::backdrop {
    background: rgba(0,0,0,0.7);
}

.ficha-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #67e8f9;
    font-size: 20px;
}

.ficha-cabecera button {
    background: transparent;
    border: 0;
    color: #e2e8f0;
    font-size: 28px;
    cursor: pointer;
}

.ficha-circuito-sinoptico p {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 18px;
}

.ficha-ramas {
    margin-top: 12px;
    padding: 17px;
    text-align: center;
    border-radius: 8px;
    background: #123047;
    color: #67e8f9;
    font-size: 18px;
    font-weight: 800;
}

.ficha-circuito-sinoptico .ficha-pendiente {
    line-height: 1.5;
}
