/**
 * ComprasGuate Theme — popups (newsletter modal + push opt-in toast).
 * Loaded sitewide.
 */

/* =========================
   NEWSLETTER OVERLAY + MODAL
   ========================= */
.cg-newsletter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.cg-newsletter-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.cg-newsletter-modal {
  background: var(--c-card);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  max-width: 700px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
  transform: scale(0.94);
  transition: transform 0.25s ease;
}
.cg-newsletter-overlay.is-open .cg-newsletter-modal {
  transform: scale(1);
}
@media (max-width: 600px) {
  .cg-newsletter-modal { grid-template-columns: 1fr; max-width: 420px; }
  .cg-newsletter-modal-image { height: 140px; }
}

.cg-newsletter-modal-image {
  background: linear-gradient(135deg, #FBBF24 0%, #F97316 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: #fff;
}

.cg-newsletter-modal-body {
  padding: 32px 28px;
  position: relative;
}
.cg-newsletter-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--c-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}
.cg-newsletter-modal-close:hover {
  background: var(--c-border-soft);
  color: var(--c-text);
}

.cg-newsletter-modal-eyebrow {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-promo-text);
  margin: 0 0 6px;
}
.cg-newsletter-modal-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--c-text);
  margin: 0 0 10px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.cg-newsletter-modal-desc {
  font-size: 13.5px;
  color: var(--c-text-muted);
  line-height: 1.55;
  margin: 0 0 16px;
}

.cg-newsletter-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.cg-newsletter-form input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  min-width: 0;
}
.cg-newsletter-form input:focus {
  outline: 0;
  border-color: var(--c-blue);
  box-shadow: 0 0 0 3px rgba(30, 115, 190, 0.10);
}
.cg-newsletter-form button {
  background: var(--c-promo);
  color: var(--c-promo-text);
  border: 0;
  padding: 11px 22px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.12s;
}
.cg-newsletter-form button:hover { filter: brightness(0.96); }
.cg-newsletter-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cg-newsletter-modal-fine {
  font-size: 11.5px;
  color: var(--c-text-muted);
  margin: 0;
  line-height: 1.5;
}
.cg-newsletter-modal-fine a { color: var(--c-blue); text-decoration: none; font-weight: 600; }
.cg-newsletter-modal-fine a:hover { text-decoration: underline; }

.cg-newsletter-no-thanks {
  background: transparent;
  border: 0;
  font-size: 12px;
  color: var(--c-text-muted);
  cursor: pointer;
  margin-top: 14px;
  padding: 4px 0;
  font-family: inherit;
  text-decoration: underline;
}
.cg-newsletter-no-thanks:hover { color: var(--c-text); }

/* Thank-you state */
.cg-newsletter-thanks { display: none; }
.cg-newsletter-modal[data-state="thanks"] .cg-newsletter-form,
.cg-newsletter-modal[data-state="thanks"] .cg-newsletter-modal-fine,
.cg-newsletter-modal[data-state="thanks"] .cg-newsletter-no-thanks { display: none; }
.cg-newsletter-modal[data-state="thanks"] .cg-newsletter-thanks { display: block; }
.cg-newsletter-modal[data-state="thanks"] .cg-newsletter-modal-eyebrow { color: #16A34A; }

.cg-newsletter-coupon {
  display: inline-block;
  background: var(--c-promo);
  color: var(--c-promo-text);
  padding: 8px 18px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 12px 0 8px;
}

/* Form error message */
.cg-newsletter-error {
  display: none;
  font-size: 12.5px;
  color: var(--c-sale);
  margin: 0 0 8px;
  padding: 8px 12px;
  background: #FEE2E2;
  border-radius: 4px;
}
.cg-newsletter-modal.has-error .cg-newsletter-error { display: block; }

/* =========================
   PUSH NOTIFICATION OPT-IN (bottom-right toast)
   ========================= */
.cg-push-optin {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  width: 340px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  z-index: 9990;
  display: none;
  transform: translateY(20px);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.cg-push-optin.is-open {
  display: block;
  transform: translateY(0);
  opacity: 1;
}
.cg-push-optin-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--c-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-family: inherit;
}
.cg-push-optin-close:hover { color: var(--c-text); }

.cg-push-optin-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #EFF6FF;
  color: var(--c-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}
.cg-push-optin-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--c-text);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.cg-push-optin-desc {
  font-size: 12.5px;
  color: var(--c-text-muted);
  margin: 0 0 14px;
  line-height: 1.5;
}
.cg-push-optin-actions {
  display: flex;
  gap: 8px;
}
.cg-push-optin-allow {
  flex: 1;
  background: var(--c-blue);
  color: #fff;
  border: 0;
  padding: 9px 14px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.cg-push-optin-allow:hover { background: var(--c-blue-dark); }
.cg-push-optin-deny {
  background: transparent;
  border: 0;
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--c-text-muted);
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
}
.cg-push-optin-deny:hover { color: var(--c-text); }

@media (max-width: 480px) {
  .cg-push-optin { left: 16px; right: 16px; width: auto; bottom: 12px; }
}
