/**
 * RetroPlay Effects System CSS
 * Visual effects canvas and controls styling
 */

/* ===== EFFECTS CANVAS ===== */
#effectsCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: var(--effect-intensity, 0.6);
  transition: opacity 0.5s ease;
}

/* Hide canvas when effects are disabled */
#effectsCanvas.hidden {
  display: none !important;
}

/* Accessibility: Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  #effectsCanvas {
    display: none !important;
  }
}

/* Light theme - reduce effect intensity */
[data-theme="light"] #effectsCanvas {
  opacity: calc(var(--effect-intensity, 0.6) * 0.5);
}

/* ===== EFFECTS CONTROLS IN THEME DROPDOWN ===== */
.effects-controls {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.effects-control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.effects-control-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.effects-control-label i {
  color: var(--accent-primary);
  font-size: 0.9rem;
}

/* Toggle Switch */
.effects-toggle {
  position: relative;
  width: 40px;
  height: 22px;
}

.effects-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.effects-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 22px;
  transition: all 0.3s ease;
}

.effects-toggle-slider::before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.effects-toggle input:checked + .effects-toggle-slider {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-color: var(--accent-primary);
}

.effects-toggle input:checked + .effects-toggle-slider::before {
  transform: translateX(18px);
  background-color: #fff;
}

.effects-toggle input:focus + .effects-toggle-slider {
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

/* Effect Selector Dropdown */
.effect-selector-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.effect-selector-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.effect-selector-label i {
  color: var(--accent-primary);
  font-size: 0.8rem;
}

.effect-selector {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.75rem;
}

.effect-selector:hover {
  border-color: var(--accent-primary);
  background-color: var(--bg-tertiary, var(--bg-secondary));
}

.effect-selector:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.effect-selector option {
  padding: 0.5rem;
  background: var(--bg-card, var(--bg-secondary));
  color: var(--text-primary);
}

/* Light theme selector adjustments */
[data-theme="light"] .effect-selector {
  background-color: #f9fafb;
  border-color: #e5e7eb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
}

[data-theme="light"] .effect-selector:hover {
  background-color: #f3f4f6;
}

/* Slider Controls */
.effects-sliders {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.3s ease;
}

.effects-sliders.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.effect-slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.effect-slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.effect-slider-label span:last-child {
  color: var(--accent-primary);
  font-weight: 500;
}

/* Custom Range Slider */
.effect-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  outline: none;
  transition: all 0.2s ease;
}

.effect-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

.effect-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
}

.effect-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

.effect-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.effect-slider::-moz-range-track {
  background: var(--bg-secondary);
  border-radius: 2px;
  height: 4px;
}

/* Slider Fill Effect */
.effect-slider {
  background: linear-gradient(
    to right,
    var(--accent-primary) 0%,
    var(--accent-primary) var(--slider-fill, 50%),
    var(--bg-secondary) var(--slider-fill, 50%),
    var(--bg-secondary) 100%
  );
}

/* ===== FLOATING CONTROLS PANEL (Alternative) ===== */
.effects-panel-floating {
  position: fixed;
  bottom: 100px;
  right: 20px;
  z-index: 999;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  min-width: 200px;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.effects-panel-floating.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.effects-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.effects-panel-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.effects-panel-title i {
  color: var(--accent-primary);
}

.effects-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  transition: color 0.2s;
}

.effects-panel-close:hover {
  color: var(--text-primary);
}

/* ===== MOBILE ADJUSTMENTS ===== */
@media (max-width: 768px) {
  .effects-controls {
    padding: 0.5rem;
  }

  .effects-control-label {
    font-size: 0.75rem;
  }

  .effect-slider-label {
    font-size: 0.7rem;
  }

  /* Hide controls on mobile bottom sheet */
  .effects-panel-floating {
    bottom: 90px;
    right: 10px;
    left: 10px;
    min-width: auto;
  }
}

/* ===== THEME-SPECIFIC EFFECT HINTS ===== */
/* These classes can be used to show which effect is active for the current theme */
.effect-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(139, 92, 246, 0.1);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.effect-indicator i {
  color: var(--accent-primary);
}

.effect-indicator .effect-name {
  color: var(--text-primary);
  font-weight: 500;
}

/* Effect type icons */
[data-effect="neon-grid"] .effect-icon::before { content: "\f0c8"; } /* fa-grid */
[data-effect="bubbles"] .effect-icon::before { content: "\f773"; } /* fa-water */
[data-effect="digital-rain"] .effect-icon::before { content: "\f121"; } /* fa-code */
[data-effect="falling-leaves"] .effect-icon::before { content: "\f06c"; } /* fa-leaf */
[data-effect="floating-embers"] .effect-icon::before { content: "\f06d"; } /* fa-fire */
[data-effect="stars"] .effect-icon::before { content: "\f005"; } /* fa-star */
[data-effect="soft-particles"] .effect-icon::before { content: "\f5ba"; } /* fa-spa */
[data-effect="vintage-dust"] .effect-icon::before { content: "\f0f4"; } /* fa-mug-hot */
[data-effect="snowflakes"] .effect-icon::before { content: "\f2dc"; } /* fa-snowflake */

/* Light theme adjustments for controls */
[data-theme="light"] .effects-toggle-slider {
  background-color: #e5e7eb;
  border-color: #d1d5db;
}

[data-theme="light"] .effects-toggle-slider::before {
  background-color: #9ca3af;
}

[data-theme="light"] .effect-slider {
  background: linear-gradient(
    to right,
    var(--accent-primary) 0%,
    var(--accent-primary) var(--slider-fill, 50%),
    #e5e7eb var(--slider-fill, 50%),
    #e5e7eb 100%
  );
}

[data-theme="light"] .effects-panel-floating {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}
