/********** Recursos de fibra (recursos-tecnologicos-fibra.html) **********/

/*** Simulador de red GPON ***/
.fr-sim {
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(20, 24, 62, .12);
    overflow: hidden;
}

.fr-sim-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 12px 0;
    background: var(--dark);
    overflow-x: auto;
}

.fr-tab {
    border: none;
    padding: 11px 18px;
    border-radius: 14px 14px 0 0;
    background: transparent;
    color: rgba(255, 255, 255, .65);
    font-family: 'Ubuntu', sans-serif;
    font-weight: 500;
    white-space: nowrap;
    transition: background .25s, color .25s;
}

.fr-tab i { margin-right: 6px; color: var(--secondary); }
.fr-tab:hover,
.fr-tab:focus-visible { color: #fff; background: rgba(255, 255, 255, .06); }
.fr-tab.is-active { color: #fff; background: #0d1640; }

.fr-sim-stage { background: radial-gradient(circle at 25% 30%, #16307a 0%, #0d1640 55%, #0a1033 100%); }

#frSimSvg { display: block; width: 100%; height: auto; font-family: 'Ubuntu', sans-serif; }

.fr-link { fill: none; stroke: #2f7dff; stroke-width: 3; stroke-linecap: round; opacity: .55; transition: opacity .3s, stroke .3s; }
.fr-link--glow { stroke: #4fc3ff; stroke-width: 10; opacity: .07; }
.fr-link--copper { stroke: #8fa6d6; stroke-dasharray: 3 6; opacity: .8; }
.fr-link--trunk { stroke-width: 5; opacity: .8; }
.fr-link.is-hl { stroke: #ffffff; opacity: .95; }
.fr-link-label { fill: rgba(255, 255, 255, .55); font-size: 12px; text-anchor: middle; }

.fr-node .fr-halo { fill: rgba(79, 195, 255, .12); stroke: rgba(79, 195, 255, .35); }
.fr-node .fr-body { fill: #fff; stroke: #15ACE1; stroke-width: 2.5; }
.fr-node .fr-glyph { fill: var(--primary); font-family: 'Font Awesome 5 Free'; font-weight: 900; font-size: 20px; text-anchor: middle; dominant-baseline: central; }
.fr-node .fr-label { fill: #fff; font-size: 14px; font-weight: 500; }
.fr-node .fr-sub { fill: rgba(255, 255, 255, .55); font-size: 11.5px; }
.fr-node.is-hl .fr-halo { fill: rgba(255, 255, 255, .18); stroke: #fff; stroke-width: 2; animation: fr-hl 1.4s ease-in-out infinite; }
.fr-node.is-talking .fr-body { stroke-width: 5; }
.fr-node.is-flash .fr-halo { fill: rgba(82, 227, 164, .45); stroke: #52e3a4; }
.fr-node.is-flash .fr-body { stroke: #52e3a4; }

@keyframes fr-hl {
    50% { opacity: .45; }
}

.fr-frame { pointer-events: none; }
.fr-frame rect,
.fr-frame circle { stroke: rgba(255, 255, 255, .85); stroke-width: 1; }
.fr-frame--enc { opacity: .32; }
.fr-frame--enc rect { stroke-dasharray: 2 2; }
.fr-frame--ctrl rect { fill: #fff; stroke: var(--secondary); }
.fr-frame--ping circle { fill: #fff; stroke: none; filter: drop-shadow(0 0 5px #fff); }

.fr-panel {
    padding: 14px 18px 16px;
    background: #0d1640;
    color: #fff;
}

.fr-panel-title { display: block; margin-bottom: 10px; font-size: 13px; color: rgba(255, 255, 255, .65); }

.fr-counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fr-counter { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .06); font-size: 13px; }
.fr-counter b { margin-left: auto; font-family: 'Ubuntu', sans-serif; font-size: 15px; }
.fr-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.fr-tdma {
    position: relative;
    display: flex;
    height: 30px;
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, .06);
}

.fr-tdma-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    font-weight: 700;
    color: #0a1033;
    transition: flex-grow .4s ease;
    border-right: 2px solid #0d1640;
    white-space: nowrap;
    overflow: hidden;
}

.fr-tdma-head {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    width: 3px;
    background: #fff;
    box-shadow: 0 0 8px #fff;
}

.fr-demand { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fr-demand label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: rgba(255, 255, 255, .8); margin-bottom: 2px; }
.fr-demand output { margin-left: auto; font-weight: 700; color: #fff; }
.fr-demand .form-range { height: 1rem; }

.fr-steps-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fr-steps { display: flex; gap: 6px; flex: 1; justify-content: center; }

.fr-step-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .25);
    background: transparent;
    color: rgba(255, 255, 255, .75);
    font-family: 'Ubuntu', sans-serif;
    font-weight: 700;
    transition: all .2s;
}

.fr-step-btn:hover,
.fr-step-btn:focus-visible { border-color: #fff; color: #fff; }
.fr-step-btn.is-done { background: rgba(79, 195, 255, .18); border-color: rgba(79, 195, 255, .5); }
.fr-step-btn.is-active { background: linear-gradient(135deg, var(--primary), var(--secondary)); border-color: transparent; color: #fff; box-shadow: 0 0 0 4px rgba(21, 172, 225, .25); }

.fr-ctl {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: transparent;
    color: #fff;
    font-size: 14px;
    transition: all .2s;
}

.fr-ctl:hover,
.fr-ctl:focus-visible { border-color: #fff; background: rgba(255, 255, 255, .08); }
.fr-ctl--play.is-on { background: var(--secondary); border-color: var(--secondary); }

.fr-info { height: 100%; padding: 26px 24px; border-left: 1px solid #e6ecf8; }

.fr-info-step {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--light);
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 700;
}

.fr-info p { font-size: 15px; }
.fr-info-list { list-style: none; padding: 0; margin: 0; }
.fr-info-list li { position: relative; padding-left: 22px; margin-bottom: 7px; font-size: 14.5px; }
.fr-info-list li::before { content: "\f00c"; position: absolute; left: 0; top: 1px; font-family: 'Font Awesome 5 Free'; font-weight: 900; font-size: 12px; color: var(--secondary); }

.fr-sim-note { margin: 0; padding: 10px 18px; font-size: 13px; color: #6b7394; border-top: 1px solid #e6ecf8; }
.fr-sim-note i { color: var(--secondary); margin-right: 4px; }

/*** Infografía de buenas prácticas ***/
.fr-info-graph {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 90px;
    row-gap: 22px;
    max-width: 1060px;
    margin: 0 auto;
}

/* Hilo de fibra central que se "enciende" al bajar por la página */
.fr-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 6px;
    margin-left: -3px;
    border-radius: 6px;
    background: #dfe6f5;
    overflow: hidden;
}

.fr-line-fill {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 0;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    box-shadow: 0 0 12px var(--secondary);
}

.fr-line-fill::after {
    content: "";
    position: absolute;
    left: -3px;
    right: -3px;
    bottom: -6px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 14px 6px var(--secondary);
}

.fr-phase {
    grid-column: 1 / -1;
    position: relative;
    z-index: 1;
    text-align: center;
    margin: 18px 0 4px;
}

.fr-phase span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: 999px;
    background: var(--dark);
    color: #fff;
    font-family: 'Ubuntu', sans-serif;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(20, 24, 62, .2);
}

.fr-phase i { color: var(--secondary); }

.fr-tip {
    position: relative;
    z-index: 1;
    padding: 22px 22px 20px 84px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #e6ecf8;
    box-shadow: 0 12px 30px rgba(20, 24, 62, .07);
    opacity: 0;
    transform: translateY(26px);
    transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .2, 1), box-shadow .25s;
}

.fr-tip.is-in { opacity: 1; transform: none; }
.fr-tip:hover { box-shadow: 0 18px 40px rgba(20, 24, 62, .13); }

/* Conector entre cada tarjeta y el hilo central */
.fr-tip::after {
    content: "";
    position: absolute;
    top: 40px;
    width: 45px;
    height: 2px;
    background: linear-gradient(90deg, var(--secondary), rgba(21, 172, 225, 0));
}

/* Lado del conector según la columna (lo asigna fibra-recursos.js en cada fase) */
.fr-tip--l::after { right: -46px; transform: scaleX(-1); }
.fr-tip--r::after { left: -46px; }

.fr-tip-icon {
    position: absolute;
    left: 20px;
    top: 22px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 8px 18px rgba(19, 99, 198, .3);
}

.fr-tip.is-in .fr-tip-icon { animation: fr-pop .7s cubic-bezier(.2, 1.4, .4, 1) both .15s; }

@keyframes fr-pop {
    from { transform: scale(.3) rotate(-20deg); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.fr-tip-n {
    position: absolute;
    right: 18px;
    top: 14px;
    font-family: 'Ubuntu', sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: .35;
}

.fr-tip h3 { margin: 0 32px 6px 0; }
.fr-tip p { margin: 0; font-size: 14.5px; color: #5b6385; }

.fr-tip--safety { border-color: #ffd7a8; background: #fffaf2; }
.fr-tip--safety .fr-tip-icon { background: linear-gradient(135deg, #e89a12, #ffb347); box-shadow: 0 8px 18px rgba(232, 154, 18, .35); }

/*** Preguntas frecuentes ***/
.fr-faq .accordion-item {
    margin-bottom: 12px;
    border: 1px solid #e6ecf8;
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(20, 24, 62, .05);
}

.fr-faq .accordion-header { margin: 0; }

.fr-faq .accordion-button {
    gap: 12px;
    padding: 18px 20px;
    font-family: 'Ubuntu', sans-serif;
    font-weight: 500;
    font-size: 16.5px;
    color: var(--dark);
    background: #fff;
    box-shadow: none;
}

.fr-faq .accordion-button::before {
    content: "?";
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    color: var(--primary);
    font-weight: 700;
    transition: background .25s, color .25s;
}

.fr-faq .accordion-button:not(.collapsed) { color: var(--primary); background: #f7faff; }
.fr-faq .accordion-button:not(.collapsed)::before { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; }
.fr-faq .accordion-button:focus { box-shadow: 0 0 0 3px rgba(19, 99, 198, .2); }
.fr-faq .accordion-body { padding: 4px 20px 20px 62px; color: #5b6385; background: #f7faff; }

/*** Documentación oficial ***/
/* La regla de plantilla ".service-item a.btn" (pensada para "Leer más") pinta el texto azul sobre
   estos botones azules y les pone un círculo claro detrás: aquí se devuelven a su estilo normal. */
.service-item a.btn.btn-primary,
.service-item a.btn.btn-secondary {
    display: inline-flex;
    color: #fff;
}

.service-item a.btn.btn-primary::before,
.service-item a.btn.btn-secondary::before { display: none; }

/*** Responsive ***/
@media (max-width: 991.98px) {
    .fr-info { border-left: none; border-top: 1px solid #e6ecf8; }
    .fr-counters,
    .fr-demand { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767.98px) {
    /* El simulador se desliza de lado para conservar etiquetas legibles */
    .fr-sim-stage { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    #frSimSvg { min-width: 640px; }
    .fr-sim-stage::after { content: "\2194  Desliza para ver toda la red"; position: sticky; left: 0; display: block; padding: 6px 14px; font-size: 12px; color: rgba(255, 255, 255, .6); }

    /* Infografía en una sola columna con el hilo a la izquierda */
    .fr-info-graph { grid-template-columns: 1fr; padding-left: 34px; }
    .fr-line { left: 12px; }
    .fr-phase { text-align: left; margin-left: -34px; }
    .fr-tip--l::after,
    .fr-tip--r::after { left: -24px; right: auto; width: 22px; transform: none; }
    .fr-tip { padding: 18px 16px 16px 76px; }
    .fr-faq .accordion-body { padding-left: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .fr-tip { opacity: 1; transform: none; transition: none; }
    .fr-tip.is-in .fr-tip-icon,
    .fr-node.is-hl .fr-halo { animation: none; }
}
