/* HOYUELA 1955 · Aviso contingencia pasarela · r86
   r85→r86: plegado móvil 2 filas (sin truncar Llamar); offset dinámico sobre #cookie-banner (sin tapar sus botones);
   plegado desktop en una fila legible; padding desktop para no tapar pagar.
   Paleta: cream #f7f6f2, ink #1e3347, text #2a3f52, accent #e8c53a. */

:root {
  --hoy-cp-bg: #f7f6f2;
  --hoy-cp-ink: #1e3347;
  --hoy-cp-text: #2a3f52;
  --hoy-cp-soft: #4a6278;
  --hoy-cp-accent: #e8c53a;
  --hoy-cp-border: #d6e8f7;
  --hoy-cp-shadow: 0 12px 40px rgba(30, 51, 71, .18);
  --hoy-cp-cookie-offset: 0px;
  --hoy-cp-gap: 10px;
}

#hoy-cp-aviso {
  position: fixed;
  z-index: 9500; /* por debajo de #cookie-banner.cookie-r42 (12000) y #cookie-config-r42 (12100) */
  box-sizing: border-box;
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--hoy-cp-text);
  background: var(--hoy-cp-bg);
  border: 1px solid var(--hoy-cp-border);
  box-shadow: var(--hoy-cp-shadow);
  -webkit-font-smoothing: antialiased;
  bottom: calc(var(--hoy-cp-cookie-offset) + var(--hoy-cp-gap));
  transition: bottom .2s ease;
}

#hoy-cp-aviso *,
#hoy-cp-aviso *::before,
#hoy-cp-aviso *::after { box-sizing: border-box; }

#hoy-cp-aviso .hoy-cp__accent {
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--hoy-cp-ink), var(--hoy-cp-accent));
}

#hoy-cp-aviso .hoy-cp__inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
}

#hoy-cp-aviso .hoy-cp__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

#hoy-cp-aviso .hoy-cp__title {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--hoy-cp-ink);
}

#hoy-cp-aviso .hoy-cp__text {
  margin: 0;
  font-size: .88rem;
  line-height: 1.45;
  color: var(--hoy-cp-text);
}

#hoy-cp-aviso .hoy-cp__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#hoy-cp-aviso .hoy-cp__call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--hoy-cp-ink);
  color: #fff !important;
  text-decoration: none !important;
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .01em;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

#hoy-cp-aviso .hoy-cp__call:focus-visible {
  outline: 3px solid var(--hoy-cp-accent);
  outline-offset: 2px;
}

#hoy-cp-aviso .hoy-cp__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--hoy-cp-ink);
  border: 1px solid var(--hoy-cp-border);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex: 0 0 auto;
}

#hoy-cp-aviso .hoy-cp__toggle:focus-visible {
  outline: 3px solid var(--hoy-cp-accent);
  outline-offset: 2px;
}

#hoy-cp-aviso .hoy-cp__collapsed-label {
  display: none;
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
  color: var(--hoy-cp-ink);
  line-height: 1.3;
}

/* Escritorio: tarjeta inferior derecha; bottom ya incluye offset cookies */
@media (min-width: 768px) {
  #hoy-cp-aviso {
    right: 18px;
    left: auto;
    width: min(380px, calc(100vw - 36px));
    border-radius: 16px;
    overflow: hidden;
  }

  /* Plegado: una sola fila, texto en 1 línea, botones ≥44px */
  #hoy-cp-aviso.is-collapsed {
    width: auto;
    max-width: min(560px, calc(100vw - 36px));
    min-width: 0;
  }

  #hoy-cp-aviso.is-collapsed .hoy-cp__inner {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 8px 10px;
  }

  #hoy-cp-aviso.is-collapsed .hoy-cp__row,
  #hoy-cp-aviso.is-collapsed .hoy-cp__text,
  #hoy-cp-aviso.is-collapsed .hoy-cp__title {
    display: none;
  }

  #hoy-cp-aviso.is-collapsed .hoy-cp__actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    width: 100%;
    gap: 8px;
  }

  #hoy-cp-aviso.is-collapsed .hoy-cp__collapsed-label {
    display: block;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  /* Espacio para poder desplazar el botón de pagar por encima de la tarjeta */
  body.hoy-cp-active {
    padding-bottom: calc(200px + var(--hoy-cp-cookie-offset)) !important;
  }

  body.hoy-cp-active.hoy-cp-collapsed {
    padding-bottom: calc(96px + var(--hoy-cp-cookie-offset)) !important;
  }
}

/* Móvil / 390px */
@media (max-width: 767px) {
  #hoy-cp-aviso {
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 16px 16px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    /* safe-area solo si no hay cookie; si hay cookie el offset ya la separa */
    padding-bottom: 0;
  }

  #hoy-cp-aviso .hoy-cp__inner {
    padding: 10px 12px;
    gap: 8px;
  }

  #hoy-cp-aviso .hoy-cp__title { font-size: .95rem; }

  #hoy-cp-aviso .hoy-cp__text {
    font-size: .82rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  #hoy-cp-aviso .hoy-cp__actions { width: 100%; }
  #hoy-cp-aviso .hoy-cp__call { flex: 1; }

  #hoy-cp-aviso.is-collapsed .hoy-cp__title,
  #hoy-cp-aviso.is-collapsed .hoy-cp__text { display: none; }

  #hoy-cp-aviso.is-collapsed .hoy-cp__row { display: none; }

  /* Plegado móvil: 2 filas — etiqueta+Ampliar / Llamar a ancho completo (sin truncar) */
  #hoy-cp-aviso.is-collapsed .hoy-cp__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px 10px;
  }

  #hoy-cp-aviso.is-collapsed .hoy-cp__actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "label toggle"
      "call call";
    gap: 8px;
    width: 100%;
    align-items: center;
  }

  #hoy-cp-aviso.is-collapsed .hoy-cp__collapsed-label {
    display: block;
    grid-area: label;
    margin: 0;
    font-size: .9rem;
    font-weight: 600;
    color: var(--hoy-cp-ink);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    align-self: center;
  }

  #hoy-cp-aviso.is-collapsed .hoy-cp__call {
    grid-area: call;
    flex: none;
    width: 100%;
    max-width: 100%;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    justify-content: center;
    min-height: 44px;
    box-sizing: border-box;
  }

  #hoy-cp-aviso.is-collapsed .hoy-cp__toggle {
    grid-area: toggle;
    flex: none;
    min-height: 44px;
    min-width: 44px;
    justify-self: end;
  }

  body.hoy-cp-active {
    padding-bottom: calc(148px + var(--hoy-cp-cookie-offset) + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* 4 accent + pad 8+10 + gap 8 + 44 + 44 ≈ 118; margen 122 */
  body.hoy-cp-active.hoy-cp-collapsed {
    padding-bottom: calc(122px + var(--hoy-cp-cookie-offset) + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #hoy-cp-aviso { transition: none; }
}
