/* ============================================================
   ExitSurvey — Popup Styles
   ============================================================ */
:root {
  --es-brand:   #2563eb;
  --es-brand-2: #3b82f6;
  --es-radius:  18px;
  --es-shadow:  0 25px 60px rgba(0,0,0,.22);
  --es-anim:    .25s cubic-bezier(.4,0,.2,1);
}

/* No-scroll lock */
body.es-no-scroll { overflow: hidden; }

/* ---- Overlay ---- */
.es-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15,10,30,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

/* ---- Popup card ---- */
.es-popup {
  position: relative;
  margin: auto;
  background: #fff;
  border-radius: var(--es-radius);
  box-shadow: var(--es-shadow);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0 0 28px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transform: scale(.94) translateY(12px);
  opacity: 0;
  transition: transform var(--es-anim), opacity var(--es-anim);
}

.es-popup--enter {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Shake animation */
@keyframes es-shake {
  0%,100%{ transform: translateX(0); }
  20%    { transform: translateX(-8px); }
  40%    { transform: translateX(8px); }
  60%    { transform: translateX(-5px); }
  80%    { transform: translateX(5px); }
}
.es-popup--shake { animation: es-shake .35s ease; }

/* ---- Close button ---- */
.es-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.es-close:hover { color: #374151; background: #f3f4f6; }

/* ---- Header ---- */
.es-popup__header {
  text-align: center;
  padding: 32px 28px 20px;
  background: linear-gradient(135deg, var(--es-brand) 0%, var(--es-brand-2) 100%);
  border-radius: var(--es-radius) var(--es-radius) 0 0;
}
.es-popup__icon { font-size: 40px; margin-bottom: 8px; }
.es-popup__title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}
.es-popup__subtitle {
  margin: 0;
  font-size: 14px;
  color: rgba(255,255,255,.8);
}

/* ---- Cart Section ---- */
.es-cart-section {
  margin: 20px 24px 0;
  background: #f8f7ff;
  border: 1px solid #ede9fe;
  border-radius: 12px;
  padding: 14px 16px;
}
.es-cart-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: #374151;
}
.es-cart-items { display: flex; flex-direction: column; gap: 10px; max-height: 200px; overflow-y: auto; }
.es-cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}
.es-cart-item__img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.es-cart-item__info { flex: 1; min-width: 0; }
.es-cart-item__name { font-size: 13px; font-weight: 600; color: #111; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.es-cart-item__meta { font-size: 12px; color: #6b7280; margin-top: 2px; }

.es-cart-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 10px; flex-wrap: wrap; }
.es-cart-total { font-size: 14px; color: #374151; display: flex; gap: 6px; align-items: center; }
.es-cart-total strong { font-size: 18px; color: var(--es-brand); }
.es-btn--cart {
  display: inline-block;
  padding: 8px 18px;
  background: #059669;
  color: #fff !important;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}
.es-btn--cart:hover { background: #047857; }

/* ---- Survey Section ---- */
.es-survey-section { padding: 20px 24px 0; }

.es-question-text {
  font-size: 16px;
  font-weight: 700;
  color: #1e1b4b;
  margin: 0 0 16px;
  line-height: 1.4;
}

/* Radio options */
.es-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.es-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: 14px;
  color: #374151;
}
.es-option:hover { border-color: var(--es-brand); background: #f8f7ff; }
.es-option input[type="radio"] {
  accent-color: var(--es-brand);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}
.es-option:has(input:checked) {
  border-color: var(--es-brand);
  background: #f8f7ff;
  font-weight: 600;
}

/* Open text */
.es-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
  margin-bottom: 16px;
  color: #374151;
}
.es-textarea:focus { border-color: var(--es-brand); }
.es-extra-field { margin-bottom: 20px; }
.es-extra-label { display: block; font-size: 14px; font-weight: 600; color: #4b5563; margin-bottom: 8px; }
.es-extra-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
  color: #374151;
}
.es-extra-input:focus { border-color: var(--es-brand); }

/* ---- Action Buttons ---- */
.es-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.es-btn {
  display: block;
  width: 100%;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-align: center;
  transition: background .15s, transform .1s, opacity .15s;
  text-decoration: none;
  font-family: inherit;
}
.es-btn:active { transform: scale(.98); }

.es-btn--primary {
  background: #2563eb;
  color: #fff;
}
.es-btn--primary:hover { opacity: 0.9; }

.es-btn--ghost {
  background: transparent;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
  padding: 8px;
}
.es-btn--ghost:hover { color: #374151; }

/* ---- Thank You ---- */
.es-thankyou { padding: 32px 24px; text-align: center; }
.es-thankyou__icon { font-size: 56px; margin-bottom: 12px; }
.es-thankyou__msg  { font-size: 18px; font-weight: 700; color: #1e1b4b; margin: 0 0 20px; }

/* ---- Loading ---- */
.es-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--es-radius);
}
@keyframes es-spin { 
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); } 
}
.es-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--es-brand);
  border-radius: 50%;
  animation: es-spin .7s linear infinite;
}

/* ---- Scrollbar (Webkit) ---- */
.es-popup::-webkit-scrollbar { width: 6px; }
.es-popup::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.es-cart-items::-webkit-scrollbar { width: 4px; }
.es-cart-items::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .es-popup { border-radius: 14px; }
  .es-popup__title { font-size: 18px; }
  .es-popup__header { padding: 24px 20px 16px; }
  .es-survey-section { padding: 16px 16px 0; }
  .es-cart-section { margin: 16px 16px 0; }
}

/* ============================================================
   Coupon Banner
   ============================================================ */
@keyframes es-coupon-in {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.es-coupon-banner {
  margin: 16px 0 20px;
  animation: es-coupon-in .35s cubic-bezier(.4,0,.2,1);
}

.es-coupon-banner__label {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: #1e1b4b;
}

/* Badge row: code + copy button */
.es-coupon-badge {
  display: flex;
  align-items: stretch;
  justify-content: center;
  border: 2.5px dashed #f59e0b;
  background: #fefce8;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
}

.es-coupon-badge__code {
  flex: 1;
  padding: 14px 16px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: .12em;
  color: #1e1b4b;
  font-family: 'Courier New', Courier, monospace;
  user-select: all;
  cursor: text;
  background: transparent;
}

.es-coupon-badge__copy {
  padding: 0 16px;
  background: #f59e0b;
  border: none;
  cursor: pointer;
  font-size: 18px;
  border-radius: 0 9px 9px 0;
  transition: background .15s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
}
.es-coupon-badge__copy:hover { background: #d97706; }
.es-coupon-badge__copy:active { transform: scale(.94); }

/* Discount label */
.es-coupon-discount {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: #059669;
}

/* Countdown timer */
.es-countdown-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 0;
}

.es-countdown-label {
  font-size: 13px;
  color: #92400e;
  font-weight: 500;
}

@keyframes es-pulse-timer {
  0%,100% { opacity: 1; }
  50% { opacity: .6; }
}

.es-countdown-timer {
  font-size: 22px;
  font-weight: 900;
  color: #dc2626;
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: .05em;
  animation: es-pulse-timer 1s ease-in-out infinite;
  min-width: 56px;
  text-align: center;
}

/* Expired message */
.es-coupon-expired {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  background: #fff7ed;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid #fed7aa;
}

/* ============================================================
   Persistent Floating Banner
   ============================================================ */
@keyframes es-banner-slide-up {
  from { transform: translateY(150%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.es-floating-coupon-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 999999;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15), 0 8px 10px -6px rgba(0,0,0,0.1);
  padding: 16px 40px 16px 20px;
  display: none; /* Initially hidden, shown via class */
  align-items: center;
  gap: 16px;
  max-width: calc(100vw - 48px);
}

.es-floating-coupon-banner--visible {
  display: flex;
  animation: es-banner-slide-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.es-floating-coupon-banner__content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.es-floating-coupon-banner__icon {
  font-size: 20px;
}

.es-floating-coupon-banner__text {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.es-floating-coupon-banner__badge {
  display: flex;
  align-items: stretch;
  border: 2px dashed #f59e0b;
  background: #fefce8;
  border-radius: 6px;
  overflow: hidden;
}

.es-floating-coupon-banner__code {
  padding: 4px 10px;
  font-family: monospace;
  font-weight: 700;
  font-size: 14px;
  color: #b45309;
  letter-spacing: 0.05em;
  background: transparent;
}

.es-floating-coupon-banner__copy {
  background: #f59e0b;
  border: none;
  color: #fff;
  padding: 0 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.es-floating-coupon-banner__copy:hover {
  background: #d97706;
}

.es-floating-coupon-banner__close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.es-floating-coupon-banner__close:hover {
  color: #475569;
}

@media (max-width: 600px) {
  .es-floating-coupon-banner {
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: none;
    justify-content: center;
  }
}

.es-hidden { display: none; }
