.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-start: 56px; // Clear the back button on iOS/Apple devices
    padding-inline-end: 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;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;

  &.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;

  &.contiguous-next {
    margin-right: 0 !important;
  }

  .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;
    &::after {
      content: '\200b';
    }
  }
}

// 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; }
  }

  .zoom-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; }
  }

  .camera-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ion-color-secondary);
    padding: 0 4px;
    transition: color 0.15s ease-out;

    ion-icon {
      font-size: 1.1rem;
      transition: transform 0.15s ease-out;
      display: inline-block;
    }

    &.tilted {
      color: var(--ion-color-success, #2ed573);
      text-shadow: 0 0 5px rgba(46, 213, 115, 0.6);
    }
  }
}

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

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

:host(.landscape-active) {
  // Always hide footer in landscape as we have side controls
  ion-footer {
    display: none !important;
  }

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

  .lyrics-view {
    max-width: 100% !important;
  }

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

.landscape-side-controls {
  display: none !important; // Strict hidden in portrait

  :host(.landscape-active) & {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 56px !important; // Align below header
    bottom: 0;
    width: 50px;
    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;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 0;
    gap: 12px;
    &::-webkit-scrollbar { display: none; }
  }

  .side-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px; // Reduced for a more compact layout
    padding-bottom: 12px;
    background: rgba(255, 255, 255, 0.05);
    margin: 0 2px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 6px;

    ion-button {
      --padding-start: 0;
      --padding-end: 0;
      margin: 0;
      height: 38px;
      width: 38px;
      ion-icon { font-size: 1.5rem; }
    }
  }

  .vertical-range-container {
    height: 120px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 8px 0;
  }

  .vertical-range {
    transform: rotate(-90deg);
    width: 120px;
    --bar-height: 4px;
    --knob-size: 14px;
    padding: 0;
    margin: 0;
  }

  .side-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--ion-color-secondary);
    padding: 4px 0;
    cursor: pointer;

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

    &.tilted {
      color: var(--ion-color-success, #2ed573);
      text-shadow: 0 0 5px rgba(46, 213, 115, 0.6);
    }
  }

  .side-val {
    font-size: 0.7rem;
    font-weight: 700;
  }

  .side-divider {
    display: none;
  }
}

ion-content.full-screen-content {
  --offset-bottom: 48px !important; // Footer height
}

:host(.landscape-active) ion-content.full-screen-content {
  --offset-bottom: 0px !important;
}
 
.mic-sensitivity-overlay {
  position: fixed;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  pointer-events: auto;

  :host(.landscape-active) & {
    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);
  }
}

.voice-threshold-overlay {
  position: fixed;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  pointer-events: auto;

  .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(46, 213, 115, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    gap: 8px;
    animation: slideInLeft 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: linear-gradient(to top, #2ed573, #7bed9f);
      border-radius: 4px;
      box-shadow: 0 0 10px rgba(46, 213, 115, 0.3);
      transition: height 0.05s linear;
    }
    
    .slider-knob {
      position: absolute;
      left: 50%;
      transform: translate(-50%, 50%);
      width: 28px;
      height: 28px;
      background: #2ed573;
      border-radius: 50%;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 15px rgba(46, 213, 115, 0.5);
      border: 2px solid #fff;
      transition: bottom 0.05s linear;
    }
  }

  .sensitivity-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: #2ed573;
    min-width: 40px;
    text-align: center;
    letter-spacing: 0.5px;
  }
}

@keyframes slideInLeft {
  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-toolbar {
    --background: #ffffff !important;
    background: #ffffff !important;
    border-top: 1px solid rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: none !important;
  }

  .landscape-side-controls {
    --background: #ffffff !important;
    background: #ffffff !important;
    border-left: 1px solid rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: none !important;
  }

  .landscape-audio-player {
    --background: #ffffff !important;
    background: #ffffff !important;
    border-left: 1px solid rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: none !important;
  }

  .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;
}

:host-context(.md) {
  .top-toolbar ion-title {
    padding-inline-start: 8px;
  }
}

.autoscroll-sync-status {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(212, 136, 0, 0.18) !important;
  border: 1px solid rgba(253, 203, 110, 0.5);
  padding: 6px 14px;
  border-radius: 16px;
  z-index: 999;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: slideDownSync 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;

  span {
    font-size: 0.8rem;
    font-weight: 700;
    color: #fdcb6e;
    letter-spacing: 0.3px;
  }

  .spin-animation {
    animation: spinSync 2s linear infinite;
    font-size: 1.1rem;
  }
}

@keyframes spinSync {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes slideDownSync {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.camera-preview-floating {
  position: fixed;
  bottom: 60px;
  right: 15px;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid rgba(var(--ion-color-secondary-rgb), 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  :host(.landscape-active) & {
    bottom: 15px;
    right: 80px;
  }

  video {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }

  .camera-preview-overlay {
    display: flex;
    justify-content: center;
    align-items: center;

    .angle-indicator {
      font-size: 0.85rem;
      font-weight: 700;
      color: #fff;
      display: flex;
      align-items: center;

      &.tilted {
        color: #2ed573;
        text-shadow: 0 0 5px #2ed573;
      }
    }
  }
}

.black-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #000000;
  z-index: 99999;
  cursor: pointer;
}

.landscape-playlist-btn {
  writing-mode: vertical-rl;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 1px;
  height: auto;
  min-height: 75px;
  width: 30px;
  margin: 0;
  --padding-start: 2px;
  --padding-end: 2px;
  color: var(--ion-color-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(180deg);
}

