/* ============================================
   VixViu Lyt Stylr - Base Styles
   ============================================ */

.lyt-stylr-element {
  width: 100%;
  min-height: 200px;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: transparent;
  display: block;
  will-change: transform, opacity;
  backface-visibility: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Preview Content Styles */
.lyt-stylr-preview {
  padding: 30px;
  text-align: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.lyt-stylr-preview h3 {
  margin: 0 0 20px 0;
  color: #2c3e50;
  font-size: 24px;
  font-weight: 600;
}

.lyt-stylr-preview p {
  margin: 10px 0;
  color: #34495e;
  font-size: 16px;
  line-height: 1.5;
}

/* CSS Output Section */
.lyt-stylr-css-output {
  margin: 25px 0;
  padding: 20px;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lyt-stylr-css-output label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lyt-stylr-css-class {
  width: 100%;
  padding: 12px;
  border: 2px solid #e1e8ed;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  background: #f8f9fa;
  color: #495057;
  margin-bottom: 10px;
}

.lyt-stylr-copy-btn {
  width: 100%;
  padding: 12px 20px;
  background: #007cba;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lyt-stylr-copy-btn:hover {
  background: #005a87;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 123, 186, 0.3);
}

.lyt-stylr-copy-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 123, 186, 0.3);
}

/* WebGL Canvas Styles */
.lyt-stylr-webgl-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Panel Toggle Button */
.lyt-stylr-panel-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  padding: 8px 12px;
  background: #007cba;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.lyt-stylr-panel-toggle:hover {
  background: #005a87;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 123, 186, 0.3);
}

/* Floating Panel Styles */
.lyt-stylr-floating-panel {
  position: absolute;
  top: 50px;
  right: 10px;
  width: 300px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.lyt-stylr-floating-panel h4 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 16px;
  font-weight: 600;
}

.lyt-stylr-floating-panel label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #555;
  font-size: 13px;
}

.lyt-stylr-floating-panel select,
.lyt-stylr-floating-panel input[type="range"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 15px;
}

.lyt-stylr-floating-panel select:focus,
.lyt-stylr-floating-panel input[type="range"]:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0, 123, 186, 0.2);
}

.lyt-stylr-floating-panel .lyt-stylr-css-output {
  margin: 15px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #e9ecef;
}

.lyt-stylr-floating-panel .lyt-stylr-css-output input {
  margin-bottom: 8px;
  background: white;
}

.lyt-stylr-floating-panel .lyt-stylr-copy-btn {
  width: auto;
  padding: 8px 12px;
  font-size: 12px;
}

.lyt-stylr-floating-panel .lyt-stylr-preview-btn,
.lyt-stylr-floating-panel .lyt-stylr-reset-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.lyt-stylr-floating-panel .lyt-stylr-preview-btn {
  background: #28a745;
  color: white;
}

.lyt-stylr-floating-panel .lyt-stylr-preview-btn:hover {
  background: #218838;
  transform: translateY(-1px);
}

.lyt-stylr-floating-panel .lyt-stylr-reset-btn {
  background: #6c757d;
  color: white;
}

.lyt-stylr-floating-panel .lyt-stylr-reset-btn:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

.lyt-stylr-floating-panel .lyt-stylr-panel-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.lyt-stylr-floating-panel .lyt-stylr-panel-close:hover {
  background-color: #f8f9fa;
}

/* Copy Success Message */
.lyt-stylr-copy-success {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #28a745;
  color: white;
  padding: 10px 20px;
  border-radius: 4px;
  z-index: 9999;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
  animation: lytStylrSlideIn 0.3s ease-out;
}

@keyframes lytStylrSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .lyt-stylr-element {
    min-height: 150px;
  }
  
  .lyt-stylr-preview {
    padding: 20px;
  }
  
  .lyt-stylr-preview h3 {
    font-size: 20px;
  }
  
  .lyt-stylr-preview p {
    font-size: 14px;
  }
  
  .lyt-stylr-floating-panel {
    width: calc(100vw - 40px);
    right: 20px;
    left: 20px;
  }
  
  .lyt-stylr-panel-toggle {
    font-size: 11px;
    padding: 6px 10px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .lyt-stylr-element,
  .lyt-stylr-element * {
    animation: none !important;
    transition: none !important;
    will-change: auto !important;
  }
  
  .lyt-stylr-copy-btn:hover,
  .lyt-stylr-panel-toggle:hover,
  .lyt-stylr-floating-panel .lyt-stylr-preview-btn:hover,
  .lyt-stylr-floating-panel .lyt-stylr-reset-btn:hover {
    transform: none !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .lyt-stylr-element {
    border: 2px solid #000;
  }
  
  .lyt-stylr-preview {
    border: 2px solid #000;
  }
  
  .lyt-stylr-css-output {
    border: 2px solid #000;
  }
}

/* Focus Management */
.lyt-stylr-element:focus-within {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

.lyt-stylr-panel-toggle:focus,
.lyt-stylr-copy-btn:focus,
.lyt-stylr-floating-panel select:focus,
.lyt-stylr-floating-panel input:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* Elementor Integration */
.elementor-widget-lyt_stylr_preset .lyt-stylr-element {
  position: relative !important;
}

.elementor-editor-active .lyt-stylr-element {
  min-height: 200px;
}

/* Loading States */
.lyt-stylr-element.loading {
  opacity: 0.7;
  pointer-events: none;
}

.lyt-stylr-element.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007cba;
  border-radius: 50%;
  animation: lytStylrSpin 1s linear infinite;
}

@keyframes lytStylrSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error States */
.lyt-stylr-element.error {
  border: 2px solid #dc3545;
  background: #f8d7da;
}

.lyt-stylr-element.error::after {
  content: '⚠️ WebGL not supported';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #721c24;
  font-weight: 600;
  text-align: center;
}
