/* =============================================================================
 * Homepage component: Newsletter popup (floating card, .kl-popup-*)
 * Split from homepage.css (Issue #5). Enqueued homepage-only via km_enqueue_styles
 * after km-global. Namespace: .kl-popup-*.
 * ========================================================================== */

/* -----------------------------------------
   14. Newsletter popup (floating card)
   ----------------------------------------- */
.kl-popup-wrap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999998;
  opacity: 0;
  transform: translateY(100px);
  transition: opacity 0.4s, transform 0.4s;
  pointer-events: none;
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
}

.kl-popup-wrap.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.kl-popup-card {
  width: 380px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  position: relative;
}

.kl-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
  z-index: 10;
}

.kl-popup-close:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: rotate(90deg);
}

.kl-popup-close svg {
  width: 16px;
  height: 16px;
  color: #666;
}

.kl-popup-header {
  background: linear-gradient(135deg, #fafafa, #f0f0f0);
  padding: 24px 24px 20px;
  border-bottom: 1px solid #e8e8e8;
}

.kl-popup-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--kunst-text-dark);
  margin: 0 0 6px;
  padding-right: 30px;
}

.kl-popup-subtitle {
  font-size: 13px;
  color: #666;
  margin: 0;
}

.kl-popup-body {
  padding: 20px 24px 24px;
}

.kl-popup-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.kl-popup-benefits li {
  font-size: 12px;
  color: #555;
  background: #f5f5f5;
  padding: 4px 10px;
  border-radius: 12px;
}

.kl-popup-benefits li::before {
  content: "\2713 ";
  color: var(--km-accent);
  font-weight: 600;
}

.kl-popup-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kl-popup-err {
  background: #fff5f5;
  color: #c53030;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  display: none;
  border: 1px solid #feb2b2;
}

.kl-popup-err.show {
  display: block;
}

.kl-popup-variant-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kl-popup-variant-fields.hidden {
  display: none;
}

.kl-popup-gender {
  display: flex;
  gap: 14px;
}

.kl-popup-gender-opt {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kl-popup-gender-opt input[type="radio"] {
  accent-color: var(--km-accent);
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}

.kl-popup-gender-opt label {
  font-size: 12px;
  color: #555;
  cursor: pointer;
}

.kl-popup-name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.kl-popup-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
  box-sizing: border-box;
  transition: 0.2s;
}

.kl-popup-input:focus {
  outline: none;
  border-color: var(--km-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(154, 24, 21, 0.08);
}

.kl-popup-input._err {
  border-color: #e53935;
}

.kl-popup-submit {
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--km-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
  position: relative;
}

.kl-popup-submit:hover {
  background: var(--km-accent-hover);
}

.kl-popup-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.kl-popup-submit.loading {
  color: transparent;
}

.kl-popup-submit.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: klPopupSpin 0.8s linear infinite;
}

@keyframes klPopupSpin {
  to { transform: rotate(360deg); }
}

.kl-popup-privacy {
  font-size: 10px;
  color: #999;
  text-align: center;
  margin: 10px 0 0;
  line-height: 1.4;
}

.kl-popup-privacy a {
  color: #666;
  text-decoration: underline;
}

/* Popup success state */
.kl-popup-success {
  display: none;
}

.kl-popup-success.show {
  display: block;
}

.kl-popup-success-header {
  background: linear-gradient(135deg, #f8f8f8, #f0f0f0);
  padding: 30px 24px 24px;
  text-align: center;
  border-bottom: 1px solid #e8e8e8;
}

.kl-popup-success-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--kunst-text-dark);
  margin: 0;
}

.kl-popup-success-body {
  padding: 24px;
  text-align: center;
}

.kl-popup-success-text {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
  margin: 0 0 16px;
}

.kl-popup-success-info {
  background: #fef9e7;
  border: 1px solid #f5d76e;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
}

.kl-popup-success-info svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: #d4a000;
  margin-top: 1px;
}

.kl-popup-success-info-text {
  font-size: 12px;
  color: #856404;
  line-height: 1.4;
}

.kl-popup-success-info-text strong {
  display: block;
  margin-bottom: 2px;
  color: #6d5200;
}

.kl-popup-success-footer {
  padding: 0 24px 24px;
  text-align: center;
}

.kl-popup-success-btn {
  display: inline-block;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--km-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}

.kl-popup-success-btn:hover {
  background: var(--km-accent-hover);
}

/* Newsletter popup — very small screens */
@media screen and (max-width: 480px) {
  .kl-popup-wrap {
    bottom: 10px;
    right: 10px;
    left: 10px;
  }
  .kl-popup-card {
    width: 100%;
    max-width: none;
  }
  .kl-popup-name-row {
    grid-template-columns: 1fr;
  }
  .kl-popup-header {
    padding: 20px 20px 16px;
  }
  .kl-popup-body {
    padding: 16px 20px 20px;
  }
  .kl-popup-title {
    font-size: 20px;
  }
  .kl-popup-success-header {
    padding: 24px 20px 20px;
  }
  .kl-popup-success-title {
    font-size: 22px;
  }
  .kl-popup-success-body, .kl-popup-success-footer {
    padding: 20px;
  }
}
