/**
 * KSC MailerLite Webhook - newsletter sticky bar (front office).
 * Every rule is scoped under #kscmlw-bar or body.kscmlw-bar-open so the
 * theme (Sentez, Bootstrap 4) is never touched globally.
 *
 * @author KSC
 * @license AFL-3.0
 */

/* ---------------------------------------------------------------------
 * Container (fixed to the bottom edge, slides in via transform)
 * ------------------------------------------------------------------ */
#kscmlw-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* Under the sticky header (100), cart drawer (1002) and modals (1050);
     above the back-to-top button (40) and the cookie button (30). */
  z-index: 90;
  background: #f7d7da;
  color: #1d1d1d;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, .08);
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .25s ease;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  box-sizing: border-box;
}

#kscmlw-bar.kscmlw-bar--visible {
  transform: none;
}

#kscmlw-bar[hidden] {
  display: none;
}

/* Elements hidden by JS (e.g. the form after a successful sign-up) */
#kscmlw-bar [hidden] {
  display: none !important;
}

/* Predictable box model for everything inside the bar */
#kscmlw-bar *,
#kscmlw-bar *::before,
#kscmlw-bar *::after {
  box-sizing: border-box;
}

/* ---------------------------------------------------------------------
 * Layout (desktop first; mobile overrides below)
 * ------------------------------------------------------------------ */
#kscmlw-bar .kscmlw-bar__inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  /* Horizontal gap only: vertical rhythm comes from margins so that an
     empty status row never reserves space (it must stay rendered for
     the aria-live region to work). */
  column-gap: 12px;
  row-gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  /* Room for the absolutely positioned close button */
  padding: 0 52px 0 0;
}

#kscmlw-bar .kscmlw-bar__title {
  margin: 0;
  padding: 4px 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: #1d1d1d;
}

#kscmlw-bar .kscmlw-bar__form {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
}

/* ---- E-mail input ---- */
#kscmlw-bar .kscmlw-bar__input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  flex: 1 1 auto;
  width: 320px;
  max-width: 320px;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid #d9b3b8;
  border-radius: 4px;
  background: #fff;
  color: #1d1d1d;
  font: inherit;
  font-size: 15px;
  line-height: 1.2;
  box-shadow: none;
}

#kscmlw-bar .kscmlw-bar__input::placeholder {
  color: #767676;
  opacity: 1;
}

#kscmlw-bar .kscmlw-bar__input:focus {
  border-color: #cf007c;
  box-shadow: none;
}

#kscmlw-bar .kscmlw-bar__input[aria-invalid="true"] {
  border-color: #cf007c;
}

#kscmlw-bar .kscmlw-bar__input:disabled {
  opacity: .7;
}

/* ---- Submit button (theme CTA gradient) ---- */
#kscmlw-bar .kscmlw-bar__btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-block;
  flex: 0 0 auto;
  min-height: 44px;
  margin: 0 0 0 8px;
  padding: 0 20px;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(to right, #ff1083, #cf007c);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.2;
  text-transform: none;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
}

#kscmlw-bar .kscmlw-bar__btn:hover {
  background: linear-gradient(to right, #e80d77, #b8006e);
  color: #fff;
}

#kscmlw-bar .kscmlw-bar__btn:disabled {
  opacity: .65;
  cursor: default;
}

/* ---- Close button (top-right corner of the inner box) ---- */
#kscmlw-bar .kscmlw-bar__close {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #1d1d1d;
  font: inherit;
  font-size: 26px;
  line-height: 1;
  text-transform: none;
  cursor: pointer;
  box-shadow: none;
}

#kscmlw-bar .kscmlw-bar__close:hover {
  background: rgba(0, 0, 0, .06);
  color: #1d1d1d;
}

/* ---- Consent note and status line (full-width rows) ---- */
#kscmlw-bar .kscmlw-bar__consent {
  flex: 0 0 100%;
  width: 100%;
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.4;
  opacity: .85;
  text-align: center;
}

#kscmlw-bar .kscmlw-bar__status {
  flex: 0 0 100%;
  width: 100%;
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  outline: none; /* receives programmatic focus only */
}

/* An empty status takes no space (block with no content has 0 height) */
#kscmlw-bar .kscmlw-bar__status:empty {
  margin: 0;
}

#kscmlw-bar .kscmlw-bar__status--error {
  color: #b3004f;
}

/* ---- Accessible-only label (clip pattern) ---- */
#kscmlw-bar .kscmlw-bar__label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Honeypot (off-screen, never display:none so bots still fill it) ---- */
#kscmlw-bar .kscmlw-bar__hp {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Keyboard focus ---- */
#kscmlw-bar .kscmlw-bar__input:focus-visible,
#kscmlw-bar .kscmlw-bar__btn:focus-visible,
#kscmlw-bar .kscmlw-bar__close:focus-visible {
  outline: 2px solid #cf007c;
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
 * Mobile (theme breakpoint: max-width 991px) - everything stacked
 * ------------------------------------------------------------------ */
@media (max-width: 991px) {
  #kscmlw-bar {
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  #kscmlw-bar .kscmlw-bar__inner {
    display: block;
    padding: 0;
  }

  /* Title + close share the first row */
  #kscmlw-bar .kscmlw-bar__title {
    margin: 0 0 4px;
    padding: 2px 40px 0 0;
    font-size: 15px;
  }

  #kscmlw-bar .kscmlw-bar__close {
    top: -4px;
    right: -8px;
  }

  #kscmlw-bar .kscmlw-bar__form {
    display: block;
  }

  #kscmlw-bar .kscmlw-bar__input {
    width: 100%;
    max-width: none;
    height: 42px;
    min-height: 42px;
    font-size: 16px; /* >= 16px prevents the iOS zoom-on-focus */
  }

  #kscmlw-bar .kscmlw-bar__btn {
    display: block;
    width: 100%;
    min-height: 42px;
    margin: 8px 0 0;
  }

  #kscmlw-bar .kscmlw-bar__consent {
    margin: 4px 0 0;
    text-align: left;
  }

  #kscmlw-bar .kscmlw-bar__status {
    text-align: left;
  }
}

/* ---------------------------------------------------------------------
 * Page adjustments while the bar is open (height set by JS)
 * ------------------------------------------------------------------ */
body.kscmlw-bar-open {
  padding-bottom: var(--kscmlw-bar-h, 0px);
}

/* Lift the theme's back-to-top button above the bar */
body.kscmlw-bar-open .tvbottom-to-top {
  bottom: calc(30px + var(--kscmlw-bar-h, 0px)) !important;
}

/* Lift the cookie-settings button (seigicookie) above the bar */
body.kscmlw-bar-open #cookie-change-button {
  bottom: calc(10px + var(--kscmlw-bar-h, 0px)) !important;
}

/* ---------------------------------------------------------------------
 * Motion preferences
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  #kscmlw-bar {
    transition: none;
  }
}
