/**
 * Integrity Exterior Solutions - Promo Popup Styles
 * Version: 1.0.0
 */

/* ============================================
   VARIABLES CSS
   ============================================ */
:root {
  --ies-color-primary: #086EA5;
  --ies-color-secondary: #C19A46;
  --ies-color-secondary-hover: #b08b3a;
  --ies-color-white: #FFFFFF;
  --ies-color-text: #1C244B;
  --ies-transition-base: 300ms ease;
  --ies-transition-smooth: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --ies-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ============================================
   ANIMACIONES
   ============================================ */
@keyframes ies-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes ies-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes ies-slide-up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes ies-slide-down {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(20px);
    opacity: 0;
  }
}

@keyframes ies-scale-in {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes ies-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* ============================================
   OVERLAY / BACKDROP
   ============================================ */
.ies-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity var(--ies-transition-smooth), visibility var(--ies-transition-smooth);
}

.ies-popup-overlay.ies-popup-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ies-popup-overlay:not(.ies-popup-hidden) {
  animation: ies-fade-in 0.3s ease-out forwards;
}

.ies-popup-overlay.ies-popup-closing {
  animation: ies-fade-out 0.3s ease-out forwards;
}

/* ============================================
   POPUP CARD
   ============================================ */
.ies-popup-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  background-color: var(--ies-color-primary);
  border-radius: 12px;
  box-shadow: var(--ies-shadow-lg);
  overflow: hidden;
  transform-origin: center center;
}

.ies-popup-overlay:not(.ies-popup-hidden) .ies-popup-card {
  animation: ies-slide-up 0.4s ease-out 0.1s forwards;
  opacity: 0;
}

.ies-popup-overlay.ies-popup-closing .ies-popup-card {
  animation: ies-slide-down 0.3s ease-out forwards;
}

/* ============================================
   CLOSE BUTTON
   ============================================ */
.ies-close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all var(--ies-transition-base);
}

.ies-close-button svg {
  width: 20px;
  height: 20px;
}

.ies-close-button:hover,
.ies-close-button:focus {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.1);
  outline: none;
}

.ies-close-button:focus-visible {
  box-shadow: 0 0 0 2px var(--ies-color-secondary);
}

/* ============================================
   POPUP CONTENT
   ============================================ */
.ies-popup-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

@media (min-width: 640px) {
  .ies-popup-content {
    padding: 2.5rem;
  }
}

/* ============================================
   HEADER
   ============================================ */
.ies-popup-header {
  margin-bottom: 1.5rem;
}

.ies-popup-title {
  margin: 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  color: #FFFFFF;
}

@media (min-width: 640px) {
  .ies-popup-title {
    font-size: 2.25rem;
  }
}

.ies-text-accent {
  color: var(--ies-color-secondary);
}

/* ============================================
   MESSAGE
   ============================================ */
.ies-popup-message-section {
  margin-bottom: 2rem;
}

.ies-popup-message {
  margin: 0;
  font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  color: #FFFFFF;
}

@media (min-width: 640px) {
  .ies-popup-message {
    font-size: 1.125rem;
  }
}

/* ============================================
   OFFER BLOCK
   ============================================ */
.ies-offer-block {
  width: 100%;
  padding: 1.5rem;
  margin-bottom: 2rem;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.ies-offer-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ies-offer-label {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #FFFFFF;
}

.ies-offer-title {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-top: 0.25rem;
}

@media (min-width: 640px) {
  .ies-offer-title {
    font-size: 1.5rem;
  }
}

.ies-offer-value {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ies-color-secondary);
  margin-top: 0.25rem;
}

.ies-offer-divider {
  height: 1px;
  width: 50%;
  margin: 1rem auto;
  background-color: rgba(255, 255, 255, 0.2);
}

.ies-financing-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ies-financing-label {
  font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  color: #FFFFFF;
}

.ies-financing-amount {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ies-color-secondary);
}

/* ============================================
   TRUST SIGNALS
   ============================================ */
.ies-trust-list {
  width: 100%;
  max-width: 300px;
  margin: 0 0 2rem 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.ies-trust-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.375rem 0;
}

.ies-trust-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--ies-color-secondary);
}

.ies-trust-icon svg {
  width: 100%;
  height: 100%;
}

.ies-trust-text {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #FFFFFF;
}

/* ============================================
   ACTION BUTTONS
   ============================================ */
.ies-popup-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ies-cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1rem 2rem;
  background-color: var(--ies-color-secondary);
  color: #FFFFFF;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.125rem;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  transition: all var(--ies-transition-base);
  will-change: transform;
}

.ies-cta-button:hover {
  background-color: var(--ies-color-secondary-hover) !important;
  transform: scale(1.02);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
}

.ies-cta-button:active {
  transform: scale(0.98);
}

.ies-cta-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.ies-decline-link {
  display: block;
  width: 100%;
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.75rem;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 2px;
  cursor: pointer;
  transition: all var(--ies-transition-base);
}

.ies-decline-link:hover {
  color: #FFFFFF;
  text-decoration-color: rgba(255, 255, 255, 0.8);
}

.ies-decline-link:focus-visible {
  outline: none;
  text-decoration-color: #FFFFFF;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* ============================================
   PREVENT BACKGROUND SCROLL
   ============================================ */
body.ies-popup-open {
  overflow: hidden;
  padding-right: var(--ies-scrollbar-width, 0);
}

/* ============================================
   ELEMENTOR EDITOR COMPATIBILITY
   ============================================ */

/* Hacer visible el popup en el editor de Elementor */
.elementor-editor-active .ies-popup-overlay,
.elementor-editor-preview .ies-popup-overlay,
.ies-popup-overlay:not(.ies-popup-hidden) {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  display: flex !important;
}

.elementor-editor-active .ies-popup-overlay .ies-popup-card,
.elementor-editor-preview .ies-popup-overlay .ies-popup-card,
.ies-popup-overlay:not(.ies-popup-hidden) .ies-popup-card {
  opacity: 1;
  transform: translateY(0);
}

/* Asegurar z-index alto en el editor */
.elementor-editor-active .ies-popup-overlay {
  z-index: 99999;
}

/* Estilo para placeholder en el editor cuando está vacío */
.elementor-editor-active .ies-popup-wrapper:empty::before {
  content: 'Promo Popup - Configure los ajustes en el panel lateral';
  display: block;
  padding: 20px;
  background: #f0f0f0;
  border: 2px dashed #ccc;
  text-align: center;
  color: #666;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Tablets */
@media (min-width: 768px) {
  .ies-popup-overlay {
    padding: 2rem;
  }
  
  .ies-popup-title {
    font-size: 2rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .ies-popup-content {
    padding: 2.5rem;
  }
  
  .ies-popup-title {
    font-size: 2.25rem;
  }
  
  .ies-offer-title {
    font-size: 1.5rem;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .ies-popup-overlay,
  .ies-popup-card,
  .ies-close-button,
  .ies-cta-button,
  .ies-decline-link {
    animation: none;
    transition: none;
  }
  
  .ies-popup-overlay.ies-popup-hidden {
    opacity: 0;
  }
  
  .ies-popup-overlay:not(.ies-popup-hidden) {
    opacity: 1;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .ies-popup-card {
    border: 2px solid #FFFFFF;
  }
  
  .ies-cta-button {
    border: 2px solid #FFFFFF;
  }
  
  .ies-offer-block {
    border: 2px solid rgba(255, 255, 255, 0.5);
  }
}

/* Focus Visible Support */
.ies-close-button:focus:not(:focus-visible),
.ies-cta-button:focus:not(:focus-visible),
.ies-decline-link:focus:not(:focus-visible) {
  box-shadow: none;
  outline: none;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.ies-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
