:root {
  --primary-color: #383838;
  --primary-light-color: #bb86fc;
  --primary-dark-color: #007ab3;
  --secondary-color: #03dac6;
  --background-color: #121212;
  --surface-color: #eee8e8;
  --on-primary-color: #ffffff;
  --on-surface-color: #ffffff;
  --text-color: rgba(39, 38, 38, 0.87);
  --text-secondary-color: rgba(49, 49, 49, 0.6);
  --shadow-color: rgba(0, 0, 0, 0.2);
}

body {
  background-color: var(--background-color);
  font-family: "Roboto", sans-serif;
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: 20px; /* Adjust based on player height + margin */
  padding-left: 20px;
  padding-right: 20px;
  padding-bottom: 300px;
}

.navbar {
  position: fixed;
  top: 0;
  right: 0;
  padding: 10px 20px;
  z-index: 1001; /* Ensure it's above other elements */
}

.logout-button {
  background-color: var(--primary-color);
  color: var(--on-primary-color);
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9em;
}

.logout-button:hover {
  background-color: var(--primary-dark-color);
}

/* Password Overlay Styles */
.password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.password-form-container {
  background-color: var(--surface-color);
  max-width: 80%; /* Limit width to 80% of the page */
  /* Bootstrap's card, p-4, shadow-lg classes handle padding, shadow, and background */
}

.password-form-container h2 {
  color: var(
    --primary-color
  ); /* Changed to a darker color for better contrast */
}

.password-form-container input[type="password"] {
  background-color: #333;
  color: var(--on-primary-color); /* Changed to white text */
}

.password-form-container input[type="password"]::placeholder {
  color: rgba(255, 255, 255, 0.7); /* Lighter placeholder text */
}

.password-form-container button {
  background-color: var(--primary-color);
  color: var(--on-primary-color);
}

.password-form-container button:hover {
  background-color: var(--primary-dark-color);
}

.error-message {
  color: #ff6b6b; /* A distinct error color */
}

/* Main Content Styles - Bootstrap handles most of this now */
#content-wrapper {
  /* display: none; handled by JS */
}

.central-player-anchor {
  position: fixed;
  text-align: center;
  bottom: -10px;
  right: 20px;
  width: 400px;
  display: none; /* Hidden by default */
  border: 1px solid var(--primary-color);
  background-color: var(--surface-color);
  border-radius: 15px; /* Rounded corners for the player */
  padding: 10px;
  /* box-shadow: 8px 8px var(--shadow-color); Match player shadow */
  box-shadow: 5px 5px 10px 0px #888888;
  z-index: 1000; /* Ensure player is above other content */
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0; /* Remove padding to let the image control size */
  z-index: 1002; /* Ensure it's above other player elements */
}

.close-button:hover .close-icon {
  opacity: 0.7; /* Slightly dim the icon on hover */
}

.close-icon {
  display: block;
  width: 24px; /* Adjust size as needed */
  height: 24px; /* Adjust size as needed */
  transition: opacity 0.2s ease-in-out;
}

.central-player-container {
  position: relative;
  margin-left: 30px;
  margin-right: 30px;
  padding: 10px;
  /* z-index: 999; Removed as z-index is on central-player-anchor */
  background-color: white;
  box-shadow: 0 8px 16px var(--shadow-color);
  padding: 5px; /* Adjust padding for fixed position */
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: none; /* Allow it to span full width */
  border-radius: 15px; /* Remove border-radius for full width top bar */
  border: 1px solid var(--primary-color); /* Add a border to match the player */
}

.central-player-container h2 {
  color: var(--text-color); /* Use the general page text color */
  flex-grow: 1; /* Allow title to take available space */
  text-align: left; /* Align title to left */
}

/* Album Art Styling */
#albumArt {
  width: 100%;
  /* height: 800px; */
  object-fit: cover;
  border-radius: 4px;
  margin-right: 15px;
}

.player-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  justify-content: center;
}

.player-controls button {
  background-color: var(--primary-color);
  color: var(--on-primary-color);
}

#chromecastButton {
  display: none; /* Hidden by default until Cast API is available */
}

.player-controls button:hover {
  background-color: var(--primary-dark-color);
}

.soundboard-container {
  background-color: var(--on-surface-color);
  /* Bootstrap's row, row-cols-*, g-3 classes handle grid layout and gaps */
}

.sound-wrapper {
  background-color: var(--surface-color);
  box-shadow: 0 8px 16px var(--shadow-color); /* Match player shadow */
  padding: 0; /* Remove padding from wrapper, move to button */
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  border-radius: 8px; /* Consistent border-radius */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: auto; /* Allow height to be determined by content */
}

.sound-wrapper:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3); /* Enhanced shadow on hover */
}

.sound-button {
  background-color: var(--primary-color);
  color: var(--on-primary-color);
  padding: 15px; /* Add padding to the button itself */
  width: 100%; /* Fill the width of the wrapper */
  aspect-ratio: 2 / 1; /* Maintain a square aspect ratio based on width */
  border: none; /* Remove custom border, rely on wrapper's shadow */
  border-radius: 8px; /* Consistent border-radius with wrapper */
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1em;
  font-weight: 500;
  text-align: center;
  text-transform: uppercase;
  white-space: normal;
  overflow: hidden; /* Hide overflow if text is too long for fixed height */
  text-overflow: ellipsis; /* Add ellipsis for overflowing text */
  transition: background-color 0.2s ease-in-out;
  background-size: cover; /* Ensure background image covers the button */
  background-position: 0 center; /* Center the background image */
}

@media (max-width: 768px) {
  .sound-button {
    aspect-ratio: 4 / 1;
  }

  body {
    padding-bottom: 160px;
  }

  .central-player-anchor {
    position: fixed;
    text-align: center;
    right: 0px;
    width: 100%;
    display: none; /* Hidden by default */
    border: 0px solid var(--primary-color);
    border-top: 1px solid var(--primary-color);
    background-color: var(--surface-color);
    border-radius: 0px; /* Rounded corners for the player */
    padding: 10px;
    box-shadow: 0px 0px 5px 0px #888888;
  }

  #albumArt {
    float: left;
    margin-left: 10px;
    border: 0px solid var(--primary-color);
    border-radius: 5px; /* Rounded corners for the player */
    margin: 0px 0px 0px 0px !important;
    aspect-ratio: 1 / 1; /* Maintain a square aspect ratio */
    width: 60px;
  }

  #playerTitle {
    margin-top: 5px;
    padding-left: 10px;
    padding-bottom: 0px;
    margin: 0px;
  }

  #playerArtist {
    padding-left: 10px;
  }
}

.sound-title {
  margin-top: 10px; /* Space between button and title */
  color: var(--text-color); /* Use the general page text color */
  font-size: 0.9em;
  font-weight: 500;
  text-align: center;
  white-space: normal;
  word-wrap: break-word; /* Break long words */
  max-width: 90%; /* Limit width to match button */
}

.sound-button:hover {
  background-color: var(--primary-dark-color); /* Consistent hover effect */
}

.sound-button:focus {
  outline: 2px solid var(--primary-color);
}

audio {
  width: 100%;
  margin-top: 10px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
}

/* Optional: Add a global font import for Roboto */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");
