/* --- fretboard.css --- */
/* Estilos compartidos para el mástil de GuitarMind */

/* 1. Contenedor y Scroll */
.fretboard-wrapper {
  position: relative;
  width: 100%;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 20px;
  border-radius: 4px;
  border: 1px solid #eee;
  
  /* Sombras de scroll laterales (Indicadores visuales) */
  background: 
    linear-gradient(to right, white 30%, rgba(255,255,255,0)), 
    linear-gradient(to right, rgba(255,255,255,0), white 70%) 0 100%, 
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.2), rgba(0,0,0,0)), 
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%;
  background-repeat: no-repeat;
  background-color: white;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-position: 0 0, 100% 0, 0 0, 100% 0;
  background-attachment: local, local, scroll, scroll;
  transition: all 0.3s ease;
}

/* Ocultar etiquetas si se solicita */
.fretboard-wrapper.hide-labels .string-label { color: transparent; text-shadow: none; }
.fretboard-hidden { display: none !important; }

/* 2. Estructura del Mástil */
.fretboard {
  display: inline-flex;
  flex-direction: column;
  border: 1px solid #dfe6e9;
  min-width: min-content;
  margin: 0 auto; /* Centrado si sobra espacio */
}

.string-row {
  display: flex;
  height: 40px; /* Altura estándar cómoda */
  background-color: var(--wood, #fcf6e8);
  align-items: center;
  position: relative;
}

/* 3. Etiqueta de cuerda (Izquierda) */
.string-label {
  position: sticky;
  left: 0;
  z-index: 20;
  width: 35px;
  height: 100%;
  background: #f1f2f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
  color: #636e72;
  border-right: 1px solid #b2bec3;
  box-shadow: 2px 0 5px rgba(0,0,0,0.05);
  user-select: none;
}

/* 4. Trastes (Celdas) */
.fret {
  position: relative;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-right: 2px solid var(--wire, #b2bec3);
  flex-shrink: 0;
  cursor: pointer;
}

.fret:hover { background-color: rgba(0,0,0,0.05); }

/* Cejuela (Traste 0) */
.fret[data-fret="0"] {
  width: 40px;
  background: #fff;
  border-right: 6px solid #2d3436;
  z-index: 15;
}

/* 5. Cuerdas (Líneas horizontales) */
.fret::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  background: #636e72;
  z-index: 1;
  pointer-events: none;
}
/* Grosores de cuerda progresivos */
.string-row:nth-child(1) .fret::before { height: 1px; }
.string-row:nth-child(2) .fret::before { height: 1.2px; }
.string-row:nth-child(3) .fret::before { height: 1.5px; }
.string-row:nth-child(4) .fret::before { height: 2px; }
.string-row:nth-child(5) .fret::before { height: 2.5px; }
.string-row:nth-child(6) .fret::before { height: 3.5px; }

/* Corrección visual para la cejuela */
.fret[data-fret="0"]::before { right: -6px; }

/* 6. Inlays (Puntos del diapasón) */
/* Estilo base: Centrado en la cuerda (Correcto para los puntos dobles del traste 12) */
.fret.inlay::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: rgba(0,0,0,0.1);
  border-radius: 50%;
  z-index: 0;
  /* Al no definir top/left, el Flexbox del padre (.fret) lo centra automáticamente */
}

/* REGLA NUEVA: Ajuste para trastes simples (3, 5, 7, 9) */
/* Seleccionamos los inlays que NO estén en el traste 12 */
.fret:not([data-fret="12"]).inlay::after {
  /* Como la fila mide 40px, lo bajamos 20px para situarlo entre esta cuerda y la siguiente */
  transform: translateY(20px);
}

/* 7. Anchos de Trastes (Calculados geométricamente) */
.fret[data-fret="1"] { width: 75px; } .fret[data-fret="2"] { width: 72px; }
.fret[data-fret="3"] { width: 69px; } .fret[data-fret="4"] { width: 66px; }
.fret[data-fret="5"] { width: 63px; } .fret[data-fret="6"] { width: 60px; }
.fret[data-fret="7"] { width: 57px; } .fret[data-fret="8"] { width: 54px; }
.fret[data-fret="9"] { width: 51px; } .fret[data-fret="10"]{ width: 48px; }
.fret[data-fret="11"]{ width: 46px; } .fret[data-fret="12"]{ width: 44px; border-right:none; }

/* 8. Marcadores de Nota (Círculos de respuesta) */
.note-marker {
  width: 26px;
  height: 26px;
  background: var(--marker, #2d3436);
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  z-index: 10;
  
  /* Animación de entrada */
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  /* Bordes para estados del visor */
  border: 3px solid transparent; 
  box-sizing: border-box; 
}

/* Estados de visibilidad */
.fret.active .note-marker,
.fret.correct .note-marker,
.fret.wrong .note-marker,
.fret.hint .note-marker {
  opacity: 1;
  transform: scale(1);
}

/* Colores de estado (sobreescriben background) */
.fret.correct .note-marker { background: var(--success, #00b894); }
.fret.wrong .note-marker { background: var(--error, #d63031); }
.fret.hint .note-marker { 
    background: var(--hint, #0984e3); 
    box-shadow: 0 0 0 3px rgba(9, 132, 227, 0.3); 
}

/* Colores específicos del Visor de Arpegios */
.fret.link-next .note-marker { border-color: var(--next-color, #00b894); box-shadow: 0 0 8px var(--next-color, #00b894); }
.fret.link-prev .note-marker { border-color: var(--prev-color, #ff7675); box-shadow: 0 0 8px var(--prev-color, #ff7675); }
.fret.link-both .note-marker { 
    background: var(--both-color, #fdcb6e) !important; 
    border-color: #e1b12c; 
    color: #2d3436; 
    transform: scale(1.15);
}

/* --- CORRECCIÓN DE CAPAS (Z-INDEX) --- */
/* Esto asegura que si un punto baja hacia la siguiente cuerda,
   se vea ENCIMA y no quede cortado por la madera de abajo. */

.string-row { position: relative; } /* Aseguramos que obedezcan al z-index */

.string-row:nth-child(1) { z-index: 6; }
.string-row:nth-child(2) { z-index: 5; }
.string-row:nth-child(3) { z-index: 4; } /* El punto de aquí caerá sobre la 4 */
.string-row:nth-child(4) { z-index: 3; }
.string-row:nth-child(5) { z-index: 2; }
.string-row:nth-child(6) { z-index: 1; }