/* Botones flotantes. Móvil: saldo abajo a la izquierda y ayuda a la derecha. Escritorio: saldo en la cabecera y botón «Ayuda». */
.fwn-ayuda, .fwn-hoja, .fwn-hoja-fondo, .fwn-saldo { display: none; }

@media (max-width: 767px) {
  /* Deja sitio al final de la página para que los botones no tapen el pie */
  body { padding-bottom: 68px; }

  /* Saldo: pastilla compacta */
  html body #fsr-loyalty-btn {
    left: 12px; right: auto; bottom: 12px;
    height: 44px; max-height: 44px;
    padding: 0 14px 0 4px; gap: 6px;
    font-size: 14px; line-height: 1;
    background: #0b1220;
    box-shadow: 0 6px 18px rgba(11, 18, 32, .28);
    z-index: 9990;
  }
  html body #fsr-loyalty-btn .fsr-loyalty-icon { width: 36px; height: 36px; margin: 0; }

  /* WhatsApp suelto (home): círculo pequeño abajo a la derecha */
  html body a.fs-whatsapp {
    width: 48px !important; height: 48px !important;
    right: 12px !important; bottom: 12px !important;
    box-shadow: 0 6px 18px rgba(4, 19, 72, .3);
    z-index: 9990 !important;
  }

  /* En la tienda: el bloque antiguo se sustituye por el botón de ayuda */
  html body #fs-incidencia-container { display: none !important; }
  .fwn-ayuda {
    display: flex; align-items: center; justify-content: center;
    position: fixed; right: 12px; bottom: 12px; z-index: 9990;
    width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%;
    background: #041348; color: #fff; cursor: pointer;
    box-shadow: 0 6px 18px rgba(4, 19, 72, .3);
  }
  .fwn-ayuda svg { width: 24px; height: 24px; }
  .fwn-ayuda span { display: none; }

  /* El botón de subir arriba estorba en el móvil */
  html body .scrollToTop { display: none !important; }

  /* Mientras está abierto el carrito, el menú o el acceso, no se ven los flotantes */
  body:has(.wd-side-hidden.wd-opened) :is(#fsr-loyalty-btn, a.fs-whatsapp, .fwn-ayuda) { display: none !important; }

  /* Panel desde abajo */
  .fwn-hoja-fondo {
    position: fixed; inset: 0; z-index: 99990;
    background: rgba(11, 18, 32, .45);
  }
  .fwn-hoja {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 99991;
    max-height: 85vh; overflow-y: auto;
    background: #fff; border-radius: 18px 18px 0 0;
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(11, 18, 32, .2);
    font-family: Poppins, sans-serif; color: #0b1220;
  }
  body.fwn-hoja-abierta .fwn-hoja,
  body.fwn-hoja-abierta .fwn-hoja-fondo { display: block; }
  body.fwn-hoja-abierta :is(#fsr-loyalty-btn, .fwn-ayuda) { display: none !important; }

  .fwn-hoja-asa { width: 40px; height: 4px; margin: 0 auto 10px; border-radius: 4px; background: #e2e8f0; }
  .fwn-hoja-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  .fwn-hoja-cab h3 { flex: 1; margin: 0; font-size: 17px; font-weight: 700; color: #0b1220 !important; }
  .fwn-hoja-cab button {
    width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
    background: #f1f5f9; color: #0b1220; font-size: 18px; line-height: 1; cursor: pointer;
  }
  .fwn-hoja-cab .fwn-hoja-volver { font-size: 26px; padding-bottom: 3px; }
  .fwn-hoja-volver[hidden] { display: none; }

  .fwn-hoja-op {
    display: flex; align-items: center; gap: 12px; width: 100%;
    min-height: 58px; padding: 10px 12px; margin-top: 8px;
    border: 1px solid #e2e8f0 !important; border-radius: 12px !important; background: #fff !important;
    justify-content: flex-start; line-height: 1.3; letter-spacing: 0; box-shadow: none !important;
    color: #0b1220 !important; font-size: 15px; font-weight: 600; text-align: left;
    text-decoration: none !important; text-transform: none; cursor: pointer;
  }
  .fwn-hoja-op small { display: block; font-size: 12px; font-weight: 400; color: #64748b; }
  .fwn-hoja-op .fwn-ico {
    flex: 0 0 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
  }
  .fwn-hoja-op .fwn-ico svg { width: 20px; height: 20px; }
  .fwn-ico-wa { background: #dcfce7; color: #16a34a; }
  .fwn-ico-inc { background: #fef3c7; color: #b45309; }

  /* Formulario de incidencias dentro del panel */
  .fwn-hoja #fs-incidencia-box {
    display: block; position: static; width: auto; max-width: none; max-height: none;
    padding: 0; margin-top: 4px; box-shadow: none; border-radius: 0; overflow: visible;
  }
  .fwn-hoja #fs-incidencia-box::before { display: none; }
}

/* Tablet (cabecera de móvil): saldo como pastilla compacta abajo a la izquierda */
@media (min-width: 768px) and (max-width: 1024px) {
  html body #fsr-loyalty-btn { left: 16px; right: auto; bottom: 24px; height: 44px; max-height: 44px; padding: 0 14px 0 4px; gap: 6px; font-size: 14px; line-height: 1; background: #0b1220; z-index: 9990; }
  html body #fsr-loyalty-btn .fsr-loyalty-icon { width: 36px; height: 36px; margin: 0; }
}
/* Escritorio (cabecera completa): saldo en la cabecera, junto al carrito */
@media (min-width: 1025px) {
  html body #fsr-loyalty-btn { display: none !important; }
}
@media (min-width: 768px) {
  .whb-general-header .fwn-saldo {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 14px 0 4px;
    padding: 5px 12px 5px 6px; border-radius: 999px; background: #f1f5f9;
    color: #0b1220 !important; font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none !important;
  }
  .whb-general-header .fwn-saldo:hover { background: #e2e8f0; }
  .whb-general-header .fwn-saldo img { width: 22px; height: 22px; object-fit: contain; border-radius: 50%; }
  .whb-general-header .fwn-saldo b { font-weight: 700; }

  /* Tienda: un solo botón «Ayuda» abajo a la derecha (a la izquierda de la flecha de subir) */
  html body #fs-incidencia-container { display: none !important; }
  .fwn-ayuda {
    display: inline-flex; align-items: center; gap: 8px;
    position: fixed; right: 84px; bottom: 24px; z-index: 9990;
    height: 48px; padding: 0 20px 0 16px; border: 0; border-radius: 999px;
    background: #041348; color: #fff; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    box-shadow: 0 8px 22px rgba(4, 19, 72, .28); text-transform: none; letter-spacing: 0;
  }
  .fwn-ayuda:hover { background: #0b2a6b; }
  .fwn-ayuda svg { width: 22px; height: 22px; }
  body:has(.wd-side-hidden.wd-opened) .fwn-ayuda { display: none !important; }

  /* Panel encima del botón (no a pantalla completa) */
  .fwn-hoja-fondo { position: fixed; inset: 0; z-index: 99990; background: transparent; }
  .fwn-hoja {
    position: fixed; right: 84px; bottom: 84px; z-index: 99991;
    width: 380px; max-height: calc(100vh - 140px); overflow-y: auto;
    background: #fff; border-radius: 16px; padding: 14px 16px 16px;
    box-shadow: 0 20px 50px rgba(11, 18, 32, .25); font-family: inherit; color: #0b1220;
  }
  body.fwn-hoja-abierta .fwn-hoja, body.fwn-hoja-abierta .fwn-hoja-fondo { display: block; }
  .fwn-hoja-asa { display: none; }
  .fwn-hoja-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
  .fwn-hoja-cab h3 { flex: 1; margin: 0; font-size: 16px; font-weight: 700; color: #0b1220 !important; }
  .fwn-hoja-cab button { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: #f1f5f9; color: #0b1220; font-size: 16px; line-height: 1; cursor: pointer; min-height: 0; }
  .fwn-hoja-cab .fwn-hoja-volver { font-size: 22px; padding-bottom: 3px; }
  .fwn-hoja-volver[hidden] { display: none; }
  .fwn-hoja-op {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 12px; margin-top: 8px;
    border: 1px solid #e2e8f0 !important; border-radius: 12px !important; background: #fff !important; box-shadow: none !important;
    color: #0b1220 !important; font-size: 14px; font-weight: 600; text-align: left; justify-content: flex-start;
    text-decoration: none !important; text-transform: none; letter-spacing: 0; line-height: 1.3; cursor: pointer;
  }
  .fwn-hoja-op:hover { border-color: #cbd5e1 !important; background: #f8fafc !important; }
  .fwn-hoja-op small { display: block; font-size: 12px; font-weight: 400; color: #64748b; }
  .fwn-hoja-op .fwn-ico { flex: 0 0 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
  .fwn-hoja-op .fwn-ico svg { width: 20px; height: 20px; }
  .fwn-ico-wa { background: #dcfce7; color: #16a34a; }
  .fwn-ico-inc { background: #fef3c7; color: #b45309; }
  .fwn-hoja #fs-incidencia-box { display: block; position: static; width: auto; max-width: none; max-height: none; padding: 0; margin-top: 4px; box-shadow: none; border-radius: 0; overflow: visible; }
  .fwn-hoja #fs-incidencia-box::before { display: none; }
}
