/*
================================================================================
M3 EXPRESSIVE REDESIGN - FOUNDATIONS
================================f================================================
This redesign is based on the principles of Material 3 Expressive, focusing on:
- **Expressive Color:** A richer, more nuanced color system using tonal palettes.
- **Expressive Typography:** Variable fonts for a more dynamic and hierarchical type scale.
- **Expressive Shape:** A wider range of corner radii and the use of clip-paths for unique shapes.
- **Expressive Motion:** A new physics-based motion system for more natural and fluid animations.
- **Component Modernization:** Updating all components to their M3 Expressive counterparts.
*/

:root {
  /* M3 Expressive Font & Typography Tokens */
  --expressive-font-family: 'Rubik', sans-serif;
  --body-font-family: 'Roboto Flex', sans-serif;

  /* Font settings for variability and expressiveness */
  --font-variation-settings-normal: "wdth" 100, "wght" 400;
  --font-variation-settings-medium: "wdth" 100, "wght" 500;
  --font-variation-settings-bold: "wdth" 100, "wght" 700;
  --font-variation-settings-emphasized: "wdth" 125, "wght" 800; /* For expressive moments */

  /* M3 Expressive Shape Tokens (Border Radius) */
  --shape-corner-extra-small: 4px;
  --shape-corner-small: 8px;
  --shape-corner-medium: 12px;
  --shape-corner-large: 16px;
  --shape-corner-extra-large: 28px;
  --shape-corner-full: 9999px;

  /* M3 Expressive Motion Tokens (Easing) */
  --motion-easing-emphasized: cubic-bezier(0.4, 0.0, 0.2, 1);
  --motion-easing-emphasized-accelerate: cubic-bezier(0.3, 0.0, 0.8, 0.15);
  --motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1.0);
  --motion-easing-standard: cubic-bezier(0.2, 0.0, 0, 1);
  --motion-duration-short: 100ms;
  --motion-duration-medium: 250ms;
  --motion-duration-long: 400ms;

  /* M3 Expressive Elevation (Box Shadow) */
  --elevation-1: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px 1px rgba(0,0,0,0.15);
  --elevation-2: 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
  --elevation-3: 0 1px 3px rgba(0,0,0,0.3), 0 4px 8px 3px rgba(0,0,0,0.15);
  --elevation-4: 0 2px 3px rgba(0,0,0,0.3), 0 6px 10px 4px rgba(0,0,0,0.15);
  --elevation-5: 0 4px 4px rgba(0,0,0,0.3), 0 8px 12px 6px rgba(0,0,0,0.15);

  /* M3 Expressive Color Tokens - Light Theme */
  --md-sys-color-primary-light: #6750A4;
  --md-sys-color-on-primary-light: #FFFFFF;
  --md-sys-color-primary-container-light: #EADDFF;
  --md-sys-color-on-primary-container-light: #21005D;
  --md-sys-color-secondary-light: #625B71;
  --md-sys-color-on-secondary-light: #FFFFFF;
  --md-sys-color-secondary-container-light: #E8DEF8;
  --md-sys-color-on-secondary-container-light: #1D192B;
  --md-sys-color-tertiary-light: #7D5260;
  --md-sys-color-on-tertiary-light: #FFFFFF;
  --md-sys-color-tertiary-container-light: #FFD8E4;
  --md-sys-color-on-tertiary-container-light: #31111D;
  --md-sys-color-error-light: #B3261E;
  --md-sys-color-on-error-light: #FFFFFF;
  --md-sys-color-error-container-light: #F9DEDC;
  --md-sys-color-on-error-container-light: #410E0B;
  --md-sys-color-background-light: #FFFBFE;
  --md-sys-color-on-background-light: #1C1B1F;
  --md-sys-color-surface-light: #FFFBFE;
  --md-sys-color-on-surface-light: #1C1B1F;
  --md-sys-color-surface-variant-light: #E7E0EC;
  --md-sys-color-on-surface-variant-light: #49454F;
  --md-sys-color-outline-light: #79747E;
  --md-sys-color-shadow-light: #000000;
  --md-sys-color-surface-container-highest-light: #E6E0E9;
  --md-sys-color-surface-container-high-light: #ECE6F0;
  --md-sys-color-surface-container-light: #F3EDF7;
  --md-sys-color-surface-container-low-light: #F7F2FA;
  --md-sys-color-surface-container-lowest-light: #FFFFFF;

  /* M3 Expressive Color Tokens - Dark Theme */
  --md-sys-color-primary-dark: #D0BCFF;
  --md-sys-color-on-primary-dark: #381E72;
  --md-sys-color-primary-container-dark: #4A4458;
  --md-sys-color-on-primary-container-dark: #EADDFF;
  --md-sys-color-secondary-dark: #CCC2DC;
  --md-sys-color-on-secondary-dark: #332D41;
  --md-sys-color-secondary-container-dark: #4A4458;
  --md-sys-color-on-secondary-container-dark: #E8DEF8;
  --md-sys-color-tertiary-dark: #EFB8C8;
  --md-sys-color-on-tertiary-dark: #492532;
  --md-sys-color-tertiary-container-dark: #633B48;
  --md-sys-color-on-tertiary-container-dark: #FFD8E4;
  --md-sys-color-error-dark: #F2B8B5;
  --md-sys-color-on-error-dark: #601410;
  --md-sys-color-error-container-dark: #8C1D18;
  --md-sys-color-on-error-container-dark: #F9DEDC;
  --md-sys-color-background-dark: #1C1B1F;
  --md-sys-color-on-background-dark: #E6E1E5;
  --md-sys-color-surface-dark: #1C1B1F;
  --md-sys-color-on-surface-dark: #E6E1E5;
  --md-sys-color-surface-variant-dark: #49454F;
  --md-sys-color-on-surface-variant-dark: #CAC4D0;
  --md-sys-color-outline-dark: #938F99;
  --md-sys-color-shadow-dark: #000000;
  --md-sys-color-surface-container-highest-dark: #36343B;
  --md-sys-color-surface-container-high-dark: #2B2930;
  --md-sys-color-surface-container-dark: #211F26;
  --md-sys-color-surface-container-low-dark: #1D1B20;
  --md-sys-color-surface-container-lowest-dark: #0F0D13;
}

body {
  font-family: var(--body-font-family);
  font-variation-settings: var(--font-variation-settings-normal);
  background-color: var(--md-sys-color-background-light);
  color: var(--md-sys-color-on-background-light);
  transition: background-color var(--motion-duration-medium) var(--motion-easing-standard), color var(--motion-duration-medium) var(--motion-easing-standard);
  margin: 0;
}

body.dark-mode {
  background-color: var(--md-sys-color-background-dark);
  color: var(--md-sys-color-on-background-dark);
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  transition: filter var(--motion-duration-medium) var(--motion-easing-standard);
}

#app.hidden {
  display: none;
}

#app.blurred {
  filter: blur(8px) brightness(0.6);
  pointer-events: none;
}

/*
================================================================================
M3 EXPRESSIVE REDESIGN - COMPONENTS
================================================================================
*/

/* Main Content & Pages */
main {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 160px; /* Increased padding for floating elements */
}

.page {
  display: none;
  padding: 0 1.5rem;
}

.page.active {
  display: block;
  animation: fadeIn var(--motion-duration-long) var(--motion-easing-emphasized-decelerate);
}

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

.page-title {
  font-family: var(--expressive-font-family);
  font-variation-settings: var(--font-variation-settings-emphasized);
  font-size: 3rem;
  color: var(--md-sys-color-primary-light);
  margin: 2rem 0;
  line-height: 1.2;
}

.dark-mode .page-title { color: var(--md-sys-color-primary-dark); }

.section-title {
  font-family: var(--expressive-font-family);
  font-variation-settings: var(--font-variation-settings-bold);
  font-size: 1.75rem;
  margin: 2.5rem 0 1.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--md-sys-color-secondary-container-light);
}

.dark-mode .section-title { border-bottom-color: var(--md-sys-color-secondary-container-dark); }

/* Artist Page Header - Expressive Shape */
.artist-header {
  height: 300px;
  position: relative;
  margin-bottom: 2rem;
  clip-path: polygon(0 0, 100% 0, 100% 85%, 0% 100%); /* Expressive slanted shape */
  border-radius: var(--shape-corner-extra-large);
  overflow: hidden;
}

.artist-banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.6) saturate(1.2);
}

.artist-info {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 2rem;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

.artist-info h1 {
  margin: 0;
  font-family: var(--expressive-font-family);
  font-variation-settings: var(--font-variation-settings-emphasized);
  font-size: 3.5rem;
}

/* Material Search Box - M3 View Style */
.search-container {
  display: flex;
  align-items: center;
  background-color: var(--md-sys-color-surface-container-high-light);
  border-radius: var(--shape-corner-full);
  padding: 0.75rem 1.5rem;
  box-shadow: var(--elevation-1);
  margin-bottom: 2rem;
  border: 1px solid var(--md-sys-color-outline-light);
}

.dark-mode .search-container {
  background-color: var(--md-sys-color-surface-container-high-dark);
  border-color: var(--md-sys-color-outline-dark);
}

.search-container .material-symbols-outlined {
  font-size: 1.0rem;
  color: var(--md-sys-color-on-surface-variant-light);
}

.dark-mode .search-container .material-symbols-outlined { color: var(--md-sys-color-on-surface-variant-dark); }

#search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.1rem;
  margin-left: 1rem;
  color: var(--md-sys-color-on-surface-light);
  font-variation-settings: var(--font-variation-settings-normal);
}

.dark-mode #search-input { color: var(--md-sys-color-on-surface-dark); }

/* Horizontal Scrolling Card Grid - M3 Cards */
.horizontal-scroll-container {
  display: flex;
  overflow-x: auto;
  gap: 1.5rem;
  padding: 0.5rem 0 1.5rem 0;
  scrollbar-width: none;
}
.horizontal-scroll-container::-webkit-scrollbar { display: none; }

.horizontal-scroll-container .card {
  flex: 0 0 180px;
  width: 180px;
}

.card {
  background-color: var(--md-sys-color-surface-container-low-light);
  border-radius: var(--shape-corner-large);
  padding: 1rem;
  box-shadow: none;
  border: 1px solid var(--md-sys-color-outline-light);
  transition: all var(--motion-duration-medium) var(--motion-easing-emphasized);
  cursor: pointer;
  position: relative;
}

.dark-mode .card {
  background-color: var(--md-sys-color-surface-container-low-dark);
  border-color: var(--md-sys-color-outline-dark);
}

.card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: var(--elevation-3);
  background-color: var(--md-sys-color-surface-container-light);
}

.dark-mode .card:hover { background-color: var(--md-sys-color-surface-container-dark); }

.card img {
  width: 100%;
  border-radius: var(--shape-corner-medium);
  aspect-ratio: 1/1;
  object-fit: cover;
  /* Expressive shape for images */
  clip-path: polygon(0 10%, 100% 0, 100% 90%, 0% 100%);
}

.card-title {
  font-variation-settings: var(--font-variation-settings-bold);
  margin-top: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
  color: var(--md-sys-color-on-surface-variant-light);
}

.dark-mode .card-title { color: var(--md-sys-color-on-surface-variant-dark); }

.item-options-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--md-sys-color-surface-container-highest-light);
  color: var(--md-sys-color-on-surface-variant-light);
  border-radius: var(--shape-corner-full);
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--motion-duration-short) var(--motion-easing-standard);
}

.dark-mode .item-options-btn {
    background: var(--md-sys-color-surface-container-highest-dark);
    color: var(--md-sys-color-on-surface-variant-dark);
}

.item-options-btn:hover {
  transform: scale(1.1);
  background: var(--md-sys-color-primary-container-light);
  color: var(--md-sys-color-on-primary-container-light);
}

.dark-mode .item-options-btn:hover {
    background: var(--md-sys-color-primary-container-dark);
    color: var(--md-sys-color-on-primary-container-dark);
}

/* Vertical List - M3 List Item */
.vertical-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border-radius: var(--shape-corner-large);
  cursor: pointer;
  transition: background-color var(--motion-duration-short) var(--motion-easing-standard);
}

.list-item:hover {
  background-color: var(--md-sys-color-surface-container-high-light);
}

.dark-mode .list-item:hover { background-color: var(--md-sys-color-surface-container-high-dark); }

.list-item img {
  width: 56px;
  height: 56px;
  border-radius: var(--shape-corner-medium);
  flex-shrink: 0;
  object-fit: cover;
}

.list-item.artist-item img {
  border-radius: var(--shape-corner-full); /* Circular for artists */
}

.list-item-info {
  flex: 1;
  overflow: hidden;
}

.list-item-info p {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-info .title {
  font-variation-settings: var(--font-variation-settings-medium);
  font-size: 1rem;
  color: var(--md-sys-color-on-surface-light);
}

.dark-mode .list-item-info .title { color: var(--md-sys-color-on-surface-dark); }

.list-item-info .artist {
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-variant-light);
}

.dark-mode .list-item-info .artist { color: var(--md-sys-color-on-surface-variant-dark); }

.list-item .item-options-btn {
  position: static;
  background: none;
  color: var(--md-sys-color-on-surface-variant-light);
}

.dark-mode .list-item .item-options-btn { color: var(--md-sys-color-on-surface-variant-dark); }

/* Bottom Navigation - M3 Nav Bar */
.bottom-nav {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 3rem);
  max-width: 450px;
  display: flex;
  justify-content: space-around;
  background-color: var(--md-sys-color-surface-container-light);
  border-radius: var(--shape-corner-extra-large);
  padding: 0.75rem 0.5rem;
  box-shadow: var(--elevation-3);
  z-index: 1000;
}

.dark-mode .bottom-nav {
    background-color: var(--md-sys-color-surface-container-dark);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: 1;
  color: var(--md-sys-color-on-surface-variant-light);
  text-decoration: none;
  transition: all var(--motion-duration-medium) var(--motion-easing-emphasized);
  position: relative;
  min-height: 56px;
}
.dark-mode .nav-item { color: var(--md-sys-color-on-surface-variant-dark); }


.nav-item .material-symbols-outlined {
  font-size: 24px;
  transition: all var(--motion-duration-short) var(--motion-easing-standard);
}

.nav-item .nav-text {
  font-size: 12px;
  font-variation-settings: var(--font-variation-settings-medium);
  transition: all var(--motion-duration-short) var(--motion-easing-standard);
}

.nav-item .nav-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 64px;
  height: 32px;
  background-color: var(--md-sys-color-secondary-container-light);
  border-radius: var(--shape-corner-full);
  z-index: -1;
  opacity: 0;
  transition: all var(--motion-duration-medium) var(--motion-easing-emphasized);
}
.dark-mode .nav-item .nav-indicator {
    background-color: var(--md-sys-color-secondary-container-dark);
}

.nav-item.active .nav-indicator {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.nav-item.active {
  color: var(--md-sys-color-on-secondary-container-light);
}
.dark-mode .nav-item.active {
    color: var(--md-sys-color-on-secondary-container-dark);
}

/* Mini Player - Expressive & Compact */
.mini-player {
  position: fixed;
  bottom: 110px; /* Adjust to sit above nav bar */
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 3rem);
  max-width: 450px;
  background-color: var(--md-sys-color-surface-container-high-light);
  border-radius: var(--shape-corner-large);
  display: flex;
  align-items: center;
  padding: 0.75rem;
  box-shadow: var(--elevation-4);
  z-index: 999;
  overflow: hidden;
  border: 1px solid var(--md-sys-color-outline-light);
}

.dark-mode .mini-player {
    background-color: var(--md-sys-color-surface-container-high-dark);
    border-color: var(--md-sys-color-outline-dark);
}

#player-iframe-container {
  width: 48px;
  height: 48px;
  border-radius: var(--shape-corner-small);
  overflow: hidden;
  margin-right: 1rem;
  flex-shrink: 0;
}

.song-info {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}

.marquee {
  display: block;
}
@keyframes marquee {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-100%, 0); }
}

.player-controls button {
  background: none;
  border: none;
  font-size: 36px;
  color: var(--md-sys-color-primary-light);
  cursor: pointer;
  padding: 0.5rem;
}
.dark-mode .player-controls button { color: var(--md-sys-color-primary-dark); }

/* Wavy Progress Bar - M3 Expressive Style */
.progress-bar-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background-color: var(--md-sys-color-surface-variant-light);
}
.dark-mode .progress-bar-container { background-color: var(--md-sys-color-surface-variant-dark); }

#scribble-progress {
  width: 0%;
  height: 100%;
  background-color: var(--md-sys-color-secondary-light);
  mask-image: url('data:image/svg+xml;utf8,<svg preserveAspectRatio="none" viewBox="0 0 40 4" xmlns="http://www.w3.org/2000/svg"><path d="M0,2 C2,0 4,4 6,2 S10,0 12,2 16,4 18,2 22,0 24,2 28,4 30,2 34,0 36,2 38,4 40,2" stroke="white" stroke-width="2" fill="transparent" vector-effect="non-scaling-stroke"/></svg>');
  mask-repeat: repeat-x;
  mask-size: contain;
}
.dark-mode #scribble-progress { background-color: var(--md-sys-color-secondary-dark); }

/* Expanded Player / Queue */
.expanded-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0;
  background-color: var(--md-sys-color-surface-container-lowest-light);
  border-top-left-radius: var(--shape-corner-extra-large);
  border-top-right-radius: var(--shape-corner-extra-large);
  box-shadow: var(--elevation-5);
  z-index: 1001;
  transition: height var(--motion-duration-long) var(--motion-easing-emphasized);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dark-mode .expanded-player { background-color: var(--md-sys-color-surface-container-lowest-dark); }

.expanded-player.visible {
  height: 80%; /* Larger pop-up */
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--md-sys-color-outline-light);
}
.dark-mode .queue-header { border-bottom-color: var(--md-sys-color-outline-dark); }

#queue-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

#queue-list .list-item {
  background: transparent;
  box-shadow: none;
  border-bottom: 1px solid var(--md-sys-color-surface-container-high-light);
  border-radius: 0;
}
.dark-mode #queue-list .list-item { border-bottom-color: var(--md-sys-color-surface-container-high-dark); }


/* Profile Page */
.profile-header {
  background: linear-gradient(135deg, var(--md-sys-color-primary-container-light), var(--md-sys-color-tertiary-container-light));
  color: var(--md-sys-color-on-primary-container-light);
  padding: 4rem 2rem;
  border-radius: var(--shape-corner-extra-large);
  text-align: center;
  margin-bottom: 2rem;
}
.dark-mode .profile-header {
    background: linear-gradient(135deg, var(--md-sys-color-primary-container-dark), var(--md-sys-color-tertiary-container-dark));
    color: var(--md-sys-color-on-primary-container-dark);
}

.profile-header h2 {
  margin: 0;
  font-family: var(--expressive-font-family);
  font-variation-settings: var(--font-variation-settings-emphasized);
  font-size: 2.5rem;
}


/* Context Menu */
.context-menu {
  position: fixed;
  background: var(--md-sys-color-surface-container-light);
  border-radius: var(--shape-corner-medium);
  box-shadow: var(--elevation-3);
  z-index: 2000;
  display: none;
  padding: 0.5rem 0;
  border: 1px solid var(--md-sys-color-outline-light);
}

.dark-mode .context-menu {
    background: var(--md-sys-color-surface-container-dark);
    border-color: var(--md-sys-color-outline-dark);
}

.context-menu-item {
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: background-color var(--motion-duration-short) var(--motion-easing-standard);
  color: var(--md-sys-color-on-surface-light);
}
.dark-mode .context-menu-item { color: var(--md-sys-color-on-surface-dark); }

.context-menu-item:hover {
  background: var(--md-sys-color-surface-container-high-light);
}
.dark-mode .context-menu-item:hover { background: var(--md-sys-color-surface-container-high-dark); }

/* Modals & Setup Wizard - M3 Dialogs */
#modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--motion-duration-medium) var(--motion-easing-standard);
  pointer-events: none;
}

#modal-backdrop:not(.hidden) {
  opacity: 1;
  pointer-events: all;
}

.modal-popup {
  background: var(--md-sys-color-surface-container-lowest-light);
  color: var(--md-sys-color-on-surface-light);
  padding: 1.5rem;
  border-radius: var(--shape-corner-extra-large);
  text-align: center;
  max-width: 90%;
  width: 400px;
  transform: scale(0.9);
  transition: transform var(--motion-duration-medium) var(--motion-easing-emphasized);
}
.dark-mode .modal-popup {
  background: var(--md-sys-color-surface-container-lowest-dark);
  color: var(--md-sys-color-on-surface-dark);
}

#modal-backdrop:not(.hidden) .modal-popup:not(.hidden) {
  transform: scale(1);
}

.modal-popup h2 {
  font-family: var(--expressive-font-family);
  font-variation-settings: var(--font-variation-settings-bold);
  font-size: 1.5rem;
  color: var(--md-sys-color-on-surface-light);
}
.dark-mode .modal-popup h2 { color: var(--md-sys-color-on-surface-dark); }


/* M3 Text Fields */
.modal-input {
    font-size: 1rem;
    padding: 1rem;
    border-radius: var(--shape-corner-small);
    border: 1px solid var(--md-sys-color-outline-light);
    background-color: var(--md-sys-color-surface-container-low-light);
    color: var(--md-sys-color-on-surface-variant-light);
    width: calc(100% - 2rem);
    margin-top: 1rem;
    transition: all var(--motion-duration-short) ease;
}

.dark-mode .modal-input {
    border-color: var(--md-sys-color-outline-dark);
    background-color: var(--md-sys-color-surface-container-low-dark);
    color: var(--md-sys-color-on-surface-variant-dark);
}

.modal-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary-light);
    box-shadow: 0 0 0 2px var(--md-sys-color-primary-container-light);
}

.dark-mode .modal-input:focus {
    border-color: var(--md-sys-color-primary-dark);
    box-shadow: 0 0 0 2px var(--md-sys-color-primary-container-dark);
}

/* M3 Buttons (Filled Style) */
.modal-button {
  font-size: 1rem;
  font-variation-settings: var(--font-variation-settings-bold);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--shape-corner-full);
  background: var(--md-sys-color-primary-light);
  color: var(--md-sys-color-on-primary-light);
  cursor: pointer;
  margin-top: 1.5rem;
  transition: all var(--motion-duration-short) var(--motion-easing-standard);
}

.dark-mode .modal-button {
  background: var(--md-sys-color-primary-dark);
  color: var(--md-sys-color-on-primary-dark);
}

.modal-button:hover {
  box-shadow: var(--elevation-1);
}

.wizard-step { display: none; }
.wizard-step.active { display: block; }

/* M3 Chips/Toggles */
.taste-picker {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.taste-picker span {
    padding: 0.5rem 1.25rem;
    background: var(--md-sys-color-surface-container-light);
    border: 1px solid var(--md-sys-color-outline-light);
    border-radius: var(--shape-corner-small);
    cursor: pointer;
    transition: all var(--motion-duration-short) var(--motion-easing-standard);
}
.dark-mode .taste-picker span {
    background: var(--md-sys-color-surface-container-dark);
    border-color: var(--md-sys-color-outline-dark);
}


.taste-picker span.selected {
    background: var(--md-sys-color-secondary-container-light);
    color: var(--md-sys-color-on-secondary-container-light);
    border-color: var(--md-sys-color-secondary-container-light);
}
.dark-mode .taste-picker span.selected {
    background: var(--md-sys-color-secondary-container-dark);
    color: var(--md-sys-color-on-secondary-container-dark);
    border-color: var(--md-sys-color-secondary-container-dark);
}

.hidden { display: none !important; }

/* Library Page - M3 Filled Button */
#create-playlist-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-variation-settings: var(--font-variation-settings-bold);
  background-color: var(--md-sys-color-primary-container-light);
  color: var(--md-sys-color-on-primary-container-light);
  border: none;
  border-radius: var(--shape-corner-large);
  cursor: pointer;
  margin-bottom: 1.5rem;
  transition: all var(--motion-duration-short) var(--motion-easing-standard);
}
.dark-mode #create-playlist-btn {
    background-color: var(--md-sys-color-primary-container-dark);
    color: var(--md-sys-color-on-primary-container-dark);
}

#create-playlist-btn:hover {
    box-shadow: var(--elevation-2);
}
/* Add this to your existing CSS file */

#mini-player-download {
    padding: 8px;
}

#mini-player-download:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

#download-popup {
    width: 100%;
    height: 80vh;
    max-width: 100%;
    max-height: 700px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    padding: 0px;
    border-radius: 28px; /* Cute rounded square */
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    overflow: hidden; /* Ensures iframe respects the border-radius */
}

#close-download-popup {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: rgba(0,0,0,0.3);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

#download-iframe {
    width: 100%;
    height: 100%;
    border-radius: 18px; /* Match parent padding */
}