:root {
    --bg-main: #020617;
    --bg-card: #020617;
    --border-soft: #1f2937;
    --accent: #0EA5E9;
    --accent-soft: #38bdf8;
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --danger: #fb7185;
    --success: #22c55e;
    --warning: #facc15;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: radial-gradient(circle at top, #020617 0, #020617 40%, #020617 100%);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-main);
}

/* NAVBAR */
.navbar {
    width: 100%;
    background: #020617;
    padding: 10px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #111827;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-left img {
    height: 32px;
    border-radius: 8px;
}

.navbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-soft);
}

.navbar-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.navbar-links {
    display: flex;
    gap: 12px;
    font-size: 13px;
}

.navbar-links a {
    text-decoration: none;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: 0.2s;
}

.navbar-links a:hover {
    color: #fff;
    border-color: var(--accent-soft);
}

/* LAYOUT GENERAL */
.wrapper {
    padding: 14px 16px 16px;
}

/* DASHBOARD SIMULADO */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 6px;
}

.card {
    background: radial-gradient(circle at top left, #020617 0, #020617 45%, #020617 100%);
    border-radius: 18px;
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
}

.card-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #1f2937;
    color: var(--text-muted);
}

.card-main {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
}

.card-value {
    font-size: 26px;
    font-weight: 600;
}

.card-unit {
    font-size: 12px;
    color: var(--text-muted);
}

.card-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* BARRA TIPO MUSHROOM */
.bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #020617;
    border: 1px solid #111827;
    overflow: hidden;
    margin-top: 6px;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #22c55e, #facc15, #fb7185);
    width: 50%;
    transition: width 0.4s ease-out;
}

/* STATUS DOT */
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    display: inline-block;
    margin-right: 4px;
}

.status-ok {
    background: var(--success);
}

.status-warn {
    background: var(--warning);
}

/* SPARKLINE SIMPLE */
.sparkline {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 42px;
    margin-top: 6px;
}

.sparkline-bar {
    width: 6px;
    border-radius: 999px;
    background: linear-gradient(180deg, #38bdf8, #0f172a);
}

/* FOOTER */
.footer {
    width: 100%;
    background: #020617;
    color: var(--text-muted);
    padding: 8px 18px;
    font-size: 11px;
    border-top: 1px solid #111827;
    text-align: right;
}

.footer a {
    color: var(--accent-soft);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* SCROLL SUAVE PARA CARDS */
html {
    scroll-behavior: smooth;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .navbar-links {
        flex-wrap: wrap;
    }
}
/* ENERGY FLOW GRID – 3 fuentes arriba, Home abajo */
.energy-flow {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 26px;
    position: relative;
}

/* fila superior: Solar / Grid / Water */
.energy-row-top {
    display: flex;
    justify-content: space-around;
}

/* fila inferior: Home centrado */
.energy-row-bottom {
    display: flex;
    justify-content: center;
}

/* nodos */
.energy-node {
    width: 95px;
    height: 95px;
    border-radius: 999px;
    border: 3px solid #1f2937;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    background: radial-gradient(circle at top, #020617 0, #020617 65%, #020617 100%);
    box-shadow: 0 12px 26px rgba(0,0,0,0.7);
	position: relative;
	z-index: 2;
}

.energy-node-icon {
    font-size: 28px;
    margin-bottom: 2px;
}

.energy-node-value {
    font-size: 20px;
    font-weight: 700;
}

.energy-node-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* Colores por nodo */
.energy-node-solar {
    border-color: #facc15;
}
.energy-node-grid {
    border-color: #38bdf8;
}
.energy-node-water {
    border-color: #a855f7; /* bien distinto al grid */
}
.energy-node-home {
    border-color: #22c55e;
    position: relative;
    z-index: 3; /* siempre encima de las curvas */
}

/* Curvas SVG que conectan fuentes con Home */
.energy-connections {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1; /* por debajo de los nodos */
}

.energy-connections svg {
    width: 100%;
    height: 100%;
}

/* estilo de curva */
.energy-curve {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 8 10;
    animation: energy-flow-curve 1.2s linear infinite;
}

.energy-curve-solar {
    stroke: #facc15;
}

.energy-curve-grid {
    stroke: #38bdf8;
}

.energy-curve-water {
    stroke: #a855f7;
}

@keyframes energy-flow-curve {
    from { stroke-dashoffset: 0; }
    to   { stroke-dashoffset: -18; }
}


/* Energy Flow card ocupa más espacio */
#card-energy-flow {
    grid-column: span 2; /* ocupa dos columnas */
}

/* Toggle de Switches ON/OFF */
.switch-toggle {
    margin-top: 6px;
}

.switch-btn {
    position: relative;
    width: 90px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid #4b5563;
    background: #111827;
    display: flex;
    align-items: center;
    padding: 4px 6px;
    gap: 6px;
    cursor: pointer;
    color: #9ca3af;
    font-size: 11px;
    font-weight: 600;
    outline: none;
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.switch-knob {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #020617;
    box-shadow: 0 0 0 2px rgba(15,23,42,0.7);
    transform: translateX(0);
    transition: transform 0.25s ease;
}

.switch-label-text {
    flex: 1;
    text-align: center;
}

/* Estado ON */
.switch-btn.switch-on {
    background: #16a34a;
    border-color: #22c55e;
    color: #e5e7eb;
}

.switch-btn.switch-on .switch-knob {
    transform: translateX(40px);
}

/* Estado OFF */
.switch-btn.switch-off {
    background: #111827;
    border-color: #4b5563;
    color: #9ca3af;
}

.switch-btn.switch-off .switch-knob {
    transform: translateX(0);
}

/* Aseguramos que el card de switches tenga un ID por si queremos más ajustes */
#card-lorawan {
    position: relative;
}



