/* ==========================================================================
   CSPPE — Back to top, cookie notice, 404
   ========================================================================== */

/* ---------- Back to top ---------- */
.csppe-totop {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 39;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  color: var(--color-primary);
  box-shadow: var(--shadow-hover);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.csppe-totop.is-visible { opacity: 1; visibility: visible; transform: none; }
.csppe-totop:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* Below 1100px the call FAB owns the bottom-right corner, so sit above it. */
@media (max-width: 1100px) { .csppe-totop { bottom: 74px; } }

/* ---------- WhatsApp widget ----------
   Uses the CSPPE palette rather than WhatsApp green so the control reads as
   part of the site. The WhatsApp glyph still signals where the button leads. */
.csppe-wa-fab {
  position: fixed;
  right: 16px;
  bottom: 74px;                 /* directly above the back-to-top control */
  z-index: 41;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Same 1px weight as the back-to-top control, in white so it reads as a
     ring against the violet fill. */
  border: 1px solid #fff;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 6px 18px rgba(140, 82, 255, .35);
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.csppe-wa-fab:hover { background: #7C3AED; border-color: #fff; transform: translateY(-1px); }
.csppe-wa-fab:focus-visible { outline: 3px solid var(--color-emergency); outline-offset: 3px; }

/* Height is capped against the viewport and the form scrolls internally, so
   the panel can never be cropped off the top of the screen. */
.csppe-wa-panel {
  position: fixed;
  right: 16px;
  bottom: 136px;
  z-index: 42;
  width: min(320px, calc(100vw - 32px));
  max-height: calc(100vh - 152px);
  max-height: calc(100dvh - 152px);
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease;
}
.csppe-wa-panel.is-open { opacity: 1; transform: none; }
.csppe-wa-panel[hidden] { display: none; }

.csppe-wa-panel__head {
  flex: none;
  background: var(--color-emergency);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.csppe-wa-panel__title {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: 14px;
  line-height: 1.3;
  margin: 0;
}
.csppe-wa-panel__sub { font-size: 11.5px; line-height: 1.4; margin: 2px 0 0; color: rgba(255, 255, 255, .9); }
.csppe-wa-close {
  background: none;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  min-height: 0;
  line-height: 0;
  border-radius: 4px;
  flex-shrink: 0;
}
.csppe-wa-close:hover { background: rgba(255, 255, 255, .18); }

.csppe-wa-form {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}
.csppe-wa-label {
  display: block;
  font-size: 12.5px;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: 4px;
}
.csppe-wa-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;              /* ≥15px keeps iOS from zooming on focus */
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: 9px 11px;
  min-height: 44px;             /* tap target stays 44px */
  margin-bottom: 9px;
}
textarea.csppe-wa-input { resize: vertical; min-height: 62px; }
.csppe-wa-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--ring-primary);
}
.csppe-wa-note { font-size: 11.5px; line-height: 1.45; color: var(--text-muted); margin: -3px 0 10px; }
.csppe-wa-error {
  font-size: 12.5px;
  color: var(--color-error);
  margin: 0 0 8px;
  font-weight: var(--fw-semibold);
}
.csppe-wa-send {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--color-primary);
  color: #fff;
  border: 0;
  border-radius: var(--radius-input);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
.csppe-wa-send:hover { background: #7C3AED; box-shadow: var(--glow-primary); }
.csppe-wa-send svg { width: 17px; height: 17px; flex: none; }
.csppe-wa-urg {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 8px 0 0;
  text-align: center;
}

/* Below 1100px the call FAB takes the bottom slot, so everything shifts up. */
@media (max-width: 1100px) {
  .csppe-wa-fab { bottom: 132px; }
  .csppe-wa-panel {
    bottom: 194px;
    max-height: calc(100vh - 210px);
    max-height: calc(100dvh - 210px);
  }
}
@media (max-width: 420px) {
  .csppe-wa-panel { right: 10px; left: 10px; width: auto; }
}
/* Short viewports: drop the subtitle and helper copy rather than crop. */
@media (max-height: 620px) {
  .csppe-wa-panel__sub,
  .csppe-wa-note { display: none; }
  textarea.csppe-wa-input { min-height: 54px; }
}

/* ---------- Cookie notice ---------- */
.csppe-cookie {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-float);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .2s ease, transform .2s ease;
}
.csppe-cookie.is-open { opacity: 1; transform: none; }
.csppe-cookie[hidden] { display: none; }

.csppe-cookie__inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.csppe-cookie__title {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: 15px;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.csppe-cookie__text { flex: 1 1 420px; min-width: 0; }
.csppe-cookie__text p { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin: 0; }
.csppe-cookie__text a { color: var(--color-accent); }
.csppe-cookie__actions { display: flex; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }
.csppe-cookie__actions .csppe-btn { font-size: 13px; padding: 10px 18px; }

@media (max-width: 767px) {
  .csppe-cookie { left: 10px; right: 10px; bottom: 10px; }
  .csppe-cookie__inner { padding: 16px; gap: 14px; }
  .csppe-cookie__actions { width: 100%; }
  .csppe-cookie__actions .csppe-btn { flex: 1 1 auto; }
}

/* ---------- 404 ---------- */
.csppe-404card {
  display: block;
  padding: 20px;
  text-decoration: none;
}
.csppe-404card h2 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: 16px;
  color: var(--text-primary);
  margin: 0 0 6px;
}
.csppe-404card p { font-size: 13px; color: var(--text-secondary); margin: 0; }
.csppe-404card:hover h2 { color: var(--color-primary); }
