/* ==========================================================================
   ExtraIoT — Sala demo interactiva (render + dashboard estilo Home Assistant)
   Paleta de marca: --navy #1E417A / --cyan #61CBCB
   ========================================================================== */
.sala-demo {
  --sd-bg: #0b1730;
  --sd-card: #13223f;
  --sd-card-2: #182a4b;
  --sd-line: rgba(255, 255, 255, .08);
  --sd-text: #E6ECF5;
  --sd-dim: #8EA0BE;
  --sd-nav: 76px;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(97, 203, 203, .10), transparent 60%),
    radial-gradient(800px 600px at 100% 100%, rgba(30, 65, 122, .55), transparent 60%),
    linear-gradient(180deg, #0a1529 0%, #0d1c38 100%);
  color: var(--sd-text);
  overflow: clip;
}
.sala-demo .sd-wrap { max-width: 1340px; }
.sala-demo .sd-head h2 { color: #fff; }
.sala-demo .sd-head p { color: #A9B8D1; }
.sala-demo .sd-head .eyebrow { background: rgba(97, 203, 203, .14); }

.sd-grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(360px, 1fr); gap: 28px; align-items: start; }

/* ---------------- Render ---------------- */
.sd-left { position: sticky; top: calc(var(--sd-nav) + 16px); }
.sd-stage {
  position: relative;
  border-radius: 22px; overflow: hidden;
  background: #060c1a;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06);
  isolation: isolate;
}
.sd-render {
  position: relative; aspect-ratio: 1920 / 1072; width: 100%;
  background: #0b1220 url(../img/sala/m/poster.webp) center / cover no-repeat;
}
.sd-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .7s ease; }
.sd-ready .sd-canvas { opacity: 1; }
.sd-render::after { /* aviso de carga */
  content: 'Cargando render…'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 7px 14px; border-radius: 999px; background: rgba(8, 16, 34, .7); color: #CFD9EA;
  font: 600 .74rem/1 Inter, system-ui, sans-serif; transition: opacity .4s; pointer-events: none;
}
.sd-ready::after, .sd-failed::after { opacity: 0; }
.sd-noscript { position: absolute; left: 16px; bottom: 16px; margin: 0; color: #fff; }
.sd-badge {
  position: absolute; right: 14px; bottom: 14px; z-index: 3; pointer-events: none;
  padding: 4px 9px; border-radius: 6px; background: rgba(8, 16, 34, .55); color: rgba(230, 236, 245, .8);
  font: 600 .62rem/1.2 Inter, system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase;
}

.sd-sky {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px 7px 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(8, 16, 34, .62); color: #DDE6F3; font: 600 .74rem/1 Inter, system-ui, sans-serif;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); cursor: pointer;
  transition: background .2s, border-color .2s;
}
.sd-sky:hover { border-color: rgba(97, 203, 203, .6); }
.sd-sky svg { width: 15px; height: 15px; fill: none; stroke: #61CBCB; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.sd-toast {
  position: absolute; left: 14px; bottom: 14px; z-index: 3; max-width: calc(100% - 28px);
  padding: 9px 14px 9px 30px; border-radius: 12px;
  background: rgba(8, 16, 34, .72); border: 1px solid rgba(97, 203, 203, .35);
  color: #E6ECF5; font: 500 .8rem/1.3 Inter, system-ui, sans-serif;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; pointer-events: none;
}
.sd-toast::before { content: ''; position: absolute; left: 13px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #61CBCB; box-shadow: 0 0 10px #61CBCB; }
.sd-toast.show { opacity: 1; transform: none; }

.sd-tip {
  position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none;
  padding: 6px 10px; border-radius: 8px; background: rgba(8, 16, 34, .9); color: #fff;
  font: 500 .74rem/1.2 Inter, system-ui, sans-serif; white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, .12); opacity: 0; transition: opacity .15s;
}
.sd-tip.show { opacity: 1; }

.sd-legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.sd-legend-t { width: 100%; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6F82A3; margin-bottom: 2px; }
.sd-legend a { font-size: .78rem; color: #C3CFE2; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--sd-line); background: rgba(255, 255, 255, .03); transition: border-color .2s, color .2s; }
.sd-legend a:hover { color: #fff; border-color: rgba(97, 203, 203, .55); }

.sd-paused * { animation-play-state: paused !important; }

/* ---------------- Dashboard (estilo HA / Mushroom) ---------------- */
.sd-panel {
  background: linear-gradient(180deg, #0f1d38, #0c1830);
  border: 1px solid var(--sd-line); border-radius: 22px; padding: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.sd-ph { display: flex; justify-content: space-between; align-items: flex-start; padding: 2px 4px 14px; }
.sd-ph-t { font: 700 1.25rem/1.1 'Space Grotesk', Inter, sans-serif; color: #fff; }
.sd-ph-s { color: var(--sd-dim); font-size: .8rem; margin-top: 3px; font-variant-numeric: tabular-nums; }
.sd-ha { display: inline-flex; align-items: center; gap: 6px; font-size: .7rem; font-weight: 600; color: #9FB3D3; background: rgba(255, 255, 255, .05); border: 1px solid var(--sd-line); padding: 5px 9px; border-radius: 999px; white-space: nowrap; }
.sd-ha i { width: 7px; height: 7px; border-radius: 50%; background: #61CBCB; box-shadow: 0 0 0 0 rgba(97, 203, 203, .6); animation: hl-pulse 1.7s infinite; }

.sd-scenes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.sd-scene {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 11px 6px 10px; border-radius: 14px; border: 1px solid var(--sd-line);
  background: var(--sd-card); color: #CFD9EA; font: 600 .74rem/1.15 Inter, system-ui, sans-serif; cursor: pointer;
  transition: transform .15s, background .2s, border-color .2s, color .2s;
}
.sd-scene svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: #61CBCB; }
.sd-scene:hover { border-color: rgba(97, 203, 203, .45); transform: translateY(-1px); }
.sd-scene:active { transform: scale(.97); }
.sd-scene.active { background: linear-gradient(135deg, rgba(97, 203, 203, .28), rgba(30, 65, 122, .55)); border-color: rgba(97, 203, 203, .7); color: #fff; }

.sd-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sd-card {
  --ent: #61CBCB;
  background: var(--sd-card); border: 1px solid var(--sd-line); border-radius: 16px; padding: 12px;
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  transition: border-color .25s, background .25s;
}
.sd-span2 { grid-column: span 2; }
.sd-card.on { border-color: color-mix(in srgb, var(--ent) 40%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--ent) 9%, var(--sd-card)), var(--sd-card)); }
.ent-light { --ent: #FFB547; }
.ent-led { --ent: #61CBCB; }
.ent-cover { --ent: #61CBCB; }
.ent-media { --ent: #61CBCB; }
.ent-tv { --ent: #8B7BFF; }
.ent-fire { --ent: #FF7A3A; }
.ent-climate { --ent: #5FB7FF; }
.ent-climate.heat { --ent: #FF8A4C; }
.ent-lock { --ent: #3DDC97; }

.sd-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sd-sub { padding-top: 10px; border-top: 1px solid var(--sd-line); }
.sd-meta { min-width: 0; flex: 1; }
.sd-name { color: #fff; font-weight: 600; font-size: .86rem; line-height: 1.25; overflow-wrap: anywhere; }
.sd-state { color: var(--sd-dim); font-size: .74rem; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.sd-card.on > .sd-row .sd-state, .sd-row.on .sd-state { color: color-mix(in srgb, var(--ent) 85%, #fff); }
.sd-hint { margin: 0; font-size: .7rem; color: #6F82A3; line-height: 1.35; }

.sd-ic {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: rgba(255, 255, 255, .06); color: #7D8DAF;
  transition: background .25s, color .25s, transform .15s, box-shadow .25s;
}
.sd-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sd-ic:hover { transform: scale(1.06); }
.sd-ic:active { transform: scale(.94); }
.sd-ic[aria-pressed="true"] { background: color-mix(in srgb, var(--ent) 22%, transparent); color: var(--ent); box-shadow: 0 0 18px color-mix(in srgb, var(--ent) 30%, transparent); }
.sd-sub .sd-ic[aria-pressed="true"] { --ent: #FF6B7A; }
.sd-sub .sd-ic[aria-pressed="true"] + .sd-meta .sd-state { color: #FF9AA5; }
.ent-lock .sd-row:first-child .sd-ic[aria-pressed="true"] + .sd-meta .sd-state { color: #7BE8B8; }

/* sliders tipo Mushroom */
.sd-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 34px; margin: 0; border-radius: 11px; cursor: pointer;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ent) 55%, transparent) 0, color-mix(in srgb, var(--ent) 55%, transparent) var(--p, 50%), rgba(255, 255, 255, .07) var(--p, 50%));
  outline: none;
}
.sd-range:focus-visible { box-shadow: 0 0 0 2px #61CBCB; }
.sd-range::-webkit-slider-thumb { -webkit-appearance: none; width: 6px; height: 20px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 4px rgba(0, 0, 0, .12); }
.sd-range::-moz-range-thumb { width: 6px; height: 20px; border: 0; border-radius: 3px; background: #fff; }
.sd-card:not(.on) .sd-range:not(.sd-thin) { --ent: #5a6b8c; }
.sd-kelvin { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #FFA657, #FFD9A8 35%, #FFF6EE 65%, #CFE2FF) !important; }
.sd-kelvin::-webkit-slider-thumb { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; background: transparent; box-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.sd-kelvin::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; border: 3px solid #fff; background: transparent; }
.sd-scale { display: flex; justify-content: space-between; font-size: .66rem; color: #6F82A3; margin-top: -4px; }
.sd-thin { height: 6px; border-radius: 3px; }
.sd-thin::-webkit-slider-thumb { width: 14px; height: 14px; border-radius: 50%; }
.sd-thin::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; }

.sd-track { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .06); overflow: hidden; margin-top: -4px; }
.sd-track i { display: block; height: 100%; width: 0; background: #61CBCB; transition: width .1s linear; }

.sd-btns { display: flex; gap: 6px; }
.sd-mini {
  width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--sd-line); background: rgba(255, 255, 255, .04);
  color: #CFD9EA; display: grid; place-items: center; cursor: pointer; transition: background .2s, border-color .2s;
}
.sd-mini svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sd-mini:hover { border-color: rgba(97, 203, 203, .5); background: rgba(97, 203, 203, .1); }

.sd-swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.sd-sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .15); background: var(--sw); cursor: pointer; transition: transform .15s, box-shadow .2s; padding: 0; }
.sd-sw:hover { transform: scale(1.12); }
.sd-sw[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 12px var(--sw); }

/* media */
.sd-media { display: flex; gap: 12px; align-items: center; }
.sd-art { width: 56px; height: 56px; border-radius: 12px; flex: none; display: grid; place-items: center; background: linear-gradient(135deg, #1E417A, #61CBCB); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.sd-art svg { width: 24px; height: 24px; fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sd-eq { display: flex; gap: 3px; align-items: flex-end; height: 14px; margin-top: 6px; }
.sd-eq i { width: 3px; height: 3px; border-radius: 1px; background: #61CBCB; opacity: .5; }
.sd-card.on .sd-eq i { opacity: 1; animation: sdEq .9s ease-in-out infinite alternate; }
.sd-eq i:nth-child(2) { animation-delay: -.3s !important; }
.sd-eq i:nth-child(3) { animation-delay: -.6s !important; }
.sd-eq i:nth-child(4) { animation-delay: -.15s !important; }
.sd-eq i:nth-child(5) { animation-delay: -.45s !important; }
@keyframes sdEq { from { height: 3px; } to { height: 14px; } }
.sd-prog { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.sd-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #1E417A, #61CBCB); transition: width 1s linear; }
.sd-media-ctl { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.sd-time { font-size: .7rem; color: var(--sd-dim); font-variant-numeric: tabular-nums; }
.sd-transport { display: flex; align-items: center; gap: 8px; }
.sd-play { width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; background: #61CBCB; color: #0b1730; box-shadow: 0 6px 20px rgba(97, 203, 203, .35); transition: transform .15s; }
.sd-play:hover { transform: scale(1.06); }
.sd-play svg { width: 20px; height: 20px; }
.sd-listen { justify-self: end; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--sd-line); background: transparent; color: var(--sd-dim); border-radius: 999px; padding: 5px 9px; font: 600 .68rem/1 Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.sd-listen svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sd-listen[aria-pressed="true"] { color: #61CBCB; border-color: rgba(97, 203, 203, .6); background: rgba(97, 203, 203, .1); }
.sd-credit { margin: -2px 0 0; font-size: .64rem; color: #6F82A3; line-height: 1.4; }
.sd-credit a, .sd-disclaimer a { color: #8EA0BE; text-decoration: underline; text-decoration-color: rgba(142,160,190,.4); }
.sd-credit a:hover, .sd-disclaimer a:hover { color: #61CBCB; }
.sd-vol { display: flex; align-items: center; gap: 8px; }
.sd-vol svg { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--sd-dim); stroke-width: 2; stroke-linejoin: round; }

/* TV */
.sd-lift { display: flex; align-items: center; gap: 10px; }
.sd-lift-rail { width: 8px; height: 38px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; flex: none; }
.sd-lift-rail i { display: block; width: 100%; height: 0; background: var(--ent); border-radius: 4px; }
.sd-btn { flex: 1; height: 38px; border-radius: 11px; border: 1px solid color-mix(in srgb, var(--ent) 45%, transparent); background: color-mix(in srgb, var(--ent) 14%, transparent); color: #fff; font: 600 .8rem/1 Inter, system-ui, sans-serif; cursor: pointer; transition: background .2s; }
.sd-btn:hover { background: color-mix(in srgb, var(--ent) 26%, transparent); }

/* stepper / termostato */
.sd-stepper, .sd-thermo { display: flex; align-items: center; justify-content: space-between; background: rgba(255, 255, 255, .05); border-radius: 11px; padding: 3px; }
.sd-stepper button, .sd-thermo button { width: 34px; height: 32px; border-radius: 9px; border: 0; background: transparent; color: #DDE6F3; font-size: 1.15rem; cursor: pointer; }
.sd-stepper button:hover, .sd-thermo button:hover { background: rgba(255, 255, 255, .08); }
.sd-stepper span, .sd-thermo span { font: 700 1rem/1 'Space Grotesk', Inter, sans-serif; color: #fff; font-variant-numeric: tabular-nums; }
.sd-thermo span { font-size: 1.25rem; }
.sd-card.on .sd-thermo span { color: var(--ent); }
.sd-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.sd-modes button { height: 28px; border-radius: 8px; border: 1px solid var(--sd-line); background: transparent; color: var(--sd-dim); font: 600 .66rem/1 Inter, system-ui, sans-serif; cursor: pointer; padding: 0; }
.sd-modes button[aria-pressed="true"] { color: #fff; background: color-mix(in srgb, var(--ent) 22%, transparent); border-color: color-mix(in srgb, var(--ent) 55%, transparent); }
.sd-modes button[data-mode="off"][aria-pressed="true"] { --ent: #6F82A3; }

/* bitácora */
.sd-logwrap { margin-top: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--sd-line); border-radius: 14px; padding: 10px 12px; }
.sd-logt { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6F82A3; margin-bottom: 6px; }
.sd-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sd-log li { font-size: .76rem; color: #C3CFE2; display: flex; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-log time { color: #61CBCB; font-variant-numeric: tabular-nums; flex: none; }
.sd-disclaimer { margin: 10px 4px 0; font-size: .68rem; color: #6F82A3; line-height: 1.45; }

button:focus-visible { outline: 2px solid #61CBCB; outline-offset: 2px; }


/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
  .sd-grid { grid-template-columns: minmax(0, 1.4fr) minmax(330px, 1fr); gap: 20px; }
}
@media (max-width: 960px) {
  .sala-demo { --sd-nav: 64px; }
  .sd-grid { grid-template-columns: 1fr; gap: 14px; }
  .sd-left { top: calc(var(--sd-nav) + 6px); z-index: 5; }
  .sd-stage { border-radius: 16px; }
  .sd-legend { display: none; }
  .sd-panel { padding: 14px; }
}
@media (max-width: 520px) {
  .sala-demo .sd-wrap { padding: 0 12px; }
  .sd-scene { font-size: .66rem; padding: 9px 4px; }
  .sd-scene svg { width: 18px; height: 18px; }
  .sd-cards { gap: 8px; }
  .sd-card { padding: 10px; }
  .sd-ic { width: 36px; height: 36px; }
  .sd-sky { top: 8px; right: 8px; padding: 5px 9px 5px 8px; font-size: .66rem; }
  .sd-toast { left: 8px; bottom: 8px; font-size: .72rem; padding: 7px 10px 7px 26px; }
  .sd-toast::before { left: 10px; }
  .sd-badge { right: 8px; bottom: 8px; font-size: .55rem; }
  .sd-listen span { display: none; }
  .sd-swatches { gap: 5px; }
  .sd-sw { width: 21px; height: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  .sd-eq i, .sd-ha i { animation: none !important; }
}

/* Página demo.html */
.page-demo .sala-demo { padding-top: 56px; min-height: calc(100vh - 76px); }
.page-demo .sd-head h1 { color: #fff; font-size: clamp(1.9rem, 3.4vw, 2.7rem); }
.sala-demo .eyebrow .live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #FF4F5E; margin-right: 8px; vertical-align: 1px; animation: live-pulse 1.6s infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,79,94,.6); } 70% { box-shadow: 0 0 0 8px rgba(255,79,94,0); } 100% { box-shadow: 0 0 0 0 rgba(255,79,94,0); } }

@keyframes hl-pulse { 0% { box-shadow: 0 0 0 0 rgba(97,203,203,.6); } 70% { box-shadow: 0 0 0 10px rgba(97,203,203,0); } 100% { box-shadow: 0 0 0 0 rgba(97,203,203,0); } }
