/* JDServer-Webs — modules/webcams_history/webcams_history.css (v2.2) */
#webcams_history{
  margin: 14px 0 28px;
  --wch-accent: var(--site-accent, var(--accent, var(--primary, var(--link, var(--text)))));
  --wch-player-color: var(--wch-accent);
  --wch-player-opacity: 1;
  --wch-preload-red:   #ef4444;
  --wch-preload-green: #22c55e;
}

#webcams_history .wch-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 10px;
}
#webcams_history .wch-title{ font-weight:600; }

#webcams_history .wch-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 12px;
  overflow: hidden;
}

#webcams_history .wch-controls{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

#webcams_history .wch-note{
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: .92rem;
}

#webcams_history .wch-field{ display:flex; flex-direction:column; gap:6px; }
#webcams_history .wch-label{ font-size:.85rem; color: var(--muted); }

#webcams_history .wch-select{
  width:100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
}

#webcams_history .wch-camlist{
  display:flex;
  flex-direction:column;
  gap: 14px;
}

#webcams_history .wch-camblock{ padding-top: 2px; }

#webcams_history .wch-camtitle{
  font-weight: 600;
  color: var(--text);
  margin: 2px 0 8px;
}

#webcams_history .wch-player{ display:flex; flex-direction:column; gap: 10px; }

#webcams_history .wch-imgbox{
  position:relative;
  width: 100%;
  border-radius: 14px;
  overflow:hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  aspect-ratio: 16 / 9;
}

#webcams_history .wch-img{
  width:100%;
  height:100%;
  display:block;
  background: var(--bg);
  object-fit: contain;
  object-position: center;
  max-width: none;
  max-height: none;
}

#webcams_history .wch-overlay{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 14px;
  text-align:center;
  background: radial-gradient(circle at center, rgba(0,0,0,.30), rgba(0,0,0,.10));
}
#webcams_history .wch-overlay-text{
  color:#fff;
  font-weight:600;
  text-shadow: 0 0 6px rgba(0,0,0,.65);
  max-width: 520px;
}

/* ✅ Barra: 2 pills + descarga + barra precarga + slider */
#webcams_history .wch-bar{
  display:grid;
  grid-template-columns: auto auto auto minmax(140px, 240px) 1fr;
  align-items:center;
  gap: 10px;
}

/* ✅ Base pill */
#webcams_history .wch-pill{
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .92rem;
  line-height: 1;
  min-height: 36px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
}

/* Botón */
#webcams_history .wch-btn{
  cursor: pointer;
  user-select:none;
}
#webcams_history .wch-btn.is-playing{
  border-color: var(--wch-accent);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.00), 0 0 0 3px rgba(0,0,0,0.00);
}

/* Hora */
#webcams_history .wch-time{
  color: var(--muted);
  min-width: 64px;
  text-align:center;
}

/* ✅ Descarga vídeo */
#webcams_history .wch-download{
  cursor: pointer;
  border-color: color-mix(in srgb, var(--border) 60%, var(--wch-accent) 40%);
}
#webcams_history .wch-download:hover{
  border-color: var(--wch-accent);
}
#webcams_history .wch-download.is-disabled{
  opacity: .55;
  cursor: default;
  pointer-events: none;
  border-color: var(--border);
}

/* ✅ Barra de precarga + % */
#webcams_history .wch-preloadwrap{
  display:flex;
  align-items:center;
  gap: 10px;
  height: 28px;
}
#webcams_history .wch-preloadpct{
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 700;
  font-size: .90rem;
  min-width: 44px;
  text-align: right;
}

#webcams_history .wch-preloadtrack{
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow:hidden;
  opacity: .65;
  position: relative;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.10),
    inset 0 -1px 0 rgba(0,0,0,.18);
}
#webcams_history .wch-preloadfill{
  position:absolute;
  left:0; top:0; bottom:0;
  width:0%;
  background: var(--wch-preload-red);
  opacity: 1;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,.22) 0px,
    rgba(255,255,255,.22) 6px,
    rgba(255,255,255,0)   6px,
    rgba(255,255,255,0)   12px
  );
  background-size: 16px 16px;
}
#webcams_history .wch-preloadtrack.is-loading .wch-preloadfill{
  background-color: var(--wch-preload-red);
}
#webcams_history .wch-preloadtrack.is-done .wch-preloadfill{
  background-color: var(--wch-preload-green);
}

/* ✅ Slider */
#webcams_history .wch-sliderwrap{
  position: relative;
  height: 28px;
  min-width: 180px;
}

#webcams_history .wch-track{
  position:absolute;
  inset: 50% 0 auto 0;
  transform: translateY(-50%);
  height: 10px;
  border-radius: 999px;
  overflow:hidden;
  pointer-events:none;
  background: var(--border);
  opacity: 1;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.14),
    inset 0 -1px 0 rgba(0,0,0,.20);
}
@supports (background: color-mix(in srgb, #000 50%, #fff 50%)){
  #webcams_history .wch-track{
    background: color-mix(in srgb, var(--border) 70%, var(--text) 30%);
  }
}

#webcams_history .wch-progressfill{
  position:absolute;
  left:0; top:0; bottom:0;
  width:0%;
  background: var(--wch-player-color);
  opacity: var(--wch-player-opacity);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.18),
    inset 0 -1px 0 rgba(0,0,0,.18);
}

#webcams_history .wch-slider{
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 2;
  width: 100%;
  height: 28px;
  background: transparent;
  margin: 0;
  outline: none;
}

#webcams_history .wch-slider::-webkit-slider-runnable-track{
  -webkit-appearance:none;
  height: 10px;
  background: transparent;
  border: 0;
}
#webcams_history .wch-slider::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: var(--shadow-1), 0 0 0 2px rgba(0,0,0,0);
}
@supports (border-color: color-mix(in srgb, #000 50%, #fff 50%)){
  #webcams_history .wch-slider::-webkit-slider-thumb{
    border-color: color-mix(in srgb, var(--border) 55%, var(--wch-accent) 45%);
  }
}

#webcams_history .wch-slider::-moz-range-track{
  height: 10px;
  background: transparent;
  border: 0;
}
#webcams_history .wch-slider::-moz-range-thumb{
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: var(--shadow-1);
}
@supports (border-color: color-mix(in srgb, #000 50%, #fff 50%)){
  #webcams_history .wch-slider::-moz-range-thumb{
    border-color: color-mix(in srgb, var(--border) 55%, var(--wch-accent) 45%);
  }
}
#webcams_history .wch-slider::-moz-range-progress{
  background: transparent;
}

/* ✅ Móvil */
@media (max-width: 520px){
  #webcams_history .wch-card{ border-radius: 16px; }

  #webcams_history .wch-imgbox{
    margin: 0;
    border-radius: 14px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  #webcams_history .wch-bar{
    grid-template-columns: auto auto;
    gap: 8px;
  }

  #webcams_history .wch-preloadwrap{
    grid-column: 1 / -1;
  }

  #webcams_history .wch-sliderwrap{
    grid-column: 1 / -1;
    min-width: 0;
  }

  /* descarga ocupa ancho entero para que no apriete */
  #webcams_history .wch-download{
    grid-column: 1 / -1;
  }

  #webcams_history .wch-pill{
    padding: 7px 10px;
    font-size: .90rem;
    min-height: 34px;
  }
  #webcams_history .wch-time{
    min-width: 56px;
  }
}
