/* General Styles */
body {
  margin: 0;
  font-family: 'Arial', sans-serif;
  background-image: url('./assets/rain-background.webp');
  background-size: cover;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
}

.container {
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 15px;
  border-radius: 10px;
  margin: 0 auto;
  max-width: 1200px;
  max-height: 95vh;
  overflow-y: auto;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 5px;
  color: #fff;
}

.subtitle {
  font-size: 1rem;
  color: #a8c5a8;
  margin-bottom: 15px;
  margin-top: 0;
  font-style: italic;
  opacity: 0.9;
}

/* NEW: Rain Audio Controls */
.rain-audio-controls {
  margin: 10px auto 15px auto;
  padding: 10px;
  background: rgba(29, 53, 29, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 400px;
}

.rain-audio-controls label {
  font-size: 0.9rem;
  color: #d8e8d8;
  margin: 0;
}

#rainVolumeSlider {
  width: 120px;
  margin: 0 5px;
}

#rainToggleBtn {
  padding: 6px 12px;
  background: #2d4a2d;
  color: #d8e8d8;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background-color 0.2s;
  height: 30px;
  line-height: 1;
  white-space: nowrap;
}

#rainToggleBtn:hover {
  background: #3c633c;
}

/* Video Player */
.video-player {
  width: 700px;
  height: 380px;
  margin: 0 auto 15px auto;
}

#videoContainer {
  width: 700px;
  height: 380px;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  padding: 0;
}

#rainVideo {
  width: 700px;
  height: 380px;
  object-fit: cover;
}

/* Controls */
.controls {
  margin: 10px auto 15px auto;
  position: relative;
  z-index: 20;
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 5px;
}

button {
  padding: 8px 16px;
  margin: 0 5px;
  white-space: nowrap;
  height: 35px;
  line-height: 1;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  border-radius: 20px;
  background: #2d4a2d;
  color: #d8e8d8;
  transition: background-color 0.2s;
}

button:hover {
  background: #3c633c;
}

input[type="range"] {
  margin: 0 10px;
  vertical-align: middle;
  width: 100px;
  height: 4px;
  -webkit-appearance: none;
  background: #2d4a2d;
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: #d8e8d8;
  border-radius: 50%;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #d8e8d8;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Video Title */
#videoTitle {
  color: #a8c5a8;
  margin-bottom: 15px;
}

/* IMPROVED: Spotify Player with better spacing */
.spotify-player {
  margin-top: 10px; /* REDUCED from 15px */
  position: relative;
  z-index: 10;
  clear: both;
}

.spotify-title {
  font-size: 1.1rem;
  color: #d8e8d8;
  margin: 0 0 8px 0; /* REDUCED spacing */
  font-weight: normal;
}

/* IMPROVED: Playlist controls with better spacing */
.playlist-controls {
  margin-top: 8px; /* REDUCED from 10px */
  display: flex;
  gap: 10px;
  justify-content: center;
}

.playlist-controls button {
  background: #2d4a2d;
  color: #d8e8d8;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s;
  min-width: 120px;
  white-space: nowrap;
}

.playlist-controls button:hover {
  background: #3c633c;
}

/* IMPROVED: User playlists with better spacing */
.user-playlists {
  margin-top: 8px; /* REDUCED from 10px */
  text-align: center;
}

.user-playlists select {
  background: #2d4a2d;
  color: #d8e8d8;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  width: 200px;
}

.user-playlists select:hover {
  background: #3c633c;
}

/* Dimming Controls */
.dim-controls {
  margin-top: 15px;
}

label {
  font-size: 1rem;
  margin-right: 10px;
}

#skipBtn {
  background: #2d4a2d;
}

#skipBtn:hover {
  background: #3c633c;
}

.spotify-fallback {
  background: rgba(29, 53, 29, 0.5);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.spotify-fallback a {
  color: #1DB954;
  text-decoration: none;
}

.spotify-fallback a:hover {
  text-decoration: underline;
}

.playlist-toggle {
  margin-top: 10px;
  background: #2d4a2d;
  color: #d8e8d8;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s;
}

.playlist-toggle:hover {
  background: #3c633c;
}

.playlist-toggle:active {
  transform: scale(0.98);
  background: #4a774a;
}

#skipLocationBtn {
  padding: 8px 16px;
  background: #2d4a2d;
  color: #d8e8d8;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  margin: 0 5px;
  font-size: 0.9rem;
  transition: background-color 0.2s;
  height: 35px;
  line-height: 1;
  white-space: nowrap;
}

#skipLocationBtn:hover {
  background: #3c633c;
}

#skipLocationBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#locationInfo {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.8);
  padding: 0;
  z-index: 1000;
  color: white;
  font-family: Arial, sans-serif;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  max-width: 300px;
  border-radius: 8px;
}

.overlay-header {
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 15px;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px 8px 0 0;
}

.overlay-content {
  padding: 15px;
}

#locationInfo h3 {
  margin: 0 0 8px 0;
  font-size: 1.3em;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#locationInfo p {
  margin: 5px 0;
  font-size: 1em;
  color: #eee;
  line-height: 1.4;
}

#locationInfo .weather-icon {
  float: right;
  margin-left: 10px;
  width: 50px;
  height: 50px;
}

#locationInfo:hover {
  background-color: rgba(0, 0, 0, 0.8);
  transform: translateY(-2px);
  transition: all 0.3s ease;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.7);
}

.modal-content {
  background-color: rgba(30, 30, 30, 0.9);
  margin: 15% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 600px;
  border-radius: 10px;
  color: white;
  animation: modalFade 0.3s ease;
}

@keyframes modalFade {
  from {
      opacity: 0;
      transform: translateY(-20px);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

.modal-text {
  margin: 20px 0;
  line-height: 1.6;
}

.modal h2 {
  text-align: center;
  color: #fff;
  margin-bottom: 20px;
}

.modal p {
  margin: 15px 0;
}

#modalClose {
  display: block;
  width: 200px;
  margin: 20px auto 0;
  padding: 10px 20px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

#modalClose:hover {
  background-color: #45a049;
}

.show {
  display: block !important;
}

.overlay-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 8px 12px;
  margin: 5px 0;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  transition: background 0.3s;
}

.overlay-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

#cityListModal {
  display: flex !important;
  position: fixed;
  z-index: 2001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  overflow-y: auto;
  justify-content: center;
  align-items: center;
}

#cityListModal .modal-content {
  background-color: rgba(30, 30, 30, 0.95);
  margin: 5% auto;
  padding: 20px;
  width: 80%;
  max-width: 500px;
  border-radius: 8px;
  max-height: 80vh;
  overflow-y: auto;
}

.city-button {
  width: 100%;
  padding: 12px 15px;
  margin: 5px 0;
  background-color: rgba(50, 50, 50, 0.8);
  border: 1px solid #666;
  border-radius: 5px;
  color: white;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.3s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.city-button:hover {
  background-color: rgba(70, 70, 70, 0.8);
}

.city-info {
  flex-grow: 1;
}

.city-name {
  font-size: 1.1em;
  font-weight: bold;
}

.city-details {
  font-size: 0.9em;
  color: #ccc;
}

#cityList {
  max-height: 400px;
  overflow-y: auto;
  margin: 20px 0;
}

#closeCityList {
  width: 100%;
  padding: 10px;
  background-color: #444;
  border: none;
  border-radius: 5px;
  color: white;
  cursor: pointer;
  margin-top: 10px;
}

#closeCityList:hover {
  background-color: #555;
}

#cityList::-webkit-scrollbar {
  width: 8px;
}

#cityList::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

#cityList::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

#cityList::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

.spotify-container {
  margin-top: 10px;
  text-align: center;
}

.spotify-container select {
  background: rgba(45, 45, 45, 0.9);
  color: white;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  width: 200px;
  cursor: pointer;
}

.spotify-container select:hover {
  background: rgba(60, 60, 60, 0.9);
}

#showCityList {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
  transition: background-color 0.3s;
}

#showCityList:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* FIXED: Hide Connect Spotify button when connected - with important declarations */
.spotify-connected #spotifyLoginBtn,
#spotifyLoginBtn.hidden,
.spotify-player #spotifyLoginBtn:not(.show) {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* FIXED: Additional selectors to ensure the button is hidden */
button[id*="spotify"]:not(#rainSoundsBtn) {
  display: none !important;
}

/* Show the button only if explicitly needed */
#spotifyLoginBtn.show {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .container {
    padding: 10px;
    max-height: 98vh;
  }
  
  .video-player, #videoContainer {
    width: 100%;
    max-width: 500px;
    height: auto;
    aspect-ratio: 16/9;
  }
  
  #rainVideo {
    width: 100%;
    height: 100%;
  }
  
  .rain-audio-controls {
    flex-direction: column;
    gap: 8px;
    padding: 8px;
  }
  
  #rainVolumeSlider {
    width: 200px;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .controls {
    flex-wrap: wrap;
    gap: 5px;
  }
  
  button {
    font-size: 0.8rem;
    padding: 6px 12px;
    height: 32px;
  }
  
  input[type="range"] {
    width: 80px;
  }
}