/* ==========================================================================
   Modo Edición Visual - Estilos Premium (Elementor/Wix style)
   ========================================================================== */

/* Solo se aplica cuando la clase .icac-visual-editing-active está activa en body */
body.icac-visual-editing-active [data-editable="true"] {
  position: relative;
  outline: 2px dashed rgba(185, 28, 28, 0.35) !important;
  outline-offset: 4px !important;
  cursor: text !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  min-height: 1.5em;
  display: inline-block;
}

body.icac-visual-editing-active [data-editable="true"]:hover {
  outline-color: #b91c1c !important;
  background-color: rgba(185, 28, 28, 0.03) !important;
}

body.icac-visual-editing-active [data-editable="true"]:focus {
  outline: 2px solid #b91c1c !important;
  background-color: rgba(185, 28, 28, 0.06) !important;
  box-shadow: 0 0 0 6px rgba(185, 28, 28, 0.15) !important;
}

/* Insignia flotante estilo Elementor en Hover */
body.icac-visual-editing-active [data-editable="true"]::before {
  content: "✏️ " attr(data-field-label);
  position: absolute;
  top: -24px;
  right: 0;
  background: #b91c1c;
  color: #ffffff;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  z-index: 9999;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body.icac-visual-editing-active [data-editable="true"]:hover::before {
  opacity: 1;
}

/* Elemento modificado (Dirty state) */
body.icac-visual-editing-active [data-editable="true"].is-dirty {
  outline-style: solid !important;
  outline-color: #eab308 !important; /* Yellow-500 indicator for modified element */
}

body.icac-visual-editing-active [data-editable="true"].is-dirty::before {
  content: "⚠️ Modificado (sin guardar)";
  background: #eab308;
  color: #1e293b;
}

/* ──────────────────────────────────────────────────────────────────────────
   Floating Save Action Bar (Barra de Guardado Flotante)
   ────────────────────────────────────────────────────────────────────────── */
.icac-visual-save-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(17, 24, 39, 0.85); /* Charcoal glassmorphism */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 999999;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.3), 0 -8px 10px -6px rgba(0, 0, 0, 0.3);
  font-family: system-ui, -apple-system, sans-serif;
}

.icac-visual-save-bar.is-visible {
  transform: translateY(0);
}

.icac-visual-save-bar__info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icac-visual-save-bar__indicator {
  width: 10px;
  height: 10px;
  background-color: #eab308;
  border-radius: 9999px;
  animation: icac-save-pulse 1.5s infinite ease-in-out;
}

.icac-visual-save-bar__text {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.icac-visual-save-bar__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.icac-visual-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.icac-visual-btn--discard {
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}

.icac-visual-btn--discard:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.icac-visual-btn--save {
  background: #b91c1c;
  color: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(185, 28, 28, 0.3);
}

.icac-visual-btn--save:hover {
  background: #a31d1d;
  transform: translateY(-1px);
  box-shadow: 0 6px 12px -2px rgba(185, 28, 28, 0.4);
}

.icac-visual-btn--save:disabled {
  background: #4b5563;
  color: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Spinner animado para estado de carga */
.icac-save-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: icac-save-spin 0.8s infinite linear;
  display: none;
}

.icac-visual-btn--save.is-saving .icac-save-spinner {
  display: block;
}

/* ──────────────────────────────────────────────────────────────────────────
   Toast Notifications (Notificaciones Emergentes)
   ────────────────────────────────────────────────────────────────────────── */
.icac-visual-toast-container {
  position: fixed;
  top: 2rem;
  right: 2rem;
  display: flex;
  flex-col: column;
  gap: 0.75rem;
  z-index: 9999999;
  pointer-events: none;
  font-family: system-ui, -apple-system, sans-serif;
}

.icac-visual-toast {
  background: #ffffff;
  color: #1f2937;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
  border-left: 4px solid #10b981; /* Green-500 for Success */
}

.icac-visual-toast.is-visible {
  transform: translateX(0);
}

.icac-visual-toast--error {
  border-left-color: #ef4444; /* Red-500 for Error */
}

.icac-visual-toast__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.icac-visual-toast--error .icac-visual-toast__icon {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.icac-visual-toast__text {
  font-size: 0.875rem;
  font-weight: 500;
}

/* ──────────────────────────────────────────────────────────────────────────
   Animaciones del Editor
   ────────────────────────────────────────────────────────────────────────── */
@keyframes icac-save-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.6;
  }
}

@keyframes icac-save-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Custom Switch toggle animations */
.icac-switch input:checked + .icac-switch-slider {
  background-color: #b91c1c !important;
}
.icac-switch input:checked ~ .icac-switch-knob {
  transform: translateX(1rem) !important;
}
