/* General reset and box-sizing */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Body styles */
body {
  font-family: 'Poppins', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  background-size: 400% 400%;
  animation: bgShift 15s ease infinite;
  color: #333;
}

@keyframes bgShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Card styles */
.card {
  background: #eef2f9;
  border-radius: 16px;
  box-shadow: 8px 8px 16px rgba(0,0,0,0.1), -8px -8px 16px rgba(255,255,255,0.7);
  padding: 2rem;
  margin-bottom: 2rem;
  max-width: 600px;
  width: 100%;
  animation: fadeIn 0.8s ease forwards;
  opacity: 0;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* Headings */
h1, h2 {
  text-align: center;
  margin-bottom: 1rem;
  color: #2c3e50;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
}

h2 {
  font-size: 2rem;
  font-weight: 600;
}

/* Labels and inputs */
label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: #34495e;
}

input[type="text"], input[type="number"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 12px;
  background: #eef2f9;
  box-shadow: inset 4px 4px 8px rgba(0,0,0,0.05), inset -4px -4px 8px rgba(255,255,255,0.7);
  font-size: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  outline: none;
  transform: translateY(-2px);
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.1), inset -2px -2px 4px rgba(255,255,255,0.8);
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  margin: 0.5rem;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
  box-shadow: 4px 4px 8px rgba(0,0,0,0.1), -4px -4px 8px rgba(255,255,255,0.7);
  background-color: #3498db;
  color: white;
}

.btn:active {
  transform: translateY(2px);
}

.btn:hover {
  background-color: #2980b9;
}

.btn:hover .ripple {
  animation: ripple 0.6s ease-out;
}

.ripple {
  position: absolute;
  width: 20px;
  height: 20px;
  background: rgba(255,255,255,0.5);
  border-radius: 50%;
  pointer-events: none;
  transform: scale(0);
}

@keyframes ripple {
  to {
    transform: scale(20);
    opacity: 0;
  }
}

/* Button color variants */
.spotify {
  background: #1db954;
  color: #fff;
  display: block;
  margin: 1.5rem auto;
}

.start {
  background: #3498db;
  color: #fff;
}

.next {
  background: #f39c12;
  color: #fff;
}

.stop {
  background: #e74c3c;
  color: #fff;
}

.replay {
  background: #9b59b6;
  color: #fff;
}

/* Styles for "Elegir" button */
.suggestion-button {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 1em;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.3s ease, transform 0.2s ease;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.suggestion-button:hover {
  background-color: #2980b9;
  transform: scale(1.05);
}

/* Styles for albumSongsCheckbox */
#albumSongsCheckbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #3498db;
  margin: 0.25rem 0.5rem 0 0; /* margin-top, margin-right, margin-bottom, margin-left */
  vertical-align: middle;
  border-radius: 4px;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
  transition: box-shadow 0.3s ease;
  float: left;
}

#albumSongsCheckbox:hover, #albumSongsCheckbox:focus {
  box-shadow: 0 0 8px 2px #3498db;
  outline: none;
}

label[for="albumSongsCheckbox"] {
  cursor: pointer;
  font-weight: 600;
  color: #3498db;
  user-select: none;
  vertical-align: middle;
  padding-left: 0.25rem;
  font-size: 1rem;
  line-height: 1.2;
}

/* Revert previous label styling for albumSongsCheckbox */
label[for="albumSongsCheckbox"] {
  cursor: auto;
  font-weight: normal;
  color: inherit;
  user-select: auto;
  vertical-align: baseline;
  padding-left: 0;
  font-size: inherit;
  line-height: normal;
}

/* Style for albumSongsCheckboxLabel id */
#albumSongsCheckboxLabel {
  cursor: pointer;
  font-weight: 600;
  color: #3498db;
  user-select: none;
  vertical-align: middle;
  padding-left: 0.25rem;
  font-size: 1rem;
  line-height: 1.2;
}

/* Styles for playlistSongsCheckbox */
#playlistSongsCheckbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #3498db;
  margin: 0.25rem 0.5rem 0 0;
  vertical-align: middle;
  border-radius: 4px;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
  transition: box-shadow 0.3s ease;
  float: left;
}

#playlistSongsCheckbox:hover, #playlistSongsCheckbox:focus {
  box-shadow: 0 0 8px 2px #3498db;
  outline: none;
}

label[for="playlistSongsCheckbox"] {
  cursor: pointer;
  font-weight: 600;
  color: #3498db;
  user-select: none;
  vertical-align: middle;
  padding-left: 0.25rem;
  font-size: 1rem;
  line-height: 1.2;
}

/* Style for playlistSongsCheckboxLabel id */
#playlistSongsCheckboxLabel {
  cursor: pointer;
  font-weight: 600;
  color: #3498db;
  user-select: none;
  vertical-align: middle;
  padding-left: 0.25rem;
  font-size: 1rem;
  line-height: 1.2;
}

/* Styles for playlistSongsList */
#playlistSongsList {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 1rem;
  display: none;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  background: #f9fafe;
}

/* Styles for albumSongsList */
#albumSongsList {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 1rem;
  display: none;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  background: #f9fafe;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#albumSongsList li {
  cursor: pointer;
  transition: transform 0.3s ease;
}

#albumSongsList li:hover {
  animation: bounce 0.6s ease;
  transform-origin: center bottom;
}

/* Styles for playlistSongsList */
#playlistSongsList {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 1rem;
  display: none;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  background: #f9fafe;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#playlistSongsList li {
  cursor: pointer;
  transition: transform 0.3s ease;
}

#playlistSongsList li:hover {
  animation: bounce 0.6s ease;
  transform-origin: center bottom;
}

/* Styles for "Limpiar historial" button */
#clearHistoryBtn {
  background-color: #e74c3c;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 1em;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.3s ease;
  margin-top: 1rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#clearHistoryBtn:hover {
  background-color: #c0392b;
}

/* Progress bar */
#progressBar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 1rem;
  background: #dfe6ee;
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.05), inset -2px -2px 5px rgba(255,255,255,0.7);
  transition: height 0.3s ease;
}

#progressBar::-webkit-progress-value {
  background: linear-gradient(90deg, #6a11cb, #2575fc);
  animation: progressShift 3s linear infinite;
}

@keyframes progressShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

#progressBar:hover {
  height: 20px;
}

/* Tabs */
.tabs {
  display: flex;
  justify-content: center;
  position: relative;
  margin-bottom: 1rem;
}

.tab-button {
  background: none;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #2c3e50;
  cursor: pointer;
  transition: color 0.3s ease;
}

.tab-button:hover {
  color: #2575fc;
}

.tab-button.active {
  color: #2575fc;
}

.tab-indicator {
  position: absolute;
  bottom: 0;
  width: 0;
  height: 4px;
  background: #2575fc;
  border-radius: 2px;
  transition: left 0.3s ease, width 0.3s ease;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  box-shadow: 8px 8px 16px rgba(0,0,0,0.1), -8px -8px 16px rgba(255,255,255,0.7);
  border-radius: 16px;
  overflow: hidden;
}

th, td {
  padding: 1rem;
  text-align: center;
}

thead {
  background: #eef2f9;
}

tr:nth-child(even) {
  background: #f9fafe;
}

/* Bounce animation */
@keyframes bounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

/* Song suggestions */
#songSuggestions {
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  list-style: none;
}

/* Song history list */
#songHistoryList {
  list-style: none;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
  background: #f9fafe;
  border-radius: 12px;
  box-shadow: inset 2px 2px 8px rgba(0,0,0,0.05), inset -2px -2px 8px rgba(255,255,255,0.7);
  margin-top: 1rem;
}

#songHistoryList li {
  padding: 10px 15px;
  border-bottom: 1px solid #dfe6ee;
  font-size: 1rem;
  color: #2c3e50;
  cursor: default;
  transition: background-color 0.3s ease;
}

#songHistoryList li:last-child {
  border-bottom: none;
}

#songHistoryList li:hover {
  background-color: #e1e8f0;
  color: #1a2a4a;
  font-weight: 600;
}

/* Popup modal styles */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

/* Responsive styles for "Your Top Tracks" section */
@media (max-width: 600px) {
  /* Make the card full width with smaller padding */
  .card {
    padding: 1rem;
    max-width: 100%;
  }

  /* Tabs container: allow horizontal scroll if needed */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Tab buttons: smaller font and padding */
  .tab-button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    flex-shrink: 0;
  }

  /* Tab indicator height smaller */
  .tab-indicator {
    height: 3px;
  }

  /* Table container: add horizontal scroll */
  #topTracksTable {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Table cells: reduce padding and font size */
  th, td {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  /* Table header background: slightly lighter for contrast */
  thead {
    background: #f0f4fb;
  }
}

.popup.hidden {
  display: none;
}

.popup-content {
  background-color: white;
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  text-align: center;
}

.popup-content h2 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.popup-buttons {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.popup-buttons .btn {
  padding: 0.5rem 1.5rem;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
}

.popup-success {
  border-left: 6px solid #2ecc71;
}

.popup-error {
  border-left: 6px solid #e74c3c;
}

.popup-warning {
  border-left: 6px solid #f39c12;
}

.popup-info {
  border-left: 6px solid #3498db;
}

.popup .btn.ok {
  background-color: #3498db;
  color: white;
}

.popup .btn.cancel {
  background-color: #e74c3c;
  color: white;
}

#keyboardShortcuts {
  max-width: 400px;
  margin: 1rem auto;
  padding: 1rem 1.5rem;
  background-color: #f0f4f8;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  font-family: 'Poppins', sans-serif;
  color: #2c3e50;
}

#keyboardShortcuts h2 {
  margin-top: 0;
  font-weight: 600;
  font-size: 1.25rem;
  color: #3498db;
  text-align: center;
}

#keyboardShortcuts ul {
  list-style: none;
  padding-left: 0;
  margin-top: 0.5rem;
}

#keyboardShortcuts li {
  padding: 0.4rem 0;
  font-size: 1rem;
  border-bottom: 1px solid #d1d9e6;
}

#keyboardShortcuts li:last-child {
  border-bottom: none;
}

#keyboardShortcuts strong {
  color: #2980b9;
  font-weight: 700;
}

/* Volume control styling */
.volume-control {
  background: #eef2f9;
  border-radius: 16px;
  box-shadow: 8px 8px 16px rgba(0,0,0,0.1), -8px -8px 16px rgba(255,255,255,0.7);
  padding: 2rem;
  margin-bottom: 2rem;
  max-width: 600px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .volume-control {
    flex-direction: column;
    padding: 1rem;
    max-width: 100%;
    width: 100%;
  }

  .volume-control label {
    min-width: auto;
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  #volumeSlider {
    width: 100%;
  }

  #volumeValue {
    margin-top: 0.5rem;
    font-size: 1rem;
  }
}

.volume-control label {
  font-weight: 600;
  font-size: 1.2rem;
  color: #2c3e50;
  min-width: 80px;
}

#volumeSlider {
  flex-grow: 1;
  cursor: pointer;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #6a11cb, #2575fc);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #3498db;
  cursor: pointer;
  border-radius: 50%;
  border: none;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.7);
  transition: background-color 0.3s ease;
}

#volumeSlider::-webkit-slider-thumb:hover {
  background-color: #2980b9;
}

#volumeSlider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #3498db;
  cursor: pointer;
  border-radius: 50%;
  border: none;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.7);
  transition: background-color 0.3s ease;
}

#volumeSlider::-moz-range-thumb:hover {
  background-color: #2980b9;
}
