* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Montserrat', sans-serif;
  background: linear-gradient(135deg, #1d2b64 0%, #482c54 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  color: white;
  position: relative;
  overflow: hidden;
}

.player {
  background: rgba(255, 255, 255, 0.1);
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 95%; /* Allow it to take more width on larger screens */
  height: auto;
  max-width: 900px; /* Increased max-width */
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 40px;
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  animation: fadeIn 1s ease-in;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes subtle-move {
  0% {
    transform: scale(1.05) translate(-5px, -3px);
  }
  25% {
    transform: scale(1.15) translate(3px, 2px);
  }
  50% {
    transform: scale(1.08) translate(5px, 3px);
  }
  75% {
    transform: scale(1.12) translate(-2px, -1px);
  }
  100% {
    transform: scale(1.05) translate(-5px, -3px);
  }
}

.background-art {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -1;
  opacity: 0;
  transition: opacity 1s ease;
  animation: subtle-move 20s ease-in-out infinite;
}

.background-art.visible {
  opacity: 0.8;
}

.visualizer-container {
  position: relative;
  width: clamp(250px, 35vw, 350px); /* Adjusted clamp max value */
  height: clamp(250px, 35vw, 350px); /* Adjusted clamp max value */
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.circle-visualizer {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 30px rgba(255,255,255,0.2);
}

.circle-visualizer::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 80%;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255,255,255,0.2);
  border-radius: 50%;
}

@keyframes pulse {
  0% { transform: scale(0.95); filter: brightness(0.8); }
  50% { transform: scale(1.05); filter: brightness(1.2); }
  100% { transform: scale(0.95); filter: brightness(0.8); }
}

.wave-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transform: scale(1.2);
}

.wave {
  width: 4px;
  background: rgba(255,255,255,0.8);
  animation: wave 1s ease-in-out infinite;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

@keyframes wave {
  0% { height: 10px; }
  50% { height: 30px; }
  100% { height: 10px; }
}

.content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
  padding: 0;
  width: auto;
  flex: 1;
  gap: 20px;
}

.station-info {
  margin-bottom: 0;
}

.station-name {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  background: linear-gradient(to right, #fff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(255,255,255,0.2);
}

.station-name span {
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
  background-size: 300% 300%;
  border-radius: 8px;
  animation: gradient-flow 3s ease-in-out infinite;
  box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

@keyframes gradient-flow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.now-playing {
  margin-top: 20px;
  width: 100%;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
}

.live-dot {
  width: 9px;
  height: 9px;
  background-color: #ff0000;
  border-radius: 50%;
  animation: blink-live 1.8s infinite ease-in-out;
  box-shadow: 0 0 5px #ff0000, 0 0 10px #ff0000;
}

@keyframes blink-live {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.8);
  }
}

#songInfo {
  font-size: clamp(1rem, 2vw, 1.2rem); /* Responsive font size */
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  transition: all 0.3s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Show max 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  word-wrap: break-word;
}

#artistInfo {
  font-size: clamp(0.9rem, 1.5vw, 1rem);  /* Responsive font size */
  color: #a5b4fc;
  margin-top: 4px;
  font-weight: 500;
  line-height: 1.4;
  transition: all 0.3s ease;
  display: -webkit-box;
  -webkit-line-clamp: 1; /* Show only 1 line */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

#artistInfo:hover {
  color: white;
}

.metadata {
  font-size: 1rem;
  font-weight: 500;
  color: #a5b4fc;
  margin-top: 8px;
  transition: all 0.3s ease;
}

.metadata:hover {
  color: white;
}

.controls {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 20px;
  width: 100%;
}

.play-btn {
  background: rgb(211, 50, 83); /* COLOR BOTÓN PLAY */
  border: none;
  width: 70px;
  height: 70px;
  aspect-ratio: 1 / 1; /* Ensures the button is a perfect square */
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.play-btn:hover {
  background: rgb(3, 0, 0); /* COLOR HOVER BOTÓN PLAY */
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.volume-control {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0;
}

.volume-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  outline: none;
  transition: all 0.3s ease;
}

.volume-slider:hover {
  background: rgba(255,255,255,0.3);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
  .player {
    padding: 20px;
    max-width: 95vw; /* Changed from 90vw to make it wider */
    flex-direction: column;
    gap: 20px;
    height: 100vh; /* Make it full height */
    width: 100vw; /* Make it full width */
    max-width: 100vw; /* Ensure it can go full width */
    border-radius: 0; /* Remove border radius on mobile */
    justify-content: center; /* Center content vertically */
    padding-top: env(safe-area-inset-top); /* Add padding for notch */
    padding-bottom: env(safe-area-inset-bottom); /* Add padding for bottom bar */
  }

  .visualizer-container {
    width: clamp(150px, 45vw, 220px);
    height: clamp(150px, 45vw, 220px);
  }

  .content {
    padding: 0;
    gap: 15px;
    align-items: center;
    text-align: center;
    flex: initial;
    width: 100%;
  }

  .station-name {
    font-size: clamp(1.4rem, 6vw, 2rem);
    text-align: center;
    width: 100%;
  }

  .controls {
    gap: 15px;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  #songInfo {
    font-size: clamp(0.9rem, 4vw, 1.1rem);
    -webkit-line-clamp: 3;
    max-width: 100%;
    padding: 0 10px;
  }

  #artistInfo {
    font-size: clamp(0.8rem, 3.5vw, 1rem);
    padding: 0 10px;
  }

  .live-badge {
    font-size: clamp(0.7rem, 3vw, 0.9rem);
  }

  .volume-control {
    width: 90%;
  }

  .app-store-buttons {
    width: 100%;
    justify-content: center;
    padding: 0 20px;
  }

  .store-btn {
    padding: 8px 12px;
    font-size: clamp(0.8rem, 3vw, 0.9rem);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .player {
    width: 90%;
    padding: 30px;
    gap: 30px;
  }

  .visualizer-container {
    width: clamp(200px, 30vw, 300px);
    height: clamp(200px, 30vw, 300px);
  }

  #songInfo {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
  }
}

.album-art {
  width: 100%;
  height: 100%;
  position: absolute;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.album-art.visible {
  opacity: 1;
}

.volume-percentage {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.8);
  min-width: 45px;
  text-align: right;
}

/* Add new styles for menu */
.menu-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.2);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 100;
}

.menu-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

.social-menu {
  position: absolute;
  top: 80px;
  right: 20px;
  background: rgba(255,255,255,0.1);
  padding: 20px;
  border-radius: 15px;
  display: none;
  flex-direction: column;
  gap: 15px;
  z-index: 100;
  animation: slideDown 0.3s ease-out;
  backdrop-filter: blur(15px); /* Increased blur effect */
  -webkit-backdrop-filter: blur(15px); /* For Safari */
  border: 1px solid rgba(255,255,255,0.2); /* Added subtle border */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); /* Added shadow for depth */
}

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

.social-menu.active {
  display: flex;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
  font-size: 1.1rem;
  padding: 10px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.social-link:hover {
  background: rgba(211, 50, 83);
  transform: translateX(5px);
}

.social-link svg {
  width: 24px;
  height: 24px;
}

.app-store-buttons {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  gap: 10px;
  z-index: 100;
}

.store-btn {
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 15px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: white;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.store-btn:hover {
  background: rgba(211, 50, 83);
  transform: translateY(-3px);
}

.store-btn svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 768px) {
  .app-store-buttons {
    left: 50%;
    transform: translateX(-50%);
  }
}

/* iOS Specific Styles */
@supports (-webkit-touch-callout: none) {
  .player {
    /* Account for bottom safe area on newer iPhones */
    padding-top: max(40px, env(safe-area-inset-top));
    padding-bottom: max(40px, env(safe-area-inset-bottom));
    padding-left: max(40px, env(safe-area-inset-left));
    padding-right: max(40px, env(safe-area-inset-right));
  }

  .menu-btn {
    top: max(20px, env(safe-area-inset-top));
    right: max(20px, env(safe-area-inset-right));
  }

  .social-menu {
    top: max(80px, calc(env(safe-area-inset-top) + 60px));
    right: max(20px, env(safe-area-inset-right));
  }

  .app-store-buttons {
    bottom: max(20px, env(safe-area-inset-bottom));
    left: max(20px, env(safe-area-inset-left));
  }

  /* Optimize for iPhone notch */
  @media screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
    .player {
      padding-top: calc(env(safe-area-inset-top) + 20px);
    }
  }

  /* iPhone 14 Pro Max */
  @media screen and (device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) {
    .player {
      padding-top: calc(env(safe-area-inset-top) + 20px);
      max-width: 95vw;
    }
  }

  /* iPhone 14 Pro */
  @media screen and (device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) {
    .player {
      padding-top: calc(env(safe-area-inset-top) + 20px);
    }
  }

  /* iPhone SE 3rd gen */
  @media screen and (device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) {
    .player {
      padding: 30px 20px;
    }
  }
}

/* PWA status bar overlay fix */
html.standalone {
  overflow-y: auto;
  position: static;
  height: auto;
}

body.standalone {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Splash screen styles */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #1d2b64 0%, #482c54 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

.splash-text {
  color: white;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
}

/* Installation prompt styles */
.install-prompt {
  display: none; /* Hide it completely */
}

/* Install Modal Styles */
.install-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 20, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.install-modal.visible {
  opacity: 1;
  pointer-events: auto;
}
.install-modal.hidden {
  display: none;
}
.install-modal-content {
  position: relative;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 40px 30px;
  border-radius: 20px;
  width: 90%;
  max-width: 380px;
  text-align: center;
  color: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}
.install-modal.visible .install-modal-content {
  transform: scale(1);
}
.install-modal-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  animation: pulse 2s ease-in-out infinite;
}
.install-modal-title {
    font-size: clamp(1.4rem, 4vw, 1.8rem); /* Adjusted font size for responsiveness */
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.2);
    position: relative;
    padding-bottom: 15px;
    text-transform: uppercase;
}
.install-modal-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    background-size: 300% 300%;
    border-radius: 2px;
    animation: gradient-flow 3s ease-in-out infinite;
}
.install-modal-description {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
  margin-bottom: 30px;
}
.install-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background 0.2s ease, transform 0.2s ease;
  padding: 0;
  font-size: 0;
}
.install-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}
.install-modal-close svg {
    stroke: white;
}
#installAppBtn.install-btn {
    background: #a5b4fc;
    color: #1d2b64;
    padding: 15px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(165, 180, 252, 0.3);
    border: none; /* Added this line */
    outline: none; /* Added this line */
}
#installAppBtn.install-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(165, 180, 252, 0.4);
}
#installAppBtn.install-btn:focus {
    outline: none; /* Added this line */
}
.dismiss-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    margin-top: 15px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    padding: 10px;
}
.dismiss-btn:hover {
    color: white;
}

/* Enhanced touch targets for iOS */
@media (hover: none) and (pointer: coarse) {
  .play-btn,
  .menu-btn,
  .social-link,
  .store-btn {
    min-width: 44px;
    min-height: 44px;
  }
  
  .social-link {
    padding: 15px;
    margin: 5px 0;
  }
  
  .volume-slider {
    /* height: 44px; - This was making the slider bar too thick on mobile */
    /* padding: 15px 0; */
  }
}

/* Prevent text selection and callouts on iOS */
.player,
.controls,
.station-info {
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Optimize for Dynamic Island on iPhone 14 Pro models */
@media screen and (device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3),
       screen and (device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) {
  .menu-btn {
    top: calc(env(safe-area-inset-top) + 10px);
  }
  
  .social-menu {
    top: calc(env(safe-area-inset-top) + 70px);
  }
}

/* Optimized image sizes */
.album-art,
.visualizer-container {
  width: clamp(250px, 35vw, 350px); /* Adjusted clamp max value */
  height: clamp(250px, 35vw, 350px); /* Adjusted clamp max value */
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .album-art,
  .background-art {
    image-rendering: -webkit-optimize-contrast;
  }
}

@media (max-width: 768px) {
  .album-art,
  .visualizer-container {
    width: clamp(150px, 40vw, 250px); /* Adjusted clamp for mobile */
    height: clamp(150px, 40vw, 250px); /* Adjusted clamp for mobile */
  }
}

/* Prevent pull-to-refresh on iOS */
html {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* Audio context wake lock for iOS */
body.ios-device {
  cursor: pointer;
}

/* iOS button active states */
@media (hover: none) {
  .play-btn:active,
  .menu-btn:active,
  .social-link:active,
  .store-btn:active {
    opacity: 0.7;
  }
}
.social-icons {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.social-icons img {
  width: 32px;
  height: 32px;
  transition: transform 0.3s ease;
}

.social-icons img:hover {
  transform: scale(1.4);
}