/* ================================================================
   CYBER4YOU — Popup Form Unificato
   Full-screen cinematic modal — dark premium / cyber aesthetic
   ================================================================ */

/* ─── Overlay ─── */
.c4y-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .5s cubic-bezier(.22,1,.36,1), visibility .5s;
}

.c4y-popup-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/* ─── Close button ─── */
.c4y-popup-close {
  position: fixed;
  top: 1.5rem;
  right: 1.75rem;
  z-index: 10010;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(229,231,235,.7);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s, transform .35s cubic-bezier(.34,1.56,.64,1);
  line-height: 1;
  font-family: inherit;
}
.c4y-popup-close:hover {
  background: rgba(255,255,255,.14);
  color: #fff;
  transform: rotate(90deg) scale(1.1);
}

/* ─── Left panel — branding & context ─── */
.c4y-popup-left {
  width: 42%;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 3.5rem 3.5rem 3rem;
  background: #0a0d15;
  transform: translateX(-80px) scale(.97);
  opacity: 0;
  transition:
    transform .7s cubic-bezier(.22,1,.36,1) .1s,
    opacity .55s ease .1s;
  flex-shrink: 0;
}
.c4y-popup-overlay.is-open .c4y-popup-left {
  transform: translateX(0) scale(1);
  opacity: 1;
}

/* Animated perspective grid */
.c4y-popup-grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(137,107,173,.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(137,107,173,.1) 1px, transparent 1px);
  background-size: 52px 52px;
  animation: gridPan 18s linear infinite;
  transform: perspective(600px) rotateX(12deg);
  transform-origin: top center;
}
@keyframes gridPan {
  0%   { background-position: 0 0; }
  100% { background-position: 0 52px; }
}

/* Scanlines */
.c4y-popup-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0,.06) 2px,
    rgba(0,0,0,.06) 3px
  );
  pointer-events: none;
}

/* Gradient layers */
.c4y-popup-left-grad {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 140% 70% at 0% 100%, rgba(110,58,245,.25) 0%, transparent 55%),
    radial-gradient(ellipse 90% 90% at 100% 0%, rgba(137,107,173,.14) 0%, transparent 50%),
    linear-gradient(180deg, rgba(10,13,21,.3) 0%, transparent 40%, rgba(10,13,21,.7) 100%);
  pointer-events: none;
}

/* Floating glow orbs */
.c4y-popup-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}
.c4y-popup-orb-1 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(110,58,245,.22) 0%, transparent 70%);
  top: -120px; left: -120px;
  animation: orb1 10s ease-in-out infinite alternate;
}
.c4y-popup-orb-2 {
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(137,107,173,.18) 0%, transparent 70%);
  bottom: 80px; right: -80px;
  animation: orb2 13s ease-in-out infinite alternate;
}
.c4y-popup-orb-3 {
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(0,255,136,.07) 0%, transparent 70%);
  top: 45%; left: 30%;
  animation: orb3 8s ease-in-out infinite alternate;
}
@keyframes orb1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, -40px) scale(1.12); }
}
@keyframes orb2 {
  from { transform: translate(0, 0); }
  to   { transform: translate(-20px, 25px) scale(1.08); }
}
@keyframes orb3 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(15px, -20px) scale(1.15); }
}

/* Left content */
.c4y-popup-left-inner {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.c4y-popup-left-logo {
  margin-bottom: auto;
  padding-bottom: 4rem;
}
.c4y-popup-left-logo img {
  height: 30px;
  width: auto;
  filter: brightness(1.1);
}

/* Mode badge */
.c4y-popup-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .9rem;
  background: rgba(137,107,173,.12);
  border: 1px solid rgba(137,107,173,.28);
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #b09dd4;
  margin-bottom: 1.5rem;
  transition: opacity .25s ease, transform .3s ease;
}

/* Mode icon — SVG linea bianca */
.c4y-popup-mode-icon {
  width: 58px;
  height: 58px;
  margin-bottom: 1.5rem;
  display: block;
  filter: drop-shadow(0 0 18px rgba(255,255,255,.18)) drop-shadow(0 0 6px rgba(137,107,173,.4));
  transition: opacity .25s ease, transform .3s ease;
}
.c4y-popup-mode-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Mode title */
.c4y-popup-left-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.7rem, 2.8vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.1;
  color: #fff;
  margin-bottom: .9rem;
  transition: opacity .25s ease, transform .3s ease;
}

/* Mode description */
.c4y-popup-left-desc {
  color: rgba(229,231,235,.55);
  font-size: .95rem;
  line-height: 1.65;
  max-width: 360px;
  margin-bottom: 2.5rem;
  transition: opacity .25s ease, transform .3s ease;
}

/* Trust badges */
.c4y-popup-trust-list {
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.c4y-popup-trust-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .82rem;
  color: rgba(229,231,235,.5);
}
.c4y-popup-trust-item svg {
  width: 15px;
  height: 15px;
  stroke: #896BAD;
  fill: none;
  stroke-width: 2.5;
  flex-shrink: 0;
}

/* ─── Right panel — form ─── */
.c4y-popup-right {
  flex: 1;
  background: #141720;
  display: flex;
  flex-direction: column;
  padding: 5rem 3.5rem 3rem 3rem;
  overflow-y: auto;
  transform: translateX(80px) scale(.97);
  opacity: 0;
  transition:
    transform .7s cubic-bezier(.22,1,.36,1) .2s,
    opacity .55s ease .2s;
  border-left: 1px solid rgba(255,255,255,.04);
}
.c4y-popup-overlay.is-open .c4y-popup-right {
  transform: translateX(0) scale(1);
  opacity: 1;
}

/* Right header */
.c4y-popup-right-header {
  margin-bottom: 1.75rem;
}
.c4y-popup-right-header h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
  margin-bottom: .3rem;
}
.c4y-popup-right-header p {
  color: rgba(229,231,235,.45);
  font-size: .88rem;
}

/* ─── Email field con verifica MX ─── */
.c4y-popup-input-wrap { position: relative; }
.c4y-popup-input-wrap input { padding-right: 2.5rem; }
.c4y-popup-email-icon {
  position: absolute;
  right: .85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  line-height: 1;
  pointer-events: none;
  display: inline-block;
}
.c4y-popup-email-icon.spin {
  color: rgba(255,165,0,.9);
  animation: emailSpin .8s linear infinite;
}
@keyframes emailSpin { to { transform: translateY(-50%) rotate(360deg); } }
.c4y-popup-email-icon.ok { color: #00ff88; font-size: 1rem; }

/* Border states for email field */
.c4y-popup-field.field-checking input { border-color: rgba(255,165,0,.5) !important; box-shadow: 0 0 0 3px rgba(255,165,0,.08) !important; }
.c4y-popup-field.field-ok input       { border-color: rgba(0,255,136,.35) !important; box-shadow: 0 0 0 3px rgba(0,255,136,.06) !important; }
.c4y-popup-field.field-mx-err input   { border-color: rgba(255,51,85,.5)  !important; box-shadow: 0 0 0 3px rgba(255,51,85,.08)  !important; }

/* ─── Optgroup / option — color-scheme:dark ensures browser renders dark picker ─── */

/* ─── Form ─── */
.c4y-popup-form-inner {
  display: flex;
  flex-direction: column;
  gap: 1.9rem;
  flex: 1;
}

.c4y-popup-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
}

.c4y-popup-field {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.c4y-popup-field label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(107,114,128,.85);
}
.c4y-popup-field input,
.c4y-popup-field select,
.c4y-popup-field textarea {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 11px;
  padding: .82rem 1rem;
  color: #e5e7eb;
  font-size: .93rem;
  font-family: inherit;
  transition: border-color .25s, background .25s, box-shadow .25s;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}
.c4y-popup-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(107,114,128,0.7)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 16px;
  padding-right: 2.5rem;
  color-scheme: dark;
}
.c4y-popup-field select option { background: #1b1f2e; color: #e5e7eb; }
.c4y-popup-field select optgroup { background: #141720; color: rgba(137,107,173,.9); }
.c4y-popup-field input:focus,
.c4y-popup-field select:focus,
.c4y-popup-field textarea:focus {
  outline: none;
  border-color: rgba(137,107,173,.6);
  background: rgba(137,107,173,.05);
  box-shadow: 0 0 0 3px rgba(137,107,173,.1);
}
.c4y-popup-field textarea {
  resize: vertical;
  min-height: 90px;
}
.c4y-popup-field input::placeholder,
.c4y-popup-field textarea::placeholder { color: rgba(107,114,128,.5); }

.c4y-popup-field-error {
  font-size: .73rem;
  color: #ff3355;
  letter-spacing: .02em;
}

/* Privacy */
.c4y-popup-privacy {
  display: flex;
  align-items: flex-start;
  gap: 0;
  font-size: .8rem;
  color: rgba(229,231,235,.45);
  cursor: pointer;
  line-height: 1.45;
}
.c4y-popup-privacy input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.c4y-popup-privacy span {
  position: relative;
  padding-left: 1.65rem;
  display: block;
}
.c4y-popup-privacy span::before {
  content: '';
  position: absolute;
  left: 0;
  top: .05rem;
  width: 17px;
  height: 17px;
  border: 1px solid rgba(229,231,235,.3);
  border-radius: 4px;
  background: rgba(255,255,255,.04);
  transition: border-color .2s, background .2s;
}
.c4y-popup-privacy input:checked ~ span::before {
  border-color: rgba(229,231,235,.45);
  background: rgba(255,255,255,.06);
}
.c4y-popup-privacy input:checked ~ span::after {
  content: '';
  position: absolute;
  left: 6px;
  top: .2rem;
  width: 4px;
  height: 9px;
  border: solid rgba(229,231,235,.85);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.c4y-popup-privacy:hover span::before {
  border-color: rgba(229,231,235,.5);
}
.c4y-popup-privacy input:focus-visible ~ span::before {
  outline: 2px solid rgba(137,107,173,.6);
  outline-offset: 1px;
}
.c4y-popup-consent-note {
  font-size: .72rem;
  line-height: 1.45;
  color: rgba(229,231,235,.35);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin: -.25rem 0 0;
}
.c4y-popup-privacy a { color: #896BAD; }
.c4y-popup-privacy a:hover { color: #d4bcec; }

/* Submit button */
.c4y-popup-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 1rem 2.5rem;
  background: linear-gradient(135deg, #896BAD 0%, #6e3af5 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: .98rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .3s cubic-bezier(.22,1,.36,1), box-shadow .3s;
  position: relative;
  overflow: hidden;
  margin-top: .25rem;
  background-size: 200% 100%;
}
.c4y-popup-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.18) 0%, transparent 60%);
  opacity: 0;
  transition: opacity .3s;
}
.c4y-popup-submit:hover::after { opacity: 1; }
.c4y-popup-submit:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 32px rgba(110,58,245,.45);
}
.c4y-popup-submit:active:not(:disabled) { transform: scale(.99); }
.c4y-popup-submit:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Spinner */
.c4y-popup-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: popupSpin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes popupSpin { to { transform: rotate(360deg); } }

/* Error message */
.c4y-popup-error-msg {
  background: rgba(255,51,85,.07);
  border: 1px solid rgba(255,51,85,.2);
  border-radius: 11px;
  padding: .82rem 1rem;
  color: #ff6680;
  font-size: .87rem;
  line-height: 1.4;
}

/* ─── Success state ─── */
.c4y-popup-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  gap: 1rem;
  flex: 1;
  animation: successFade .5s ease;
}
@keyframes successFade {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.c4y-popup-success-icon {
  font-size: 4rem;
  line-height: 1;
  animation: successPop .5s cubic-bezier(.34,1.56,.64,1);
  filter: drop-shadow(0 0 20px rgba(0,255,136,.4));
}
@keyframes successPop {
  from { transform: scale(.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.c4y-popup-success h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
}
.c4y-popup-success p {
  color: rgba(229,231,235,.55);
  font-size: .95rem;
  max-width: 320px;
  line-height: 1.6;
}
.c4y-popup-success-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .7rem 1.75rem;
  border-radius: 999px;
  border: 1px solid rgba(137,107,173,.35);
  color: #b09dd4;
  font-size: .85rem;
  font-family: inherit;
  font-weight: 600;
  background: rgba(137,107,173,.08);
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
  margin-top: .5rem;
}
.c4y-popup-success-btn:hover {
  background: rgba(137,107,173,.18);
  border-color: rgba(137,107,173,.55);
  color: #d4bcec;
}

/* ─── Responsive ─── */
@media (max-width: 960px) {
  .c4y-popup-left { display: none; }
  .c4y-popup-right {
    padding: 5.5rem 1.5rem 2rem;
    transform: scale(.97);
    opacity: 0;
  }
  .c4y-popup-overlay.is-open .c4y-popup-right {
    transform: scale(1);
    opacity: 1;
  }
}
@media (max-width: 520px) {
  .c4y-popup-tabs { grid-template-columns: repeat(2, 1fr); }
  .c4y-popup-form-row { grid-template-columns: 1fr; }
  .c4y-popup-close { top: .85rem; right: .9rem; width: 40px; height: 40px; font-size: 1.3rem; }
}

/* ─── Focus-visible accessibility ─── */
.c4y-popup-tab:focus-visible {
  outline: 2px solid rgba(137,107,173,.7);
  outline-offset: 2px;
}
.c4y-popup-close:focus-visible {
  outline: 2px solid rgba(137,107,173,.7);
  outline-offset: 2px;
}
