* {
  box-sizing: border-box;
  backface-visibility: hidden;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  background: linear-gradient(145deg, #1a1a1a, #2c2c2c);
  color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
}

header {
  width: 100%;
  padding: 1.5rem;
  background: linear-gradient(to right, #4a90e2, #007aff); /* Blue gradient */
  text-align: center;
  color: #ffffff; /* White text color */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  will-change: transform, opacity;
  border-radius: 0.75rem; /* Rounds the edges of the header */
}

header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

/* Flag waving animation - wind effect */
.flag {
  display: inline-block;
  font-size: 2rem;
  animation: flagWave 2s infinite ease-in-out;
  transform-origin: left center;
  will-change: transform;
  backface-visibility: hidden;
}

/* Apply a delay for each character to mimic a wave going across fabric */
.flag:nth-child(1) { animation-delay: 0s; }
.flag:nth-child(2) { animation-delay: 0.1s; }
.flag:nth-child(3) { animation-delay: 0.2s; }
/* Add more if you split the flag into more parts */

@keyframes flagWave {
  0%   { transform: rotateZ(0deg) translateY(0px); }
  25%  { transform: rotateZ(2deg) translateY(-2px); }
  50%  { transform: rotateZ(0deg) translateY(2px); }
  75%  { transform: rotateZ(-2deg) translateY(-2px); }
  100% { transform: rotateZ(0deg) translateY(0px); }
}

header::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" opacity="0.1"><path d="M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 18a8 8 0 1 1 0-16 8 8 0 0 1 0 16zm0-14l1.5 4.5h4.5l-3.5 2.5 1.5 4.5-3.5-2.5-3.5 2.5 1.5-4.5-3.5-2.5h4.5z"/></svg>') no-repeat center;
  background-size: 50%;
  opacity: 0.1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  padding: 1rem;
  background-color: #1c1c1c;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.player-controls {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
  justify-content: center;
  align-items: center;
}

/* Simple, clean button design */
.player-controls button,
#playPauseBtn,
#prevBtn,
#nextBtn {
  background: #2c2c2c !important;
  color: #ffffff !important;
  border: 1px solid #444 !important;
  border-radius: 8px !important;
  font-size: 0.9rem !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.75rem 1rem !important;
  transition: all 0.2s ease !important;
  outline: none !important;
  min-width: 3rem !important;
  height: 2.5rem !important;
}

/* Play/Pause button - same styling */
#playPauseBtn {
  background: #003087 !important;
  border-color: #0044cc !important;
  min-width: 4rem !important;
}

.player-controls button:hover,
#prevBtn:hover,
#nextBtn:hover {
  background: #444 !important;
  border-color: #666 !important;
}

#playPauseBtn:hover {
  background: #0044cc !important;
  border-color: #0055dd !important;
}

.player-controls button:active,
#playPauseBtn:active,
#prevBtn:active,
#nextBtn:active {
  transform: translateY(1px) !important;
}

.player-controls button:focus,
#playPauseBtn:focus,
#prevBtn:focus,
#nextBtn:focus {
  outline: 2px solid #b22222 !important;
  outline-offset: 2px !important;
}

/* Keep text labels for better UX */
.player-controls button span,
#playPauseBtn span,
#prevBtn span,
#nextBtn span {
  display: inline !important;
  margin-left: 0.25rem !important;
}

.control-btn {
  background: #003087;
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  backface-visibility: hidden;
}

.control-btn:hover {
  background: #b22222;
  transform: scale(1.05);
}

.control-btn:active {
  transform: scale(1);
}

#search {
  width: 90%;
  max-width: 36rem;
  padding: 0.75rem 1.25rem;
  margin: 0.5rem 0;
  border-radius: 9999px;
  border: none;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  will-change: backdrop-filter;
}

#search::placeholder {
  color: #b0b0b0;
}

#search:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 3px rgba(178, 34, 34, 0.3);
}

#stations {
  width: 90%;
  max-width: 44rem;
  margin: 1rem auto 6rem auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 3rem;
  justify-content: space-between;
}

.station {
  background: rgba(40, 40, 40, 0.95);
  padding: 1rem 1.25rem;
  margin: 0;
  border-radius: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  flex: 1 1 calc(50% - 0.25rem);
  box-sizing: border-box;
  will-change: transform;
  backface-visibility: hidden;
}

.station:hover {
  background: rgba(0, 48, 135, 0.2);
  transform: translateX(3px);
}

.station.active {
  background: rgba(255, 255, 255, 0.15);
  border-left: 4px solid #b22222;
}

.station-logo {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.station-name {
  font-size: 1.125rem;
  font-weight: 500;
}

.now-playing {
  text-align: center;
  font-size: 1rem;
  color: #e5e7eb;
  padding: 0.75rem 1.25rem;
  background: rgb(40, 40, 40);
  border-radius: 0.5rem;
  margin: 0.75rem 0;
  width: 90%;
  max-width: 36rem;
  border: 1px solid rgba(178, 34, 34, 0.2);
  transition: all 0.3s ease;
  will-change: transform;
  backface-visibility: hidden;
}

.now-playing:hover {
  background: rgba(255, 255, 255, 0.12);
}

.now-playing-name {
  font-weight: 600;
  color: #ffffff;
}

.now-playing-address {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.25rem;
  display: block;
}

.notification {
  text-align: center; /* Centers the text */
  font-size: 0.875rem; /* Slightly smaller font size */
  color: #ffffff; /* White text color */
  background-color: #ff9800; /* Bright orange for visibility */
  padding: 0.5rem 1rem; /* Adds padding for spacing */
  border-radius: 0.5rem; /* Rounds the edges */
  margin: 0.5rem auto; /* Adds spacing and centers the notification */
  width: 90%; /* Makes it responsive */
  max-width: 36rem; /* Limits the maximum width */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); /* Adds a subtle shadow */
}

.error {
  color: #ff4d4d;
}

audio {
  display: none;
}

credit {
  text-align: center; /* Centers the text */
  font-size: 0.75rem; /* Slightly smaller font size */
  color: #ffffff; /* White text color */
  margin-top: 0.5rem; /* Adds spacing above */
  background-color: transparent; /* Removes background */
  padding: 0; /* Removes padding */
}

@media (max-width: 768px) {
  header h1 {
    font-size: 1.5rem;
  }

  .station {
    padding: 0.75rem 1rem;
    flex: 1 1 100%;
  }

  .station-logo {
    width: 2.5rem;
    height: 2.5rem;
    margin-right: 0.75rem;
  }

  .station-name {
    font-size: 1rem;
  }

  .now-playing-address {
    font-size: 0.75rem;
  }

  .control-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }

  .now-playing {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
  }
}