/* ========================================
   PIANO ROLL & VOICE CARDS STYLES
   Beautiful modern design for oscillator editor
   ======================================== */

/* ====== PIANO ROLL CONTAINER ====== */
.piano-roll-container {
  background: linear-gradient(135deg, #0a0a0a 0%, #161618 100%);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 180, 84, 0.1);
}

.piano-roll-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.piano-roll-header h3 {
  color: #4FB58A;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.piano-roll-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.piano-control-btn {
  background: rgba(255, 180, 84, 0.1);
  border: 1px solid rgba(255, 180, 84, 0.3);
  color: #4FB58A;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.piano-control-btn:hover {
  background: rgba(255, 180, 84, 0.2);
  border-color: #4FB58A;
  transform: translateY(-1px);
}

.piano-control-label {
  font-size: 11px;
  color: #999;
  margin: 0 4px;
}

.piano-roll-canvas {
  width: 100%;
  height: 200px;
  border-radius: 8px;
  cursor: grab;
  background: #0a0a0a;
  border: 2px solid #333;
  display: block;
  transition: border-color 0.3s;
}

.piano-roll-canvas:hover {
  border-color: #4FB58A;
}

.piano-roll-canvas:active {
  cursor: grabbing;
}

.chord-info-bar {
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(255, 180, 84, 0.1);
  border-radius: 6px;
  border-left: 4px solid #4FB58A;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chord-info-label {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.chord-info-notes {
  font-size: 12px;
  color: #4FB58A;
  font-family: 'Courier New', monospace;
}

/* ====== VOICE CARDS HORIZONTAL LAYOUT ====== */
.voice-cards-horizontal {
  display: flex;
  gap: 12px;
  overflow-x: visible;
  padding: 14px;
  background: linear-gradient(to right, #161618 0%, #1C1C1E 50%, #161618 100%);
  border-radius: 12px;
  scroll-snap-type: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 180, 84, 0.3) rgba(0, 0, 0, 0.2);
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.voice-cards-horizontal::-webkit-scrollbar {
  height: 8px;
}

.voice-cards-horizontal::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.voice-cards-horizontal::-webkit-scrollbar-thumb {
  background: rgba(255, 180, 84, 0.3);
  border-radius: 4px;
}

.voice-cards-horizontal::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 180, 84, 0.5);
}

.voice-card {
  flex: 1 1 0;
  min-width: 0;
  flex-shrink: 1;
  flex-grow: 1;
  background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  scroll-snap-align: none;
  position: relative;
  overflow: hidden;
}

.voice-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top right, var(--voice-color, #4FB58A) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.voice-card:hover {
  transform: translateY(-6px);
  border-color: var(--voice-color, #4FB58A);
  box-shadow: 0 12px 40px rgba(255, 180, 84, 0.3);
}

.voice-card:hover::before {
  opacity: 0.1;
}

.voice-card.playing-pulse {
  animation: voicePulse 1.5s ease-in-out infinite;
  border-color: var(--voice-color, #4FB58A);
}

@keyframes voicePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 180, 84, 0.7);
  }
  50% {
    box-shadow: 0 0 30px 15px rgba(255, 180, 84, 0);
  }
}

.voice-card-header {
  border-left: 4px solid #4FB58A;
  padding-left: 12px;
  margin-bottom: 12px;
}

.voice-name {
  font-size: 18px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.voice-number {
  font-size: 11px;
  color: #999;
  font-weight: 500;
}

.voice-role {
  font-size: 12px;
  color: #4FB58A;
  margin-bottom: 16px;
  text-align: center;
  font-weight: 500;
  padding: 6px;
  background: rgba(255, 180, 84, 0.05);
  border-radius: 4px;
}

.voice-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #555;
  transition: all 0.3s;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
}

.voice-status.playing .status-indicator {
  animation: statusBlink 1s ease-in-out infinite;
}

@keyframes statusBlink {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.1);
  }
}

.status-text {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #999;
  letter-spacing: 0.5px;
}

.voice-status.playing .status-text {
  color: #4FB58A;
}

.voice-note-info {
  text-align: center;
  margin: 16px 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.note-name {
  font-size: 28px;
  font-weight: bold;
  color: #666;
  font-family: 'Courier New', monospace;
  margin-bottom: 4px;
  transition: color 0.3s;
}

.note-freq {
  font-size: 13px;
  color: #4FB58A;
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

.stereo-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}

.stereo-layer {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.layer-label {
  font-size: 8px;
  color: #999;
  text-align: center;
  margin-bottom: 6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mini-waveform {
  width: 100%;
  height: 24px;
  border-radius: 4px;
  background: #000;
  display: block;
  margin-bottom: 6px;
}

.layer-source {
  font-size: 10px;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.btn-edit-voice {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #4FB58A 0%, #2E9E6E 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(255, 180, 84, 0.3);
}

.btn-edit-voice:hover {
  background: linear-gradient(135deg, #2E9E6E 0%, #FFA887 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 180, 84, 0.5);
}

.btn-edit-voice:active {
  transform: translateY(0);
}

/* ====== RESPONSIVE ADJUSTMENTS ====== */
@media (max-width: 768px) {
  .piano-roll-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .piano-roll-controls {
    width: 100%;
    justify-content: space-between;
  }

  .voice-card {
    min-width: 180px;
  }

  .chord-info-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ====== ACCESSIBILITY ====== */
.voice-card:focus-visible {
  outline: 2px solid var(--voice-color, #4FB58A);
  outline-offset: 4px;
}

.piano-control-btn:focus-visible {
  outline: 2px solid #4FB58A;
  outline-offset: 2px;
}

/* ====== HIDE OLD OSCILLATOR GRID ====== */
.osc-grid[style*="display: none"] {
  /* Completely hidden - can be removed after testing */
}

/* ============================================
   LIGHT THEME OVERRIDES
   ============================================ */

body.light-theme .piano-roll-container {
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8ed 100%) !important;
  border-color: rgba(0, 102, 204, 0.2) !important;
}

body.light-theme .voice-cards-horizontal {
  background: linear-gradient(to right, #f0f0f5 0%, #e5e5ea 50%, #f0f0f5 100%) !important;
}

body.light-theme .voice-card {
  background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%) !important;
  border-color: #d0d0d0 !important;
}

body.light-theme .voice-card:hover {
  border-color: #0066CC;
}

body.light-theme .voice-card.active {
  border-color: #0066CC;
  box-shadow: 0 0 20px rgba(0, 102, 204, 0.2);
}

body.light-theme .piano-roll-header h3 {
  color: #0066CC;
}

body.light-theme .piano-control-btn {
  background: rgba(0, 102, 204, 0.1);
  border-color: rgba(0, 102, 204, 0.3);
  color: #0066CC;
}

body.light-theme .piano-control-btn:hover {
  background: rgba(0, 102, 204, 0.2);
}

body.light-theme .piano-control-btn.active {
  background: #0066CC;
  color: #fff;
}

body.light-theme .piano-control-btn:focus-visible {
  outline-color: #0066CC;
}

/* ============================================
   SUNSET THEME OVERRIDES
   ============================================ */

body.sunset-theme .piano-roll-container {
  background: linear-gradient(135deg, #1A1215 0%, #2A1A1F 100%) !important;
  border-color: rgba(255, 180, 84, 0.2) !important;
}

body.sunset-theme .voice-cards-horizontal {
  background: linear-gradient(to right, #1A1215 0%, #2E2225 50%, #1A1215 100%) !important;
}

body.sunset-theme .voice-card {
  background: linear-gradient(135deg, #1A1215 0%, #241A1D 100%) !important;
  border-color: #3D2F32 !important;
}

body.sunset-theme .voice-card:hover {
  border-color: rgba(255, 180, 84, 0.5);
}

body.sunset-theme .voice-card.active {
  border-color: #4FB58A;
  box-shadow: 0 0 20px rgba(255, 180, 84, 0.2);
}

body.sunset-theme .voice-card-title {
  color: #4FB58A;
}

body.sunset-theme .piano-roll-header h3 {
  color: #4FB58A;
}

body.sunset-theme .piano-control-btn {
  background: rgba(255, 180, 84, 0.1);
  border-color: rgba(255, 180, 84, 0.3);
  color: #4FB58A;
}

body.sunset-theme .piano-control-btn:hover {
  background: rgba(255, 180, 84, 0.2);
}

body.sunset-theme .piano-control-btn.active {
  background: #4FB58A;
  color: #1A1215;
}

body.sunset-theme .piano-control-btn:focus-visible {
  outline-color: #4FB58A;
}

body.sunset-theme .layer-waveform {
  color: #4FB58A;
}

body.sunset-theme .btn-edit-voice {
  background: linear-gradient(135deg, #4FB58A 0%, #FF8A7D 100%);
}

body.sunset-theme .btn-edit-voice:hover {
  background: linear-gradient(135deg, #FF8A7D 0%, #FFADA3 100%);
  box-shadow: 0 6px 20px rgba(255, 180, 84, 0.5);
}

/* ============================================
   OCEAN THEME OVERRIDES
   ============================================ */

body.ocean-theme .piano-roll-container {
  background: linear-gradient(135deg, #0A1520 0%, #0F1D2A 100%) !important;
  border-color: rgba(0, 217, 217, 0.2) !important;
}

body.ocean-theme .voice-cards-horizontal {
  background: linear-gradient(to right, #0A1520 0%, #152535 50%, #0A1520 100%) !important;
}

body.ocean-theme .voice-card {
  background: linear-gradient(135deg, #0A1520 0%, #0F1D2A 100%) !important;
  border-color: #1E3545 !important;
}

body.ocean-theme .voice-card:hover {
  border-color: rgba(0, 217, 217, 0.5);
}

body.ocean-theme .voice-card.active {
  border-color: #00D9D9;
  box-shadow: 0 0 20px rgba(0, 217, 217, 0.2);
}

body.ocean-theme .voice-card-title {
  color: #00D9D9;
}

body.ocean-theme .piano-roll-header h3 {
  color: #00D9D9;
}

body.ocean-theme .piano-control-btn {
  background: rgba(0, 217, 217, 0.1);
  border-color: rgba(0, 217, 217, 0.3);
  color: #00D9D9;
}

body.ocean-theme .piano-control-btn:hover {
  background: rgba(0, 217, 217, 0.2);
}

body.ocean-theme .piano-control-btn.active {
  background: #00D9D9;
  color: #0A1520;
}

body.ocean-theme .layer-waveform {
  color: #00D9D9;
}

body.ocean-theme .btn-edit-voice {
  background: linear-gradient(135deg, #00D9D9 0%, #33E6E6 100%);
}

body.ocean-theme .btn-edit-voice:hover {
  background: linear-gradient(135deg, #33E6E6 0%, #66ECEC 100%);
  box-shadow: 0 6px 20px rgba(0, 217, 217, 0.5);
}

/* ============================================
   VIOLET THEME OVERRIDES
   ============================================ */

body.violet-theme .piano-roll-container {
  background: linear-gradient(135deg, #12101A 0%, #1A1725 100%) !important;
  border-color: rgba(255, 180, 84, 0.2) !important;
}

body.violet-theme .voice-cards-horizontal {
  background: linear-gradient(to right, #12101A 0%, #231F30 50%, #12101A 100%) !important;
}

body.violet-theme .voice-card {
  background: linear-gradient(135deg, #12101A 0%, #1A1725 100%) !important;
  border-color: #332D45 !important;
}

body.violet-theme .voice-card:hover {
  border-color: rgba(255, 180, 84, 0.5);
}

body.violet-theme .voice-card.active {
  border-color: #4FB58A;
  box-shadow: 0 0 20px rgba(255, 180, 84, 0.2);
}

body.violet-theme .voice-card-title {
  color: #4FB58A;
}

body.violet-theme .piano-roll-header h3 {
  color: #4FB58A;
}

body.violet-theme .piano-control-btn {
  background: rgba(255, 180, 84, 0.1);
  border-color: rgba(255, 180, 84, 0.3);
  color: #4FB58A;
}

body.violet-theme .piano-control-btn:hover {
  background: rgba(255, 180, 84, 0.2);
}

body.violet-theme .piano-control-btn.active {
  background: #4FB58A;
  color: #12101A;
}

body.violet-theme .layer-waveform {
  color: #4FB58A;
}

body.violet-theme .btn-edit-voice {
  background: linear-gradient(135deg, #4FB58A 0%, #C084FC 100%);
}

body.violet-theme .btn-edit-voice:hover {
  background: linear-gradient(135deg, #C084FC 0%, #D8B4FE 100%);
  box-shadow: 0 6px 20px rgba(255, 180, 84, 0.5);
}

/* ============================================
   FOREST THEME OVERRIDES
   ============================================ */

body.forest-theme .piano-roll-container {
  background: linear-gradient(135deg, #0F1510 0%, #151F17 100%) !important;
  border-color: rgba(74, 222, 128, 0.2) !important;
}

body.forest-theme .voice-cards-horizontal {
  background: linear-gradient(to right, #0F1510 0%, #1C291E 50%, #0F1510 100%) !important;
}

body.forest-theme .voice-card {
  background: linear-gradient(135deg, #0F1510 0%, #151F17 100%) !important;
  border-color: #2A3D2D !important;
}

body.forest-theme .voice-card:hover {
  border-color: rgba(74, 222, 128, 0.5);
}

body.forest-theme .voice-card.active {
  border-color: #4ADE80;
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.2);
}

body.forest-theme .voice-card-title {
  color: #4ADE80;
}

body.forest-theme .piano-roll-header h3 {
  color: #4ADE80;
}

body.forest-theme .piano-control-btn {
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.3);
  color: #4ADE80;
}

body.forest-theme .piano-control-btn:hover {
  background: rgba(74, 222, 128, 0.2);
}

body.forest-theme .piano-control-btn.active {
  background: #4ADE80;
  color: #0F1510;
}

body.forest-theme .layer-waveform {
  color: #4ADE80;
}

body.forest-theme .btn-edit-voice {
  background: linear-gradient(135deg, #4ADE80 0%, #6EE7A0 100%);
}

body.forest-theme .btn-edit-voice:hover {
  background: linear-gradient(135deg, #6EE7A0 0%, #86EFAC 100%);
  box-shadow: 0 6px 20px rgba(74, 222, 128, 0.5);
}
