* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", Roboto, system-ui, sans-serif;
    background: #0b1a1e;
    color: #c8e6e9;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.material-icons {
    font-family: "Material Icons";
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    display: inline-flex;
    vertical-align: middle;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1300px;
    width: 100%;
    background: #132a30;
    border-radius: 28px;
    padding: 25px 30px 35px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
    border: 1px solid #2f5a63;
}

h1 {
    font-weight: 300;
    font-size: 2rem;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 12px;
}

h1 .material-icons {
    font-size: 32px;
    color: #26a69a;
}

h1 small {
    font-size: 0.9rem;
    color: #80cbc4;
    font-weight: 400;
    margin-left: 10px;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #2f5a63;
    padding-bottom: 12px;
}

.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 30px;
    background: #1d3c44;
    padding: 8px 20px;
    border-radius: 40px;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-item .label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #80cbc4;
}

.stat-item .value {
    font-weight: 600;
    font-size: 1.2rem;
    color: #e0f2f1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.stat-item .value.danger {
    color: #ff8a80;
}
.stat-item .value.success {
    color: #69f0ae;
}

.toggle-group {
    display: flex;
    gap: 4px;
    background: #0f262c;
    border-radius: 40px;
    padding: 4px;
}

.toggle-btn {
    border: none;
    padding: 8px 22px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.25s;
    background: transparent;
    color: #8aa9b0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.toggle-btn.active {
    background: #26a69a;
    color: #0b1a1e;
    box-shadow: 0 2px 8px rgba(38, 166, 154, 0.5);
}

.toggle-btn:first-child.active {
    background: #ef5350;
    color: #fff;
}
.toggle-btn:last-child.active {
    background: #66bb6a;
    color: #0b1a1e;
}
.toggle-btn:hover {
    background: #1d3c44;
    color: #e0f2f1;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.nav-links a {
    color: var(--blue-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}
.nav-links a:hover {
    color: var(--brand-gold);
}

.canvas-wrapper {
    background: #0b1a1e;
    border-radius: 20px;
    padding: 8px;
    margin: 15px 0 20px;
    border: 1px solid #2f5a63;
    position: relative;
}

canvas {
    display: block;
    width: 100%;
    height: auto;
    background: #0b1a1e;
    border-radius: 14px;
    cursor: default;
}

/* Leyenda */
.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px 35px;
    margin: 10px 0 15px;
    padding: 10px 20px;
    background: #0f262c;
    border-radius: 30px;
    font-size: 0.9rem;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #2f5a63;
}
.legend-color.gris {
    background: #616161;
}
.legend-color.verde {
    background: #26a69a;
}
.legend-color.azul {
    background: #4dd0e1;
}
.legend-color.amarillo {
    background: #ffa726;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin: 15px 0 20px;
    flex-wrap: wrap;
}

.btn {
    background: #1d3c44;
    border: none;
    padding: 10px 28px;
    border-radius: 40px;
    font-weight: 500;
    color: #e0f2f1;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid #2f5a63;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
}

.btn-primary {
    background: #26a69a;
    color: #0b1a1e;
    border-color: #26a69a;
}
.btn-primary:hover {
    background: #4db6ac;
}

.btn-danger {
    background: #ef5350;
    color: #fff;
    border-color: #ef5350;
}
.btn-danger:hover {
    background: #e57373;
}

.btn-outline {
    background: transparent;
    border-color: #4db6ac;
}
.btn-outline:hover {
    background: #1d3c44;
}

/* FAQ */
.faq-section {
    margin-top: 25px;
    border-top: 1px solid #2f5a63;
    padding-top: 20px;
}
.faq-toggle {
    background: #0f262c;
    border: none;
    color: #80cbc4;
    font-size: 1rem;
    padding: 10px 20px;
    border-radius: 40px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;
    border: 1px solid #2f5a63;
}
.faq-toggle:hover {
    background: #1d3c44;
    color: #e0f2f1;
}
.faq-content {
    display: none;
    margin-top: 15px;
    background: #0f262c;
    border-radius: 20px;
    padding: 20px 25px;
    border-left: 4px solid #26a69a;
}
.faq-content.open {
    display: block;
}
.faq-item {
    margin-bottom: 16px;
}
.faq-item:last-child {
    margin-bottom: 0;
}
.faq-question {
    font-weight: 600;
    color: #69f0ae;
    display: flex;
    align-items: center;
    gap: 8px;
}
.faq-answer {
    margin-top: 4px;
    padding-left: 28px;
    color: #b2dfdb;
    font-size: 0.95rem;
    line-height: 1.5;
}

.cta-section {
    margin-top: 25px;
    background: #0f262c;
    border-radius: 20px;
    padding: 20px 30px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    border-left: 6px solid #26a69a;
}

.cta-text {
    font-size: 1.1rem;
    font-weight: 300;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cta-text .material-icons {
    font-size: 28px;
    color: #26a69a;
}

.cta-text strong {
    color: #69f0ae;
}

.cta-btn {
    background: #ffa726;
    border: none;
    padding: 12px 34px;
    border-radius: 40px;
    font-weight: 700;
    font-size: 1rem;
    color: #0b1a1e;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 4px 12px rgba(255, 167, 38, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cta-btn:hover {
    background: #ffb74d;
    transform: scale(1.02);
}

.footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.75rem;
    color: #4f7a82;
}

/* Tooltip flotante para nodos */
#tooltip {
    position: fixed;
    background: #0b1a1e;
    color: #e0f2f1;
    border: 1px solid #26a69a;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.85rem;
    pointer-events: none;
    display: none;
    z-index: 999;
    max-width: 220px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.8);
    line-height: 1.5;
}
#tooltip .nombre {
    font-weight: 600;
    color: #69f0ae;
}
#tooltip .estado {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
}
#tooltip .estado.on {
    background: #2e7d32;
    color: #a5d6a7;
}
#tooltip .estado.off {
    background: #5d4037;
    color: #ef9a9a;
}

@media (max-width: 700px) {
    .container {
        padding: 15px;
    }
    .header-bar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    .stats {
        justify-content: center;
    }
    .cta-section {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .cta-text {
        flex-direction: column;
        text-align: center;
    }
    .legend {
        gap: 10px 20px;
        font-size: 0.8rem;
    }
}
