.bg-gradient {
  --background: radial-gradient(circle at top left, #2d3436 0%, #121212 100%);
  background: radial-gradient(circle at top left, #2d3436 0%, #121212 100%);
}

.outfit-font {
  font-family: 'Outfit', sans-serif;
}

// Header styles
.top-toolbar {
  --padding-top: 4px;
  --padding-bottom: 4px;
  --min-height: 40px;
  
  // Force left alignment in Ionic toolbar
  ion-title {
    padding-inline: 8px;
    text-align: left !important;
  }

  .title-main {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    font-weight: 700;
    color: var(--ion-color-secondary);
    white-space: normal;
    line-height: 1.2;
    text-align: left;

    .canto-number {
      font-size: 0.85em;
      background: rgba(var(--ion-color-secondary-rgb), 0.15);
      padding: 2px 10px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 6px;
      border: 1px solid rgba(var(--ion-color-secondary-rgb), 0.3);
      flex-shrink: 0;

      &.clickable {
        cursor: pointer;
        transition: all 0.2s ease;
        &:active { transform: scale(0.9); }
      }

      &.selected {
        background: var(--ion-color-secondary);
        color: #000;
        border-color: var(--ion-color-secondary);
        box-shadow: 0 0 10px rgba(var(--ion-color-secondary-rgb), 0.4);
      }
    }
    
    .title-text {
      flex: 1;
      text-align: left;
    }
  }
}

// Content and Lyrics
.lyrics-container {
  padding: 8px 24px 140px 24px; // Increased bottom padding for global player
  height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;

  &.full-screen-container {
    padding-bottom: 20px !important;
  }
}

// ... existing code ...

/* GLOBAL PLAYER FOOTER */
.global-player-toolbar {
  --background: transparent;
  --padding-top: 4px;
  --padding-bottom: 4px;
  --padding-start: 12px;
  --padding-end: 12px;
  
  &.glass {
    background: rgba(26, 26, 46, 0.95) !important;
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .player-content {
    display: flex;
    flex-direction: column;
    padding: 0;
  }

  .controls-row {
    display: flex;
    align-items: center;
    gap: 4px;

    .play-btn {
      --padding-start: 0;
      --padding-end: 0;
      height: 44px;
      width: 44px;
      
      ion-icon {
        font-size: 2.2rem;
      }
    }

    .skip-btn, .close-btn {
      --padding-start: 0;
      --padding-end: 0;
      height: 36px;
      width: 36px;
      
      ion-icon {
        font-size: 1.4rem;
      }
    }

    .global-range {
      flex: 1;
      --bar-height: 4px;
      --knob-size: 14px;
      padding-top: 0;
      padding-bottom: 0;
    }
  }
}

.lyrics-view {
  max-width: 900px;
  margin-left: 0; // Always left aligned
  text-align: left;
}

.section {
  margin-bottom: 2rem;
  position: relative;
  
  &.chorus {
    background: rgba(var(--ion-color-secondary-rgb), 0.03);
    border-left: 3px solid var(--ion-color-secondary);
    padding-left: 1rem;
    margin-left: -1rem;
    border-radius: 0 8px 8px 0;
  }

  .section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--ion-color-secondary);
    margin-bottom: 0.5rem;
    opacity: 0.7;
    letter-spacing: 1px;
  }
}

.lyric-line {
  margin-bottom: 1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  transition: all 0.3s ease;
  min-height: 1.5em;

  &.active {
    color: var(--ion-color-secondary);
    font-weight: 700;
    transform: scale(1.02);
    text-shadow: 0 0 15px rgba(var(--ion-color-secondary-rgb), 0.3);
  }
}

.chord-segment {
  display: inline-flex;
  flex-direction: column;
  vertical-align: bottom;
  margin-right: 0.2em;

  .chord {
    font-size: 0.75em;
    font-weight: 700;
    color: var(--ion-color-secondary);
    height: 1.2em;
    margin-bottom: -0.2em;
  }

  .seg-text {
    white-space: pre;
  }
}

// Footer styles
.slim-toolbar {
  --min-height: 48px;
  backdrop-filter: blur(15px);
  background: rgba(0,0,0,0.4) !important;
}

.slim-controls {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  padding: 4px 12px;
  overflow-x: auto;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
  
  &::-webkit-scrollbar {
    display: none;
  }

  .mic-btn-portrait {
    flex-shrink: 0;
  }

  .group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
  }

  .page-indicator {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ion-color-secondary);
    min-width: 40px;
    text-align: center;
  }

  .transpose-indicator {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ion-color-secondary);

    ion-icon { font-size: 0.9rem; }
  }
}

// Transcript area
.transcript-area {
  height: 4px;
  width: 100%;
  background: rgba(0,0,0,0.2);
  
  .energy-bar {
    height: 100%;
    background: var(--ion-color-danger);
    transition: width 0.1s ease;
    box-shadow: 0 0 10px var(--ion-color-danger);
  }
}

// Fullscreen and Orientation
@media (orientation: landscape) {
  // Always hide footer in landscape as we have side controls
  ion-footer {
    display: none !important;
  }

  .lyrics-container {
    height: 100%;
    padding-top: 4px; // Minimized
    padding-right: 90px !important; // More room for side controls and zoom
  }

  ion-content {
    --offset-bottom: 0px !important;
  }
}

ion-content.full-screen-content {
  --offset-bottom: 0px !important;
  
  @media (orientation: portrait) {
    --offset-bottom: 48px !important; // Footer height
  }
}

.landscape-side-controls {
  display: none !important; // Strict hidden in portrait
  
  @media (orientation: landscape) {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 44px !important; // Align with header
    bottom: 0;
    width: 60px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
  }

  .side-scroll-container {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    gap: 16px;
    &::-webkit-scrollbar { display: none; }
  }

  .side-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px; // Reduced for a more compact layout
    padding-bottom: 20px;

    ion-button {
      --padding-start: 0;
      --padding-end: 0;
      margin: 0;
      height: 48px;
      ion-icon { font-size: 1.8rem; }
    }
  }

  .side-divider {
    display: none;
  }
}
 
.mic-sensitivity-overlay {
  position: fixed;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  pointer-events: auto;

  @media (orientation: landscape) {
    right: 80px; // Prossimo ai controlli laterali
  }

  .slider-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 6px 12px 6px;
    background: rgba(18, 18, 18, 0.85) !important;
    backdrop-filter: blur(25px);
    border-radius: 24px;
    border: 1px solid rgba(var(--ion-color-secondary-rgb), 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    gap: 12px;
    animation: slideInRight 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .close-slider-btn {
    --padding-start: 0;
    --padding-end: 0;
    margin: 0;
    height: 36px;
    width: 36px;
    --color: var(--ion-color-secondary);
    
    ion-icon {
      font-size: 1.5rem;
    }
  }

  .slider-wrapper {
    height: 180px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 10px 0;
  }

  .custom-vertical-slider {
    position: relative;
    width: 8px;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    
    .slider-track {
      position: absolute;
      width: 100%;
      height: 100%;
    }
    
    .slider-fill {
      position: absolute;
      bottom: 0;
      width: 100%;
      background: var(--ion-color-secondary);
      border-radius: 4px;
      box-shadow: 0 0 10px rgba(var(--ion-color-secondary-rgb), 0.3);
      transition: height 0.05s linear;
    }
    
    .slider-knob {
      position: absolute;
      left: 50%;
      transform: translate(-50%, 50%);
      width: 28px;
      height: 28px;
      background: var(--ion-color-secondary);
      border-radius: 50%;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 15px rgba(var(--ion-color-secondary-rgb), 0.5);
      border: 2px solid #fff;
      transition: bottom 0.05s linear;
    }
  }

  .sensitivity-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--ion-color-secondary);
    min-width: 40px;
    text-align: center;
    letter-spacing: 0.5px;
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.floating-autoscroll-bar {
  position: fixed;
  bottom: 120px; 
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(18, 18, 18, 0.85) !important;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(var(--ion-color-secondary-rgb), 0.3);
  padding: 6px 16px;
  border-radius: 30px;
  z-index: 999;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;

  &.fullscreen-active {
    bottom: 24px !important;
  }

  &.high-contrast {
    background: #ffffff !important;
    border-color: #555555 !important;
    box-shadow: none !important;
    
    .autoscroll-control-center {
      background: rgba(0, 0, 0, 0.05);
      border-color: rgba(0, 0, 0, 0.15);
      
      .speed-badge {
        color: #000000 !important;
      }
    }
  }

  ion-button {
    --padding-start: 4px;
    --padding-end: 4px;
    margin: 0;
    
    ion-icon {
      font-size: 1.4rem;
    }
  }

  .autoscroll-control-center {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    
    &:active {
      transform: scale(0.95);
    }

    .speed-badge {
      font-size: 0.75rem;
      font-weight: 700;
      color: var(--ion-color-secondary);
      letter-spacing: 0.5px;
    }
  }
}

:host-context(body.high-contrast) {
  .slim-controls .group {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
  }
  
  .landscape-side-controls .side-scroll-container .side-group {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
  }
}

.non-validato-badge {
  font-size: 0.6rem;
  background: rgba(231, 76, 60, 0.15); /* Soft premium red */
  color: #e74c3c;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid rgba(231, 76, 60, 0.3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 6px;
  display: inline-block;
  vertical-align: middle;
}

:host-context(body.high-contrast) .non-validato-badge {
  background: rgba(231, 76, 60, 0.1) !important;
  color: #c0392b !important;
  border-color: #c0392b !important;
}
