/* ============================================================
   CouponCraft Frontend — Base Styles
   All template-specific styles live in assets/css/templates/
   ============================================================ */

/* ── CSS Variables (overridden per-display via inline style) ── */
.cc-display {
  --cc-bg:         #ffffff;
  --cc-text:       #333333;
  --cc-accent:     #e44d3a;
  --cc-btn-bg:     #e44d3a;
  --cc-btn-text:   #ffffff;
  --cc-radius:     8px;
  --cc-font:       inherit;

  font-family: var(--cc-font);
  box-sizing: border-box;
}
.cc-display *, .cc-display *::before, .cc-display *::after { box-sizing: border-box; }

/* ── Code Block ───────────────────────────────────────────── */
.cc-code-block {
  display: flex; align-items: center;
  background: #f8fafc; border: 1.5px dashed #cbd5e1;
  border-radius: 6px; padding: 6px 8px; gap: 8px; margin: 12px 0;
  max-width: 340px;
}
.cc-code-block--inline { max-width: none; display: inline-flex; margin: 0; }
.cc-code-block--compact { padding: 4px 8px; margin: 8px 0; }
.cc-code-text {
  font-family: 'Courier New', monospace; font-weight: 700; letter-spacing: .08em;
  font-size: 1rem; color: var(--cc-text); flex: 1; user-select: all;
}

/* ── Copy Button ──────────────────────────────────────────── */
.cc-copy-btn {
  background: var(--cc-btn-bg); color: var(--cc-btn-text);
  border: none; border-radius: 5px; padding: 7px 14px;
  font-size: .8125rem; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .1s; white-space: nowrap;
  flex-shrink: 0;
}
.cc-copy-btn:hover   { opacity: .9; }
.cc-copy-btn:active  { transform: scale(.97); }
.cc-copy-btn--sm     { padding: 4px 10px; font-size: .75rem; }
.cc-copy-btn--xs     { padding: 3px 8px;  font-size: .7rem; }
.cc-copy-btn.copied  { background: #22c55e; }

/* ── Badge ────────────────────────────────────────────────── */
.cc-card-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--cc-accent); color: #fff; font-size: .7rem;
  font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 8px;
}

/* ── Common text classes ──────────────────────────────────── */
.cc-card-discount  { font-size: 2rem; font-weight: 800; color: var(--cc-accent); line-height: 1; margin-bottom: 4px; }
.cc-card-headline  { font-size: 1.125rem; font-weight: 700; color: var(--cc-text); margin: 4px 0 6px; }
.cc-card-subtext   { font-size: .875rem; color: #64748b; margin: 0 0 8px; }
.cc-card-expiry    { font-size: .8rem; color: #dc2626; margin: 6px 0 0; }
.cc-big-discount   { display: block; font-size: 3rem; font-weight: 800; color: var(--cc-accent); text-align: center; margin: 12px 0; }

/* ── Overlay / Modal ──────────────────────────────────────── */
.cc-popup-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0,0,0,.55); display: flex;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.cc-popup-overlay.cc-visible {
  opacity: 1; pointer-events: auto;
}
.cc-popup-modal {
  position: relative; background: var(--cc-bg); color: var(--cc-text);
  border-radius: var(--cc-radius); padding: 36px 32px;
  max-width: 480px; width: calc(100vw - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  text-align: center;
  animation: cc-modal-in .3s ease;
}
.cc-popup-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; font-size: 1.1rem; cursor: pointer;
  color: #94a3b8; transition: color .15s;
}
.cc-popup-close:hover { color: var(--cc-text); }

/* ── Countdown Timer ──────────────────────────────────────── */
.cc-countdown-timer {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 16px 0;
}
.cc-cd-segment { text-align: center; }
.cc-cd-value   { display: block; font-size: 2rem; font-weight: 800; color: var(--cc-accent); line-height: 1; }
.cc-cd-unit    { display: block; font-size: .65rem; text-transform: uppercase; color: #94a3b8; letter-spacing: .06em; }
.cc-cd-sep     { font-size: 1.5rem; font-weight: 700; color: var(--cc-accent); margin-top: -4px; }
.cc-countdown-inline { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: .875rem; color: var(--cc-accent); }

/* ── Email Gate Form ──────────────────────────────────────── */
.cc-email-gate { margin: 16px 0; }
.cc-email-gate-form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.cc-email-gate-form input[type=email] {
  padding: 10px 14px; border: 1.5px solid #cbd5e1; border-radius: 6px;
  font-size: .875rem; flex: 1; min-width: 200px;
}
.cc-email-gate-form input:focus { outline: none; border-color: var(--cc-accent); }
.cc-btn--primary {
  background: var(--cc-btn-bg); color: var(--cc-btn-text);
  border: none; border-radius: 6px; padding: 10px 20px;
  font-size: .875rem; font-weight: 600; cursor: pointer;
  transition: opacity .15s;
}
.cc-btn--primary:hover { opacity: .9; }
.cc-btn--ghost {
  background: transparent; border: 1.5px solid #cbd5e1; border-radius: 6px;
  padding: 8px 16px; font-size: .8125rem; color: #94a3b8; cursor: pointer; margin-top: 8px;
}
.cc-btn--ghost:hover { background: #f8fafc; }

/* ── Powered By ───────────────────────────────────────────── */
.cc-powered-by {
  text-align: center; margin-top: 12px; font-size: .7rem;
}
.cc-powered-by a { color: #94a3b8; text-decoration: none; }
.cc-powered-by a:hover { text-decoration: underline; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes cc-modal-in {
  from { transform: translateY(20px) scale(.96); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes cc-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes cc-slide-up {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes cc-slide-down {
  from { transform: translateY(-30px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes cc-bounce {
  0%,100% { transform: translateY(0); }
  40%      { transform: translateY(-12px); }
  70%      { transform: translateY(-5px); }
}
@keyframes cc-pulse-ring {
  0%   { transform: scale(.9); box-shadow: 0 0 0 0 rgba(228,77,58,.6); }
  70%  { box-shadow: 0 0 0 12px rgba(228,77,58,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(228,77,58,0); }
}

.cc-anim-fade     { animation: cc-fade-in .4s ease both; }
.cc-anim-slide_up { animation: cc-slide-up .4s ease both; }
.cc-anim-slide_down { animation: cc-slide-down .4s ease both; }
.cc-anim-bounce   { animation: cc-bounce .6s ease both; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .cc-popup-modal { padding: 24px 18px; }
  .cc-cd-value    { font-size: 1.5rem; }
  .cc-code-text   { font-size: .875rem; }
}
