/* ===========================================
   Smart Email Capture — Frontend Styles
   Theme-aware via CSS custom properties
   =========================================== */

:root {
  --sec-primary:        #C79679;
  --sec-primary-dark:   #a87760;
  --sec-primary-rgb:    199, 150, 121;
  --sec-on-primary:     #ffffff;
  --sec-surface:        #ffffff;
  --sec-surface-2:      #faf6f4;
  --sec-text:           #2c2220;
  --sec-text-muted:     #8c7e79;
  --sec-border:         rgba(0,0,0,.08);
  --sec-shadow:         0 24px 64px rgba(0,0,0,.14);
  --sec-radius:         16px;
  --sec-radius-sm:      10px;
  --sec-transition:     .28s cubic-bezier(.4,0,.2,1);
  --sec-font:           inherit;
}

/* ── Reset */
.sec-overlay, .sec-popup, .sec-inline-wrap, .sec-inline, .sec-form { box-sizing: border-box; font-family: var(--sec-font); }
.sec-overlay *, .sec-inline-wrap * { box-sizing: border-box; }

/* ══════════════════════════════════════
   OVERLAY
══════════════════════════════════════ */
.sec-overlay {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0);
  backdrop-filter: blur(0px);
  transition: background .35s ease, backdrop-filter .35s ease;
  pointer-events: none; visibility: hidden;
}
.sec-overlay.is-visible {
  background: rgba(30,20,16,.48);
  backdrop-filter: blur(8px);
  pointer-events: all; visibility: visible;
}

/* ══════════════════════════════════════
   POPUP CARD
══════════════════════════════════════ */
.sec-popup {
  position: relative;
  background: var(--sec-surface);
  border-radius: var(--sec-radius);
  box-shadow: var(--sec-shadow);
  padding: 52px 44px 42px;
  max-width: 460px; width: 92%;
  text-align: center;
  transform: translateY(36px) scale(.95);
  opacity: 0;
  transition: transform .42s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
  will-change: transform, opacity;
  overflow: hidden;
}
.sec-overlay.is-visible .sec-popup { transform: translateY(0) scale(1); opacity: 1; }

/* Position variants */
.sec-popup--bottom-right  { position: fixed; bottom: 24px; right: 24px; top: auto; transform: translateY(20px) scale(.95); }
.sec-popup--bottom-left   { position: fixed; bottom: 24px; left: 24px;  top: auto; transform: translateY(20px) scale(.95); }
.sec-popup--bottom-center { position: fixed; bottom: 24px; left: 50%;   top: auto; transform: translateX(-50%) translateY(20px) scale(.95); }
.sec-overlay.is-visible .sec-popup--bottom-right,
.sec-overlay.is-visible .sec-popup--bottom-left { transform: translateY(0) scale(1); }
.sec-overlay.is-visible .sec-popup--bottom-center { transform: translateX(-50%) translateY(0) scale(1); }

/* Top accent gradient */
.sec-popup::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--sec-primary), var(--sec-primary-dark));
  border-radius: var(--sec-radius) var(--sec-radius) 0 0;
}

/* Decorative corner glow */
.sec-popup::after {
  content: ''; position: absolute;
  top: -60px; right: -60px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(var(--sec-primary-rgb),.12) 0%, transparent 70%);
  border-radius: 50%; pointer-events: none;
}

/* Anim variants */
.sec-anim--fade .sec-popup { transition: opacity .35s ease; transform: none; }
.sec-overlay.is-visible .sec-anim--fade .sec-popup { opacity: 1; }
.sec-anim--zoom .sec-popup { transform: scale(.7); }
.sec-overlay.is-visible .sec-anim--zoom .sec-popup { transform: scale(1); opacity: 1; }

/* ── Close */
.sec-close {
  position: absolute; top: 16px; right: 16px;
  width: 34px; height: 34px;
  background: var(--sec-surface-2); border: 1px solid var(--sec-border);
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--sec-text-muted);
  transition: background var(--sec-transition), color var(--sec-transition), transform .22s;
  z-index: 2;
}
.sec-close:hover { background: var(--sec-primary); color: var(--sec-on-primary); transform: rotate(90deg) scale(1.08); border-color: transparent; }

/* ── Icon */
.sec-popup__icon { margin: 0 auto 22px; width: 68px; height: 68px; }
.sec-popup__icon svg { width: 100%; height: 100%; }
.sec-icon-bg       { fill: var(--sec-surface-2); }
.sec-icon-envelope { fill: none; stroke: var(--sec-primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.sec-icon-fold     { fill: none; stroke: var(--sec-primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.sec-popup__icon svg { animation: sec-float 3s ease-in-out infinite; }
@keyframes sec-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ── Typography */
.sec-popup__headline {
  margin: 0 0 8px; font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 700; color: var(--sec-text); line-height: 1.3;
  letter-spacing: -.02em;
}
.sec-popup__sub {
  margin: 0 0 28px; font-size: .93rem;
  color: var(--sec-text-muted); line-height: 1.55;
}

/* ── Input */
.sec-input-wrap { position: relative; width: 100%; }
.sec-input {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--sec-border);
  border-radius: var(--sec-radius-sm);
  font-size: .93rem; font-family: var(--sec-font);
  color: var(--sec-text); background: var(--sec-surface-2);
  outline: none; box-sizing: border-box;
  transition: border-color var(--sec-transition), box-shadow var(--sec-transition), background var(--sec-transition);
}
.sec-input::placeholder { color: var(--sec-text-muted); opacity: .7; }
.sec-input:focus {
  border-color: var(--sec-primary);
  box-shadow: 0 0 0 4px rgba(var(--sec-primary-rgb),.12);
  background: var(--sec-surface);
}
.sec-input--error { border-color: #d45050 !important; box-shadow: 0 0 0 3px rgba(212,80,80,.12) !important; }

.sec-input-focus-bar {
  display: block; position: absolute;
  bottom: 0; left: 50%; width: 0; height: 2px;
  background: var(--sec-primary); border-radius: 2px;
  transition: width .3s ease, left .3s ease;
}
.sec-input:focus ~ .sec-input-focus-bar { width: 100%; left: 0; }

/* ── Button */
.sec-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 26px;
  background: linear-gradient(135deg, var(--sec-primary), var(--sec-primary-dark));
  color: var(--sec-on-primary);
  border: none; border-radius: var(--sec-radius-sm);
  font-size: .93rem; font-weight: 600; font-family: var(--sec-font);
  cursor: pointer; position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 4px 18px rgba(var(--sec-primary-rgb),.32);
  white-space: nowrap; min-width: 140px;
}
.sec-btn::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,.12); opacity: 0;
  transition: opacity .2s;
}
.sec-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(var(--sec-primary-rgb),.42); }
.sec-btn:hover::after { opacity: 1; }
.sec-btn:hover .sec-btn__arrow { transform: translateX(3px); }
.sec-btn:active { transform: translateY(0); }

.sec-btn__arrow { transition: transform .2s ease; flex-shrink: 0; }

.sec-btn .sec-ripple {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.3);
  transform: scale(0); animation: sec-ripple .6s linear;
  pointer-events: none;
}
@keyframes sec-ripple { to { transform: scale(4); opacity: 0; } }

.sec-btn__spinner {
  display: none; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: sec-spin .7s linear infinite;
}
@keyframes sec-spin { to { transform: rotate(360deg); } }
.sec-btn.is-loading .sec-btn__text { opacity: 0; }
.sec-btn.is-loading .sec-btn__arrow { display: none; }
.sec-btn.is-loading .sec-btn__spinner { display: block; }

/* ── GDPR */
.sec-gdpr {
  margin: 16px 0 0; font-size: .76rem;
  color: var(--sec-text-muted); display: flex;
  align-items: center; justify-content: center; gap: 5px;
}
.sec-gdpr__icon { flex-shrink: 0; opacity: .6; }

/* ── Success */
.sec-success-msg {
  display: none; flex-direction: column;
  align-items: center; gap: 14px;
  padding: 24px 0 10px;
  animation: sec-fade-up .4s ease;
}
.sec-success-msg.is-visible { display: flex; }
@keyframes sec-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.sec-success-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--sec-primary), var(--sec-primary-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  animation: sec-pop .4s cubic-bezier(.34,1.56,.64,1);
}
.sec-success-icon svg { width: 24px; height: 24px; }
@keyframes sec-pop { from { transform: scale(0); } to { transform: scale(1); } }
.sec-success-text { font-size: 1rem; font-weight: 600; color: var(--sec-text); text-align: center; line-height: 1.5; }

/* Error */
.sec-error-msg {
  margin: 8px 0 0; font-size: .82rem; color: #c94040;
  display: none; animation: sec-shake .35s ease;
}
.sec-error-msg.is-visible { display: block; }
@keyframes sec-shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-5px); } 40%,80% { transform: translateX(5px); } }

/* ══════════════════════════════════════
   INLINE FORM (Posts)
══════════════════════════════════════ */
.sec-inline-wrap {
  margin: 2.5em 0; opacity: 0; transform: translateY(28px);
  transition: opacity .5s ease, transform .5s cubic-bezier(.4,0,.2,1);
  will-change: opacity, transform;
}
.sec-inline-wrap.is-visible { opacity: 1; transform: translateY(0); }
.sec-inline-anim--slide-in { transform: translateX(-36px); }
.sec-inline-anim--slide-in.is-visible { transform: translateX(0); }
.sec-inline-anim--none { opacity: 1; transform: none; transition: none; }

.sec-inline {
  background: var(--sec-surface);
  border: 1px solid var(--sec-border);
  border-radius: var(--sec-radius);
  padding: 34px 36px 28px;
  box-shadow: 0 6px 28px rgba(0,0,0,.06);
  position: relative; overflow: hidden;
}

/* Left accent */
.sec-inline::before {
  content: ''; position: absolute;
  top: 0; left: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--sec-primary), var(--sec-primary-dark));
  border-radius: var(--sec-radius) 0 0 var(--sec-radius);
}

/* Subtle corner glow */
.sec-inline::after {
  content: ''; position: absolute;
  bottom: -40px; right: -40px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(var(--sec-primary-rgb),.08) 0%, transparent 70%);
  border-radius: 50%; pointer-events: none;
}

.sec-inline__body {
  display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px;
}
.sec-inline__icon {
  flex-shrink: 0; width: 46px; height: 46px;
  background: var(--sec-surface-2); border: 1px solid var(--sec-border);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center; padding: 10px;
}
.sec-inline__icon svg { width: 100%; height: 100%; }

.sec-inline__headline {
  margin: 0 0 4px; font-size: 1.1rem; font-weight: 700;
  color: var(--sec-text); letter-spacing: -.01em;
}
.sec-inline__sub { margin: 0; font-size: .88rem; color: var(--sec-text-muted); line-height: 1.5; }

.sec-inline__fields { display: flex; gap: 10px; flex-wrap: wrap; }
.sec-inline__fields .sec-input-wrap { flex: 1 1 220px; }
.sec-inline__fields .sec-btn { flex-shrink: 0; }

/* Popup form layout */
.sec-popup .sec-form { text-align: left; }
.sec-popup .sec-form .sec-input-wrap { margin-bottom: 12px; }

/* ── Responsive */
@media (max-width: 600px) {
  .sec-popup { padding: 36px 22px 28px; }
  .sec-inline { padding: 26px 18px 22px; }
  .sec-inline__body { flex-direction: column; gap: 10px; }
  .sec-inline__fields { flex-direction: column; }
  .sec-inline__fields .sec-btn { width: 100%; }
  .sec-popup--bottom-right, .sec-popup--bottom-left { left: 12px; right: 12px; bottom: 12px; }
  .sec-popup--bottom-center { left: 12px; right: 12px; transform: none; }
  .sec-overlay.is-visible .sec-popup--bottom-center { transform: none; }
}

/* ── Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --sec-surface:    #1e1b19;
    --sec-surface-2:  #2a2523;
    --sec-text:       #ede6e2;
    --sec-text-muted: #9a908a;
    --sec-border:     rgba(255,255,255,.08);
    --sec-shadow:     0 24px 64px rgba(0,0,0,.4);
  }
}
