/* Custom Popup - frontend styles */

#cp-popup-root {
  position: fixed;
  z-index: 999999;
  box-sizing: border-box;
}
#cp-popup-root[hidden] { display: none !important; }
#cp-popup-root *, #cp-popup-root *::before, #cp-popup-root *::after { box-sizing: border-box; }

#cp-popup-root .cp-popup {
  position: relative;
  background: #fff;
  color: #222;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  max-width: 100%;
  overflow: hidden;
}

#cp-popup-root .cp-content { padding: 24px; }

#cp-popup-root .cp-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
#cp-popup-root .cp-close:hover { filter: brightness(0.92); }
#cp-popup-root .cp-close:focus-visible { outline: 2px solid #0073aa; outline-offset: 2px; }

/* Overlay (solo modale) */
#cp-popup-root .cp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: -1;
}

/* === Posizioni === */
#cp-popup-root.cp-position-bottom-right { right: 20px; bottom: 20px; left: auto; top: auto; }
#cp-popup-root.cp-position-bottom-right .cp-popup { width: 360px; max-width: calc(100vw - 40px); }

#cp-popup-root.cp-position-bottom-left { left: 20px; bottom: 20px; right: auto; top: auto; }
#cp-popup-root.cp-position-bottom-left .cp-popup { width: 360px; max-width: calc(100vw - 40px); }

#cp-popup-root.cp-position-top-right { right: 20px; top: 20px; left: auto; bottom: auto; }
#cp-popup-root.cp-position-top-right .cp-popup { width: 360px; max-width: calc(100vw - 40px); }

#cp-popup-root.cp-position-center {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#cp-popup-root.cp-position-center .cp-popup {
  width: 520px;
  max-width: 100%;
  max-height: calc(100vh - 40px);
  overflow: auto;
}

#cp-popup-root.cp-position-top-bar { top: 0; left: 0; right: 0; bottom: auto; }
#cp-popup-root.cp-position-top-bar .cp-popup { width: 100%; border-radius: 0; }

#cp-popup-root.cp-position-bottom-bar { bottom: 0; left: 0; right: 0; top: auto; }
#cp-popup-root.cp-position-bottom-bar .cp-popup { width: 100%; border-radius: 0; }

/* === Animazioni === */
#cp-popup-root.cp-animation-fade .cp-popup { animation: cp-fade .25s ease-out both; }
#cp-popup-root.cp-animation-fade .cp-overlay { animation: cp-fade .25s ease-out both; }

#cp-popup-root.cp-animation-slide.cp-position-bottom-right .cp-popup,
#cp-popup-root.cp-animation-slide.cp-position-top-right .cp-popup { animation: cp-slide-right .35s ease-out both; }
#cp-popup-root.cp-animation-slide.cp-position-bottom-left .cp-popup { animation: cp-slide-left .35s ease-out both; }
#cp-popup-root.cp-animation-slide.cp-position-center .cp-popup { animation: cp-zoom .25s ease-out both; }
#cp-popup-root.cp-animation-slide.cp-position-top-bar .cp-popup { animation: cp-slide-down .3s ease-out both; }
#cp-popup-root.cp-animation-slide.cp-position-bottom-bar .cp-popup { animation: cp-slide-up .3s ease-out both; }

#cp-popup-root.cp-animation-none .cp-popup,
#cp-popup-root.cp-animation-none .cp-overlay { animation: none; }

@keyframes cp-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes cp-slide-right { from { transform: translateX(110%); opacity: 0 } to { transform: translateX(0); opacity: 1 } }
@keyframes cp-slide-left  { from { transform: translateX(-110%); opacity: 0 } to { transform: translateX(0); opacity: 1 } }
@keyframes cp-slide-down  { from { transform: translateY(-100%); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
@keyframes cp-slide-up    { from { transform: translateY(100%); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
@keyframes cp-zoom        { from { transform: scale(0.92); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* === Responsive === */
@media (max-width: 600px) {
  #cp-popup-root.cp-position-bottom-right,
  #cp-popup-root.cp-position-bottom-left,
  #cp-popup-root.cp-position-top-right {
    left: 10px;
    right: 10px;
  }
  #cp-popup-root.cp-position-bottom-right .cp-popup,
  #cp-popup-root.cp-position-bottom-left .cp-popup,
  #cp-popup-root.cp-position-top-right .cp-popup {
    width: 100%;
    max-width: 100%;
  }
  #cp-popup-root.cp-position-center { padding: 10px; }
  #cp-popup-root .cp-content { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  #cp-popup-root .cp-popup,
  #cp-popup-root .cp-overlay { animation: none !important; }
}
