/* ============================================
   VixViu Motion Containers - Base Styles
   ============================================ */

/* Base container styles (borrowed from Paralactyl, adapted with motion prefix) */
.motion-container-element,
.motion-container-widget {
  width: 100%;
  min-height: 200px;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: transparent;
  display: block;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

/* Motion container widget styles (borrowed from Paralactyl, adapted with motion prefix) */
.elementor-widget-motion-containers-css .motion-container-widget {
  position: relative !important;
  width: 100%;
  min-height: 200px;
  display: block;
}

/* Widget panel styles (borrowed from Reactivity, adapted with motion prefix) */
.motion-panel-content {
  background-color: #1e1e1e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 18px;
  max-width: 1200px;
  width: 90%;
  max-height: 95vh;
  min-height: 80vh;
  overflow-y: auto;
  position: relative;
  z-index: 1000000;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  font-family: Roboto, Arial, Helvetica, sans-serif;
}

.motion-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999999;
}

.motion-panel-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  padding: 8px;
  border-radius: 3px;
  transition: all 0.2s ease;
  z-index: 1000001;
}

.motion-panel-close-btn:hover {
  background-color: #333;
  color: #fff;
}

/* Panel sections (borrowed from Reactivity, adapted with motion prefix) */
.motion-section {
  margin-bottom: 18px;
}

.motion-section:last-child {
  margin-bottom: 0;
}

/* Selection controls (borrowed from Reactivity, adapted with motion prefix) */
.motion-selection-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.motion-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.motion-control-label {
  font-size: 12px;
  font-weight: 500;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.motion-control-select {
  background-color: #2a2a2a;
  border: 1px solid #333;
  border-radius: 3px;
  color: #fff;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
  cursor: pointer;
}

.motion-control-select:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.motion-control-select option {
  background-color: #2a2a2a;
  color: #fff;
  padding: 8px;
}

.motion-control-select option:checked {
  background-color: #007cba;
  color: #fff;
}

.motion-control-select option:hover {
  background-color: #333;
}

/* CSS generation field (borrowed from Reactivity, adapted with motion prefix) */
.motion-css-field {
  background-color: #2a2a2a;
  border: 1px solid #333;
  border-radius: 3px;
  color: #fff;
  padding: 8px 12px;
  font-size: 14px;
  font-family: 'Courier New', monospace;
  width: 100%;
  box-sizing: border-box;
  cursor: text;
  user-select: all;
}

.motion-css-field:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

/* Copy button (borrowed from Reactivity, adapted with motion prefix) */
.motion-copy-button {
  background-color: #007cba;
  border: none;
  border-radius: 3px;
  color: #fff;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.motion-copy-button:hover {
  background-color: #005a87;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.motion-copy-button:disabled {
  background-color: #666;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Success and error messages (borrowed from Reactivity, adapted with motion prefix) */
.motion-copy-success,
.motion-copy-error {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 4px;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.motion-copy-success {
  background: #4CAF50;
  color: white;
}

.motion-copy-error {
  background: #f44336;
  color: white;
}

/* Preview description (borrowed from Reactivity, adapted with motion prefix) */
.motion-preview-description {
  background-color: #2a2a2a;
  border: 1px solid #333;
  border-radius: 3px;
  color: #ccc;
  padding: 12px;
  font-size: 14px;
  line-height: 1.4;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Loading states (borrowed from Paralactyl, adapted with motion prefix) */
.motion-loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007cba;
  border-radius: 50%;
  animation: motion-spin 1s linear infinite;
  z-index: 1000;
}

@keyframes motion-spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.motion-error-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #f44336;
  font-size: 14px;
  text-align: center;
  z-index: 1000;
}

.motion-success-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #4CAF50;
  font-size: 14px;
  text-align: center;
  z-index: 1000;
}

/* Debug system (borrowed from Reactivity, adapted with motion prefix) */
.motion-debug-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.motion-debug-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: #ccc;
  user-select: none;
}

.motion-debug-checkbox {
  display: none;
}

.motion-debug-slider {
  position: relative;
  width: 40px;
  height: 20px;
  background-color: #333;
  border-radius: 10px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.motion-debug-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background-color: #ccc;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.motion-debug-checkbox:checked + .motion-debug-slider {
  background-color: #007cba;
}

.motion-debug-checkbox:checked + .motion-debug-slider::before {
  transform: translateX(20px);
  background-color: #fff;
}

.motion-debug-text {
  font-size: 12px;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.motion-debug-label:hover .motion-debug-text {
  color: #fff;
}

.motion-debug-label:hover .motion-debug-slider {
  background-color: #444;
}

/* Accessibility features (borrowed from Paralactyl, adapted with motion prefix) */
.motion-accessibility-features {
  /* High contrast support */
  @media (prefers-contrast: high) {
    .motion-container-element {
      border: 2px solid #000;
    }
    
    .motion-panel-content {
      border: 2px solid #fff;
    }
  }
}

/* Reduced motion support (borrowed from Paralactyl, adapted with motion prefix) */
@media (prefers-reduced-motion: reduce) {
  .motion-container-element,
  .motion-container-element * {
    animation: none !important;
    transition: none !important;
    will-change: auto !important;
  }
  
  .motion-loading-indicator {
    animation: none !important;
  }
}

/* Mobile responsive (borrowed from Paralactyl, adapted with motion prefix) */
@media (max-width: 768px) {
  .motion-container-element {
    min-height: 150px;
  }
  
  .motion-container-element[data-mobile-behavior="disable"] {
    will-change: auto !important;
    transform: none !important;
  }
  
  .motion-panel-content {
    width: 95%;
    max-height: 90vh;
    padding: 12px;
  }
  
  .motion-selection-controls {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .motion-control-select,
  .motion-css-field {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* Focus management (borrowed from Paralactyl, adapted with motion prefix) */
.motion-container-element:focus-within {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

.motion-panel-overlay:focus-visible {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* Elementor integration (borrowed from Paralactyl, adapted with motion prefix) */
.elementor-widget-motion-containers-css .motion-container-element {
  position: relative !important;
}

.elementor-editor-active .motion-panel-overlay {
  pointer-events: auto;
}

.elementor-editor-active .motion-container-widget::before {
  content: 'Motion Containers CSS Library';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  font-size: 14px;
  text-align: center;
  pointer-events: none;
  z-index: 1;
}

/* Performance optimizations (borrowed from Paralactyl, adapted with motion prefix) */
.motion-container-element {
  /* Hardware acceleration */
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
  
  /* Smooth rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Touch optimizations (borrowed from Paralactyl, adapted with motion prefix) */
@media (max-width: 768px) and (-webkit-touch-callout: none) {
  .motion-container-element[data-mobile-behavior="enable"] {
    /* iOS-specific optimizations */
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translateZ(0);
  }
}

/* Print styles (borrowed from Paralactyl, adapted with motion prefix) */
@media print {
  .motion-container-element {
    /* Disable animations for print */
    animation: none !important;
    transition: none !important;
    will-change: auto !important;
    transform: none !important;
  }
  
  .motion-panel-overlay {
    display: none !important;
  }
}

/* Browser-specific optimizations (borrowed from Paralactyl, adapted with motion prefix) */
@supports (-webkit-backdrop-filter: blur(1px)) {
  .motion-panel-overlay {
    backdrop-filter: blur(4px);
  }
}

@supports (-webkit-touch-callout: none) {
  .motion-container-element {
    /* iOS-specific optimizations */
    -webkit-overflow-scrolling: touch;
  }
}

@-moz-document url-prefix() {
  .motion-container-element {
    /* Firefox-specific optimizations */
    transform: translateZ(0);
  }
}

@supports (-ms-ime-align: auto) {
  .motion-container-element {
    /* Edge-specific optimizations */
    transform: translateZ(0);
  }
}

/* High contrast mode support (borrowed from Paralactyl, adapted with motion prefix) */
@media (prefers-contrast: high) {
  .motion-container-element {
    border: 2px solid currentColor;
  }
  
  .motion-panel-content {
    border: 2px solid currentColor;
  }
  
  .motion-control-select,
  .motion-css-field {
    border: 2px solid currentColor;
  }
}

/* Focus styles for keyboard navigation (borrowed from Paralactyl, adapted with motion prefix) */
.motion-container-element:focus-visible {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

.motion-control-select:focus-visible,
.motion-css-field:focus-visible,
.motion-copy-button:focus-visible {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* Screen reader support (borrowed from Paralactyl, adapted with motion prefix) */
.motion-container-element[role="img"] {
  /* Ensure screen readers can access the element */
  pointer-events: auto;
}

/* Loading and error states for containers (borrowed from Paralactyl, adapted with motion prefix) */
.motion-container-element.loading {
  position: relative;
}

.motion-container-element.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.motion-container-element.error {
  border: 2px solid #f44336;
  background-color: rgba(244, 67, 54, 0.1);
}

/* Animation container specific styles */
.motion-container-element[data-animation-type="entrance"] {
  /* Entrance animations start hidden */
  opacity: 0;
  transform: scale(0.8);
}

.motion-container-element[data-animation-type="exit"] {
  /* Exit animations start visible */
  opacity: 1;
  transform: scale(1);
}

.motion-container-element[data-animation-type="interaction"] {
  /* Interaction animations start in normal state */
  opacity: 1;
  transform: scale(1);
  cursor: pointer;
}

/* Performance mode styles */
.motion-container-element[data-performance-mode="low"] {
  /* Low performance mode - disable animations */
  animation: none !important;
  transition: none !important;
  will-change: auto !important;
}

.motion-container-element[data-performance-mode="high"] {
  /* High performance mode - enable all optimizations */
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

/* Disabled state */
.motion-container-element[data-enabled="false"] {
  opacity: 0.5;
  pointer-events: none;
}

.motion-container-element[data-enabled="false"]::before {
  content: 'Animation Disabled';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
  z-index: 1;
}

/* Debug mode styles */
.motion-container-element[data-debug="true"] {
  border: 2px dashed #007cba;
  background-color: rgba(0, 124, 186, 0.1);
}

.motion-container-element[data-debug="true"]::after {
  content: attr(data-animation-name);
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: #007cba;
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: bold;
  z-index: 1000;
} 

/* ===== GHOST WIDGET STYLES ===== */

/* Ghost widget appearance in Elements panel */
.motion-preset-utility-widget {
  cursor: pointer;
  transition: all 0.3s ease;
}

.motion-preset-utility-widget:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.motion-preset-launcher {
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.motion-preset-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  border-color: rgba(255, 255, 255, 0.3);
}

.motion-preset-launcher.clicked {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
  transition: all 0.1s ease;
}

.motion-preset-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.motion-preset-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.motion-preset-description {
  font-size: 12px;
  opacity: 0.9;
}

/* ===== UTILITY MODAL STYLES ===== */

.motion-utility-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.motion-utility-panel {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
}

.motion-utility-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.motion-utility-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.motion-utility-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s ease;
}

.motion-utility-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.motion-utility-content {
  padding: 30px;
}

.motion-preset-dropdown,
.motion-css-class-display,
.motion-copy-section {
  margin-bottom: 20px;
}

.motion-preset-dropdown label,
.motion-css-class-display label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.motion-preset-dropdown select,
.motion-css-class-display input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e1e5e9;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.motion-preset-dropdown select:focus,
.motion-css-class-display input:focus {
  outline: none;
  border-color: #667eea;
}

.motion-css-class-display input {
  background: #f8f9fa;
  color: #495057;
}

.motion-copy-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
  width: 100%;
}

.motion-copy-btn:hover {
  background: #5a6fd8;
}

.motion-copy-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
}

/* ===== ELEMENTOR EDITOR DRAG PREVENTION ===== */
.elementor-panel .elementor-element-motion_containers_preset {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.elementor-panel .elementor-element-motion_containers_preset .elementor-widget-draggable {
  pointer-events: none !important;
} 