/*** Configuraciones MikroTik: diagrama animado de balanceo PCC + failover + QoS ***/
.mk-scene {
    background: linear-gradient(160deg, var(--dark) 0%, #1b2257 100%);
    border-radius: 12px;
    padding: 1.5rem;
    color: #fff;
}

.mk-scene svg {
    width: 100%;
    height: auto;
    display: block;
}

/* En pantallas pequeñas el diagrama mantiene un tamaño legible y se desplaza horizontalmente */
@media (max-width: 575.98px) {
    .mk-scene {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .mk-scene svg {
        min-width: 560px;
    }
}

.mk-node rect {
    fill: #222a66;
    stroke: rgba(255, 255, 255, .35);
    stroke-width: 1.5;
}

.mk-node--router rect {
    fill: var(--primary);
    stroke: #8fc2ff;
}

.mk-label {
    fill: #fff;
    font: 600 13px "Ubuntu", sans-serif;
    text-anchor: middle;
}

.mk-sublabel {
    fill: rgba(255, 255, 255, .65);
    font: 400 11px "Open Sans", sans-serif;
    text-anchor: middle;
}

.mk-link {
    fill: none;
    stroke: rgba(255, 255, 255, .25);
    stroke-width: 2;
}

.mk-link--flow {
    stroke: #4fa3ff;
    stroke-dasharray: 6 10;
    animation: mk-flow 1.2s linear infinite;
}

/* WAN 2 cae periódicamente: el enlace se apaga y su tráfico pasa a WAN 1 */
.mk-link--wan2 {
    animation: mk-flow 1.2s linear infinite, mk-wan2-state 8s steps(1, end) infinite;
}

.mk-led {
    fill: #2ecc71;
}

.mk-led--wan2 {
    animation: mk-led-state 8s steps(1, end) infinite;
}

.mk-failover-tag {
    fill: #ffc107;
    font: 700 11px "Ubuntu", sans-serif;
    text-anchor: middle;
    opacity: 0;
    animation: mk-tag-state 8s steps(1, end) infinite;
}

.mk-packet--voip { fill: #2ecc71; }
.mk-packet--video { fill: #ffc107; }
.mk-packet--web { fill: #8fc2ff; }

.mk-queue-bar {
    transform-box: fill-box;
    transform-origin: left center;
    animation: mk-queue 3s ease-in-out infinite;
}

.mk-queue-bar--2 { animation-delay: .6s; }
.mk-queue-bar--3 { animation-delay: 1.2s; }

@keyframes mk-flow {
    to { stroke-dashoffset: -32; }
}

@keyframes mk-wan2-state {
    0% { stroke: #4fa3ff; opacity: 1; }
    62.5% { stroke: #dc3545; opacity: .35; }
}

@keyframes mk-led-state {
    0% { fill: #2ecc71; }
    62.5% { fill: #dc3545; }
}

@keyframes mk-tag-state {
    0% { opacity: 0; }
    62.5% { opacity: 1; }
}

@keyframes mk-queue {
    0%, 100% { transform: scaleX(.35); }
    50% { transform: scaleX(1); }
}

/* Leyenda */
.mk-legend span {
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
    font-size: .85rem;
    color: rgba(255, 255, 255, .8);
}

.mk-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: .4rem;
}

/* Tarjetas de configuración */
.mk-card {
    border: 1px solid rgba(19, 99, 198, .12);
    transition: transform .3s ease, box-shadow .3s ease;
}

.mk-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 1rem 2rem rgba(19, 99, 198, .15);
}

.mk-card .mk-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(19, 99, 198, .1);
    color: var(--primary);
}

.mk-card code {
    font-size: .8rem;
    color: var(--dark);
    background: #f1f5fb;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Pasos de trabajo */
.mk-step {
    position: relative;
    padding-left: 70px;
}

.mk-step-number {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font: 700 1.2rem "Ubuntu", sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mk-pulse 2.4s ease-out infinite;
}

@keyframes mk-pulse {
    0% { box-shadow: 0 0 0 0 rgba(19, 99, 198, .45); }
    70% { box-shadow: 0 0 0 14px rgba(19, 99, 198, 0); }
    100% { box-shadow: 0 0 0 0 rgba(19, 99, 198, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .mk-scene *,
    .mk-step-number {
        animation: none !important;
    }
    .mk-packet {
        display: none;
    }
}


/*** Hotspot y venta de fichas ***/
.mk-card--featured {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    box-shadow: 0 12px 30px rgba(19, 99, 198, .25);
}

.mk-card .mk-icon--light {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.mk-mini-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(255, 255, 255, .7);
}

.mk-mini-flow span {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    animation: mk-pulse-light 2.4s ease-out infinite;
}

.mk-mini-flow span:nth-of-type(2) { animation-delay: .6s; }
.mk-mini-flow span:nth-of-type(3) { animation-delay: 1.2s; }
.mk-mini-flow span:nth-of-type(4) { animation-delay: 1.8s; }

@keyframes mk-pulse-light {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .45); }
    70% { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

@media (max-width: 575.98px) {
    .mk-mini-flow span {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
}

/* Diagrama */
.hs-link--alt {
    stroke: #ffc107;
}

.hs-step circle {
    fill: var(--secondary);
}

.hs-step text {
    fill: #fff;
    font: 700 11px "Ubuntu", sans-serif;
    text-anchor: middle;
}

.hs-db rect {
    stroke: #2ecc71;
}

.hs-sale-tag {
    fill: #2ecc71;
    font: 700 12px "Ubuntu", sans-serif;
    text-anchor: middle;
    animation: hs-sale 3s ease-out infinite;
}

@keyframes hs-sale {
    0% { opacity: 0; transform: translateY(8px); }
    20%, 60% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-8px); }
}

.hs-bar {
    transform-box: fill-box;
    transform-origin: center bottom;
    animation: hs-bar 2.4s ease-in-out infinite;
}

.hs-bar--2 { animation-delay: .3s; }
.hs-bar--3 { animation-delay: .6s; }
.hs-bar--4 { animation-delay: .9s; }
.hs-bar--5 { animation-delay: 1.2s; }

@keyframes hs-bar {
    0%, 100% { transform: scaleY(.35); }
    50% { transform: scaleY(1); }
}

/* Teléfono con portal cautivo */
.hs-illustration {
    position: relative;
    padding: 20px 0;
}

.hs-phone {
    position: relative;
    width: 250px;
    padding: 34px 14px 18px;
    background: var(--dark);
    border-radius: 34px;
    box-shadow: 0 20px 40px rgba(20, 24, 62, .25);
    animation: hs-float 5s ease-in-out infinite;
}

.hs-phone-notch {
    position: absolute;
    top: 12px;
    left: 50%;
    width: 70px;
    height: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .2);
    transform: translateX(-50%);
}

.hs-portal {
    padding: 18px 14px;
    background: var(--light);
    border-radius: 20px;
}

.hs-portal-brand {
    margin-bottom: 14px;
    padding: 10px;
    text-align: center;
    font: 700 14px "Ubuntu", sans-serif;
    color: #fff;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.hs-portal-title {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
}

.hs-plan {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--dark);
    background: #fff;
    border: 1px solid rgba(19, 99, 198, .15);
    border-radius: 10px;
}

.hs-plan i {
    color: var(--primary);
}

.hs-plan--active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(19, 99, 198, .15);
}

.hs-code {
    display: flex;
    align-items: center;
    margin: 12px 0 10px;
    padding: 9px 12px;
    font: 600 14px monospace;
    letter-spacing: 2px;
    color: var(--dark);
    background: #fff;
    border: 1px dashed var(--primary);
    border-radius: 10px;
}

.hs-code-text {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    animation: hs-type 4s steps(9, end) infinite;
}

.hs-caret {
    width: 2px;
    height: 16px;
    margin-left: 2px;
    background: var(--primary);
    animation: hs-blink .8s step-end infinite;
}

@keyframes hs-type {
    0% { max-width: 0; }
    50%, 100% { max-width: 9.5em; }
}

@keyframes hs-blink {
    50% { opacity: 0; }
}

.hs-connect {
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    background: var(--primary);
    border-radius: 50px;
}

.hs-floating {
    position: absolute;
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    background: #fff;
    border-radius: 50px;
    box-shadow: 0 8px 20px rgba(20, 24, 62, .15);
    animation: hs-float 4s ease-in-out infinite;
}

.hs-floating i {
    color: var(--primary);
}

.hs-floating--1 {
    top: 18%;
    left: 0;
}

.hs-floating--2 {
    bottom: 14%;
    right: 0;
    animation-delay: 1.5s;
}

.hs-floating--2 i {
    color: #2ecc71;
}

@keyframes hs-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Dashboard */
.hs-dashboard {
    padding: 24px;
    color: #fff;
    background: linear-gradient(160deg, var(--dark) 0%, #1b2257 100%);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(20, 24, 62, .25);
}

.hs-dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    font: 600 15px "Ubuntu", sans-serif;
}

.hs-live {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    color: #2ecc71;
}

.hs-live i {
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: #2ecc71;
    animation: hs-blink 1.2s step-end infinite;
}

.hs-kpi {
    height: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 10px;
}

.hs-kpi small {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, .65);
}

.hs-kpi strong {
    display: block;
    font: 700 22px "Ubuntu", sans-serif;
}

.hs-kpi em {
    font-size: 11px;
    font-style: normal;
    color: rgba(255, 255, 255, .55);
}

.hs-chart {
    padding: 14px;
    background: rgba(255, 255, 255, .06);
    border-radius: 10px;
}

.hs-chart small {
    color: rgba(255, 255, 255, .65);
}

.hs-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
}

.hs-chart-bars span {
    flex: 1;
    height: var(--h);
    border-radius: 4px 4px 0 0;
    background: linear-gradient(to top, var(--primary), var(--secondary));
    transform-origin: bottom;
    animation: hs-grow 3s ease-in-out infinite;
}

.hs-chart-bars span:nth-child(2n) { animation-delay: .4s; }
.hs-chart-bars span:nth-child(3n) { animation-delay: .8s; }

@keyframes hs-grow {
    0%, 100% { transform: scaleY(.85); }
    50% { transform: scaleY(1); }
}

.hs-dash-note {
    display: block;
    margin-top: 10px;
    text-align: right;
    font-size: 11px;
    color: rgba(255, 255, 255, .45);
}

@media (max-width: 575.98px) {
    .hs-floating {
        position: static;
        margin: 12px 6px 0;
    }
    .hs-illustration {
        text-align: center;
    }
    .hs-kpi strong {
        font-size: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mk-mini-flow span,
    .hs-phone,
    .hs-floating,
    .hs-bar,
    .hs-sale-tag,
    .hs-code-text,
    .hs-caret,
    .hs-live i,
    .hs-chart-bars span {
        animation: none !important;
    }
}

/* Las barras del nodo Dashboard no heredan el estilo de .mk-node rect */
.mk-node rect.hs-bar { fill: #8fc2ff; stroke: none; }
.mk-node rect.hs-bar--2, .mk-node rect.hs-bar--5 { fill: #2ecc71; }
.mk-node rect.hs-bar--3 { fill: #ffc107; }
