/**
 * ELDESK Live Programming Styles
 * Fader controls for real-time DMX manipulation
 */

/* Fader Bank Container */
.fader-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: flex-start;
  padding: 20px;
  background: #2a2a2a;
  border-radius: 8px;
  min-height: 300px;
}

/* Individual Fader Strip */
.fader-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  min-width: 70px;
  transition: all 0.2s;
}

.fader-strip:hover {
  border-color: #4a4a4a;
  background: #242424;
}

.fader-strip:focus-within {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Fader Label */
.fader-label {
  font-size: 0.75rem;
  font-weight: bold;
  text-align: center;
  line-height: 1.2;
  color: #ccc;
  margin-bottom: 4px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fader Input - Desktop (Vertical) */
.fader-input {
  writing-mode: vertical-lr;
  direction: rtl;
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  height: 200px;
  width: 40px;
  background: transparent;
  cursor: pointer;
}

/* Fader Track Styling */
.fader-input::-webkit-slider-runnable-track {
  width: 8px;
  height: 100%;
  background: linear-gradient(to top, #0d6efd 0%, #0d6efd 100%);
  border-radius: 4px;
}

.fader-input::-moz-range-track {
  width: 8px;
  height: 100%;
  background: linear-gradient(to top, #0d6efd 0%, #0d6efd 100%);
  border-radius: 4px;
}

/* Fader Thumb Styling */
.fader-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #fff;
  border: 2px solid #0d6efd;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.15s;
}

.fader-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #fff;
  border: 2px solid #0d6efd;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.15s;
}

.fader-input:hover::-webkit-slider-thumb {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

.fader-input:hover::-moz-range-thumb {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

.fader-input:focus {
  outline: none;
}

.fader-input:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25);
}

.fader-input:focus::-moz-range-thumb {
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25);
}

/* Fader Value Display */
.fader-value {
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
  padding: 6px 12px;
  background: #0d6efd;
  color: #fff;
  border-radius: 4px;
  min-width: 50px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
}

.fader-value.modified {
  background: #0dcaf0;
  animation: pulse 1s ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Color Coding for Channel Types */
.fader-strip.type-intensity {
  border-left: 3px solid #ff0000;
}

.fader-strip.type-pan {
  border-left: 3px solid #00ff00;
}

.fader-strip.type-tilt {
  border-left: 3px solid #0000ff;
}

.fader-strip.type-color {
  border-left: 3px solid #00ffff;
}

.fader-strip.type-gobo {
  border-left: 3px solid #ff00ff;
}

.fader-strip.type-beam {
  border-left: 3px solid #ffff00;
}

.fader-strip.type-generic {
  border-left: 3px solid #888;
}

/* Fixture Checkboxes Styling */
.fixture-checkbox {
  padding: 8px 16px;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  background: #2a2a2a;
  cursor: pointer;
  transition: all 0.2s;
}

.fixture-checkbox:hover {
  background: #3a3a3a;
  border-color: #4a4a4a;
}

.fixture-checkbox input[type="checkbox"] {
  margin-right: 8px;
}

.fixture-checkbox input[type="checkbox"]:checked + label {
  color: #FFD700;
  font-weight: bold;
}

/* Responsive: Tablet */
@media (max-width: 991px) {
  .fader-bank {
    gap: 12px;
  }

  .fader-input {
    height: 150px;
    width: 35px;
  }

  .fader-strip {
    min-width: 60px;
  }
}

/* Responsive: Mobile (Horizontal Faders) */
@media (max-width: 767px) {
  .fader-bank {
    flex-direction: column;
    gap: 10px;
  }

  .fader-strip {
    flex-direction: row;
    width: 100%;
    min-width: 100%;
    padding: 15px;
  }

  .fader-label {
    flex: 0 0 120px;
    text-align: left;
    margin-bottom: 0;
    margin-right: 10px;
  }

  .fader-input {
    writing-mode: horizontal-tb;
    direction: ltr;
    -webkit-appearance: slider-horizontal;
    appearance: slider-horizontal;
    width: 100%;
    height: 44px;
    flex: 1;
  }

  .fader-input::-webkit-slider-runnable-track {
    width: 100%;
    height: 12px;
    background: linear-gradient(to right, #555 0%, #0d6efd 100%);
  }

  .fader-input::-moz-range-track {
    width: 100%;
    height: 12px;
    background: linear-gradient(to right, #555 0%, #0d6efd 100%);
  }

  .fader-input::-webkit-slider-thumb {
    width: 32px;
    height: 32px;
  }

  .fader-input::-moz-range-thumb {
    width: 32px;
    height: 32px;
  }

  .fader-value {
    flex: 0 0 60px;
    margin-left: 10px;
  }

  /* Color coding on top for mobile */
  .fader-strip.type-intensity,
  .fader-strip.type-pan,
  .fader-strip.type-tilt,
  .fader-strip.type-color,
  .fader-strip.type-gobo,
  .fader-strip.type-beam,
  .fader-strip.type-generic {
    border-left: 1px solid #3a3a3a;
    border-top: 3px solid;
  }

  .fader-strip.type-intensity { border-top-color: #ff0000; }
  .fader-strip.type-pan { border-top-color: #00ff00; }
  .fader-strip.type-tilt { border-top-color: #0000ff; }
  .fader-strip.type-color { border-top-color: #00ffff; }
  .fader-strip.type-gobo { border-top-color: #ff00ff; }
  .fader-strip.type-beam { border-top-color: #ffff00; }
  .fader-strip.type-generic { border-top-color: #888; }
}

/* Selected State (GrandMA2-inspired yellow) */
.fader-strip.selected {
  border-color: var(--color-selected);
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
}

/* Modified State (Cyan - in programmer) */
.fader-strip.modified {
  background: rgba(13, 202, 240, 0.05);
}

.fader-strip.modified .fader-label {
  color: var(--color-modified);
}

/* Fixture selection states */
.fixture-checkbox.selected {
  border-color: var(--color-selected);
  background: rgba(255, 215, 0, 0.1);
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
}

.fixture-checkbox.selected label {
  color: var(--color-selected);
  font-weight: bold;
}

.fixture-checkbox input[type="checkbox"]:checked ~ label,
.fixture-checkbox input[type="checkbox"]:checked + label {
  color: var(--color-selected);
  font-weight: bold;
}

/* Loading State */
.fader-strip.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* Empty State */
.fader-bank.empty {
  justify-content: center;
  align-items: center;
}

/* ===== RGB Color Picker ===== */

/* Color Swatch */
.color-swatch {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 2px solid #3a3a3a;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.color-swatch:hover {
  transform: scale(1.1);
  border-color: #4a4a4a;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.color-swatch:active {
  transform: scale(0.95);
}

.color-swatch.selected {
  border-color: #FFD700;
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.3);
}

/* Color picker input */
.form-control-color {
  border: 2px solid #3a3a3a;
  cursor: pointer;
  transition: all 0.2s;
}

.form-control-color:hover {
  border-color: #4a4a4a;
}

.form-control-color:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Mobile responsive for color picker */
@media (max-width: 767px) {
  .color-swatch {
    width: 48px;
    height: 48px;
  }

  #color-picker {
    height: 80px !important;
  }
}

/* ===== Calculator Modal ===== */

.calculator-modal {
  max-width: 380px;
}

.calculator-display {
  margin-bottom: 1.5rem;
}

.calc-input {
  background: #1a3a1a;
  color: #5afa5a;
  font-size: 2rem;
  font-weight: bold;
  text-align: right;
  font-family: 'Courier New', monospace;
  border: 2px solid #2a5a2a;
  padding: 1rem;
  height: auto;
}

.calc-input:focus {
  background: #1a3a1a;
  color: #5afa5a;
  border-color: #3a7a3a;
  box-shadow: 0 0 0 0.2rem rgba(90, 250, 90, 0.25);
}

.calc-mode-toggle {
  margin-top: 0.5rem;
  text-align: center;
}

.calc-mode-toggle .btn {
  min-width: 150px;
}

/* Calculator Numpad */
.calculator-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 1.5rem;
}

.calc-btn {
  background: #2a2a2a;
  border: 2px solid #3a3a3a;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 1.5rem;
  font-weight: bold;
  padding: 0;
  min-height: 60px;
  transition: all 0.15s;
  cursor: pointer;
}

.calc-btn:hover {
  background: #3a3a3a;
  border-color: #4a4a4a;
  transform: translateY(-1px);
}

.calc-btn:active {
  transform: translateY(0);
  background: #4a4a4a;
}

.calc-btn.calc-function {
  background: #1a3a5a;
  border-color: #2a4a6a;
  font-size: 1.1rem;
}

.calc-btn.calc-function:hover {
  background: #2a4a6a;
  border-color: #3a5a7a;
}

/* Calculator Actions */
.calculator-actions {
  display: flex;
  gap: 10px;
}

.calculator-actions .btn {
  flex: 1;
  min-height: 48px;
  font-size: 1rem;
}

/* Mobile responsive for calculator */
@media (max-width: 767px) {
  .calculator-modal {
    margin: 0.5rem;
  }

  .calc-input {
    font-size: 1.75rem;
  }

  .calc-btn {
    min-height: 70px;
    font-size: 1.75rem;
  }

  .calc-btn.calc-function {
    font-size: 1.2rem;
  }
}

/* ===== Fixture Selection Buttons ===== */

.fixture-select-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  background-color: #2d2d2d;
  border: 2px solid #444;
  border-radius: 8px;
  color: #e0e0e0;
  min-width: 150px;
  min-height: 48px;
  padding: 8px 12px;
  margin: 4px;
  transition: all 0.2s ease;
  text-align: left;
  cursor: pointer;
  vertical-align: top;
}

.fixture-select-btn:hover {
  background-color: #3d3d3d;
  border-color: #666;
  transform: scale(1.02);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.fixture-select-btn:active {
  transform: scale(0.98);
}

/* Selected state - Avolites yellow */
.fixture-select-btn.selected {
  background-color: #ffc107;
  border-color: #ffca2c;
  color: #000;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(255, 193, 7, 0.6);
}

.fixture-select-btn.selected:hover {
  background-color: #ffb300;
  border-color: #ffa000;
  box-shadow: 0 0 16px rgba(255, 193, 7, 0.8);
}

/* Icon styling */
.fixture-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.fixture-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fixture-type-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Focus state for accessibility */
.fixture-select-btn:focus-visible {
  outline: 3px solid #0d6efd;
  outline-offset: 2px;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.5);
}

.fixture-select-btn.selected:focus-visible {
  outline-color: #ffc107;
  box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.5);
}

/* Disabled state */
.fixture-select-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button container */
.fixture-button-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  align-items: flex-start;
}

/* Mobile responsive */
@media (max-width: 767px) {
  .fixture-select-btn {
    min-width: calc(50% - 8px);
    min-height: 52px;
    font-size: 1rem;
    gap: 6px;
  }

  .fixture-icon {
    font-size: 1.75rem;
  }

  .fixture-name {
    font-size: 0.95rem;
  }
}

/* Extra small screens - full width buttons */
@media (max-width: 480px) {
  .fixture-select-btn {
    min-width: 100%;
  }
}
