/**
 * Reusable Guitar Fretboard Framework - CSS Styles
 * 
 * Core styling for the fretboard framework components
 */

/* Fretboard Container */
.fretboard-container {
  display: inline-block;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Fretboard Background */
.fretboard-background {
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Strings */
.string {
  border-radius: 1px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Nut */
.nut {
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Frets */
.fret {
  border-radius: 1px;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
}

/* End Cap */
.end-cap {
  border-radius: 1px;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}

/* Fret Markers */
.fret-marker {
  opacity: 0.6;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.fret-marker-12 {
  opacity: 0.8;
}

/* Fret Numbers */
.fret-number {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  pointer-events: none;
}

/* Dots */
.dot {
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.dot:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.dot.open-string {
  box-shadow: 0 0 0 2px currentColor, 0 2px 6px rgba(0, 0, 0, 0.2);
}

.dot.open-string:hover {
  transform: scale(1.1);
  box-shadow: 0 0 0 2px currentColor, 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* Fretboard Dots (used by framework) */
.fretboard-dot {
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.fretboard-dot:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

/* User-added dots have distinctive styling */
.fretboard-dot.user-dot {
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.fretboard-dot.user-dot:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
}

/* Click targets for empty fret positions */
.fret-click-target {
  position: absolute;
  cursor: pointer;
  z-index: 5;
  background: transparent;
  border: none;
  pointer-events: auto;
  border-radius: 50%;
  transition: background-color 0.1s ease;
}

.fret-click-target:hover {
  background: rgba(52, 152, 219, 0.1);
}

/* Open string dots should look identical to fretted dots - no special styling */

/* Audio playback highlighting */
.fretboard-dot.playing {
  z-index: 20 !important;
  /* Size and shadow are now controlled by JavaScript configuration */
  /* Animation removed to allow configurable highlighting */
}

/* Scale Dots */
.scale-dot {
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.fretboard-container:hover .scale-dot {
  opacity: 0.4;
}

/* Responsive Design */
@media (max-width: 768px) {
  .fretboard-container {
    max-width: 100%;
    max-height: 100vh;
  }
  
  .dot {
    transform: scale(0.9);
  }
  
  .dot:hover {
    transform: scale(1.0);
  }
  
  .fretboard-dot {
    transform: scale(0.9);
  }
  
  .fretboard-dot:hover {
    transform: scale(1.0);
  }
}

/* Animation Classes */
.dot-appear {
  animation: dotAppear 0.3s ease-out;
}

@keyframes dotAppear {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.dot-pulse {
  animation: dotPulse 1s ease-in-out infinite alternate;
}

@keyframes dotPulse {
  from {
    opacity: 0.7;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* Theme Variations */
.fretboard-dark .fretboard-background {
  background: #2d2d2d !important;
}

.fretboard-dark .string {
  background: #666 !important;
}

.fretboard-dark .fret,
.fretboard-dark .end-cap {
  background: #999 !important;
}

.fretboard-dark .nut {
  background: #111 !important;
}

.fretboard-dark .fret-number {
  color: #ccc !important;
}

.fretboard-dark .fret-marker {
  background: rgba(255, 255, 255, 0.2) !important;
}

/* High Contrast Theme */
.fretboard-high-contrast .fretboard-background {
  background: #000 !important;
}

.fretboard-high-contrast .string {
  background: #fff !important;
}

.fretboard-high-contrast .fret,
.fretboard-high-contrast .end-cap,
.fretboard-high-contrast .nut {
  background: #fff !important;
}

.fretboard-high-contrast .fret-number {
  color: #fff !important;
  font-weight: bold;
}

.fretboard-high-contrast .dot {
  background: #ff0 !important;
  color: #000 !important;
  border: 2px solid #000 !important;
}

.fretboard-high-contrast .fretboard-dot {
  background: #ff0 !important;
  color: #000 !important;
  border: 2px solid #000 !important;
}

/* Print Styles */
@media print {
  .fretboard-container {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  
  .dot {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  .fretboard-dot {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  .fret-marker {
    opacity: 1;
  }
}

/* Audio Controls */
.audio-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
  align-items: center;
}

.play-button {
  background: #27ae60;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.play-button:hover {
  background: #229954;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.play-button:active {
  transform: translateY(0);
}

.play-button.playing {
  background: #e74c3c;
}

.play-button.playing:hover {
  background: #c0392b;
}

.play-button:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.play-button .icon {
  font-size: 16px;
}

.stop-button {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.stop-button:hover {
  background: #c0392b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.stop-button:active {
  transform: translateY(0);
}

.audio-mode-selector {
  display: flex;
  gap: 5px;
  margin-left: 20px;
}

.mode-button {
  background: #34495e;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.mode-button:hover {
  background: #2c3e50;
}

.mode-button.active {
  background: #3498db;
}

.mode-button.active:hover {
  background: #2980b9;
}

.tempo-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 20px;
  color: #2c3e50;
  font-size: 14px;
}

.tempo-control label {
  font-weight: bold;
}

.tempo-control input {
  width: 80px;
  padding: 5px 8px;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
}

.tempo-control input:focus {
  outline: none;
  border-color: #3498db;
}

.audio-status {
  margin-left: 20px;
  padding: 8px 12px;
  background: #ecf0f1;
  border-radius: 4px;
  font-size: 12px;
  color: #2c3e50;
}

.audio-status.loading {
  background: #f39c12;
  color: white;
}

.audio-status.ready {
  background: #27ae60;
  color: white;
}

.audio-status.error {
  background: #e74c3c;
  color: white;
}

/* Responsive audio controls */
@media (max-width: 768px) {
  .audio-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .audio-mode-selector {
    margin-left: 0;
    justify-content: center;
  }
  
  .tempo-control {
    margin-left: 0;
    justify-content: center;
  }
  
  .audio-status {
    margin-left: 0;
    text-align: center;
  }
}
