:root{ --mio-barra-color:#444444; } /* mantenemos variable para compatibilidad */
body.body-scroll-disabled { overflow: hidden; }

/* Popup */
#popup-container{
  display:none; position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:9998;
  animation: pbFadeIn .4s ease-out;
}
@keyframes pbFadeIn{ from{opacity:0;transform:scale(.95)} to{opacity:1;transform:scale(1)} }
.popup-wrapper{
  position:fixed; top:50%; left:50%; transform:translate(-50%, -50%);
  max-width:700px; width:min(92vw,700px); background:#fff; border-radius:12px; overflow:hidden; z-index:9999;
  box-shadow:0 14px 30px rgba(0,0,0,.25);
}
.popup-img-container{ position:relative; width:100%; overflow:hidden; touch-action:pan-y; }
.popup-img{ width:100%; height:auto; display:block; }
.popup-controls{
  position:absolute; top:50%; left:0; right:0; display:flex; justify-content:space-between; transform:translateY(-50%);
  pointer-events:none;
}
.popup-controls button{
  pointer-events:auto; background:rgba(0,0,0,.6); color:#fff; font-size:16px; border:0; border-radius:50%; width:36px; height:36px;
  display:flex; align-items:center; justify-content:center; cursor:pointer; transition:transform .2s, background .3s;
}
.popup-controls button:hover{ background:rgba(0,0,0,.8); transform:scale(1.05); }
.cerrar-btn{
  position:absolute; top:10px; right:10px; width:32px; height:32px; font-size:24px; color:#fff;
  background:rgba(0,0,0,.7); border-radius:50%; display:flex; align-items:center; justify-content:center; cursor:pointer; z-index:10000;
}

/* Cronómetro popup */
.cronometro{ background:linear-gradient(90deg,#333,#555); text-align:center; padding: clamp(12px, 4vw, 20px) 10px; }
.cronometro h3{ margin:0 0 clamp(8px, 2.8vw, 15px); font-size: clamp(16px, 4.5vw, 20px); color:#fff; font-weight:700; line-height:1.2; white-space:nowrap; }
.timer-wrapper{ display:flex; justify-content:center; align-items:stretch; gap: clamp(6px, 2.2vw, 12px); flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
.timer-wrapper::-webkit-scrollbar{ display:none; }
.timer-box{ background:#fff; color:#000; border-radius:8px; border:1px solid #e5e7eb; width: clamp(58px, 21vw, 80px); height: clamp(62px, 22vw, 90px); padding: clamp(4px, 1.2vw, 10px); display:flex; flex-direction:column; justify-content:center; align-items:center; box-shadow:0 6px 16px rgba(0,0,0,.08); }
.timer-box .value{ font-size: clamp(16px, 6vw, 28px); font-weight:800; letter-spacing:.3px; }
.timer-box .label{ font-size: clamp(9px, 2.6vw, 12px); margin-top: clamp(2px, .6vw, 6px); color:#333; opacity:.8; text-transform:uppercase; }

/* Barra oferta */
#barra-oferta{
  display:flex; position:fixed; bottom:48px; left:24px;
  background: var(--mio-barra-color); border-radius:14px; padding:10px 12px; z-index:10000;
  box-shadow:0 12px 24px rgba(0,0,0,.18); gap:10px; align-items:center; cursor:pointer;
  max-width:520px; width:auto; transform:translateX(0); transition: transform .4s ease, opacity .4s ease, box-shadow .2s ease;
  line-height:1;
}
#barra-oferta:hover{ box-shadow:0 16px 30px rgba(0,0,0,.22); }
#barra-oferta img{ height:70px; width:auto; border-radius:10px; object-fit:cover; display:block; flex-shrink:0; margin-top:2px; }

.texto-barra{
  color:#fff; font-size:13px; font-weight:700; display:flex; flex-direction:column; justify-content:center;
  min-width:0; overflow:hidden;
}
.subtitulo-barra{
  font-size:12px; font-weight:400; color:#fff; margin-top:2px; text-transform:uppercase; letter-spacing:.5px;
  white-space:nowrap; text-overflow:ellipsis; overflow:hidden;
}
.timer-mini{ font-size:14px; margin-top:4px; display:flex; gap:6px; flex-wrap:nowrap; }
.timer-mini span{ background:#fff; color:var(--mio-barra-color); padding:3px 6px; border-radius:6px; font-weight:800; min-width:24px; text-align:center; }

.cerrar-barra{ margin-left:10px; font-size:20px; color:#fff; font-weight:700; cursor:pointer; user-select:none; display:none; }
.flecha-deslizar{ display:none; margin-left:auto; animation:pbFlecha 1s infinite alternate; }
@keyframes pbFlecha{ from{transform:translateX(0)} to{transform:translateX(-6px)} }
@keyframes slideOutLeft{ to{ transform:translateX(-120%); opacity:0; } }
@keyframes slideInLeft{ from{ transform:translateX(-120%); opacity:0; } to{ transform:translateX(0); opacity:1; } }
.animar-salida{ animation: slideOutLeft .4s forwards; }
.animar-entrada{ animation: slideInLeft .4s ease-out; }

/* Desktop */
@media (min-width: 769px){
  .cerrar-barra{ display:inline-block; }
  .flecha-deslizar{ display:none !important; }
}

/* Mobile */
@media (max-width: 768px) {
  #barra-oferta {
    left: 12px; width: 92%; max-width: 320px; justify-content: flex-start;
    padding: 8px 10px; bottom: 80px !important; flex-wrap: nowrap; align-items: center; line-height: 1;
  }
  #barra-oferta img { height: 52px; margin-top: 4px; flex-shrink: 0; }
  .texto-barra { font-size: 11.5px; font-weight: bold; height: 100%; flex: 1 1 auto; min-width: 0; padding-left: 6px; }
  .subtitulo-barra { font-size: 10.5px; font-weight: normal; color: #fff; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .timer-mini { font-size: 11.5px; margin-top: 4px; display: flex; gap: 6px; flex-wrap: nowrap; flex: 0 0 auto; }
  .timer-mini span { background: white; color: var(--mio-barra-color); padding: 2px 4px; border-radius: 6px; font-weight: bold; min-width: 20px; font-size: 10px; text-align: center; }
  .flecha-deslizar { display: inline-block; }
  .cerrar-barra { display: none; }
}

/* Accesibilidad: reduce-animación */
@media (prefers-reduced-motion: reduce){
  #popup-container, .animar-entrada, .animar-salida { animation: none !important; }
}
