/* ========== VARIABLES ========== */
:root {
  --yara-yellow: #FFD700;
  --yara-blue: #1E3A8A;
  --yara-black: #000000;
  --yara-white: #FFFFFF;
  --yara-gray: #1a1a1a;
  --yara-dark: #0a0a0a;
  --yara-accent: #ff6b6b;
  --yara-radius: 16px;
  --yara-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* ========== WIDGET BASE ========== */
.yara-nowplaying,
.yara-history,
.yara-top8,
.yara-social-feed,
.yara-ai-facts,
.yara-nowplaying-sc,
.yara-history-widget-sc,
.yara-top8-widget-sc,
.yara-social-shortcode {
  background: var(--yara-gray);
  border-radius: var(--yara-radius);
  padding: 20px;
  margin-bottom: 20px;
  color: var(--yara-white);
  box-shadow: var(--yara-shadow);
  border-left: 5px solid var(--yara-yellow);
  font-family: 'Montserrat', sans-serif;
}

.yara-widget-title {
  color: var(--yara-yellow);
  font-size: 1.4rem;
  margin-top: 0;
  margin-bottom: 15px;
  border-bottom: 2px solid var(--yara-blue);
  padding-bottom: 8px;
  font-weight: 700;
}

/* ========== NOW PLAYING SHORTCODE ========== */
.yara-nowplaying-sc {
  text-align: center;
  background: linear-gradient(135deg, var(--yara-dark) 0%, #1a1a2e 100%);
}

.np-sc-label {
  color: var(--yara-yellow);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.np-sc-song {
  color: var(--yara-white);
  font-size: 1.3rem;
  font-weight: 800;
  margin: 10px 0;
  transition: color 0.3s ease;
}

.np-sc-song.yara-new-song {
  color: var(--yara-yellow);
}

.np-sc-artist {
  color: #aaa;
  font-size: 1rem;
  margin-bottom: 8px;
}

.np-sc-show {
  color: var(--yara-yellow);
  font-size: 0.9rem;
  margin-top: 10px;
}

.np-sc-time {
  color: #666;
  font-size: 0.75rem;
  margin-top: 8px;
}

/* ========== TOP 8 ========== */
.top8-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.top8-list li {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #333;
  transition: background 0.2s;
}

.top8-list li:hover {
  background: rgba(255, 255, 255, 0.03);
}

.top8-list li:last-child {
  border-bottom: none;
}

.top-position {
  background: var(--yara-blue);
  color: var(--yara-yellow);
  font-weight: 800;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-right: 15px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.top-song {
  font-weight: 700;
  flex: 1;
  color: var(--yara-white);
  font-size: 0.95rem;
}

.top-artist {
  color: #aaa;
  font-size: 0.85rem;
}

.top-plays {
  color: var(--yara-yellow);
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 10px;
  white-space: nowrap;
}

.top8-loading,
.history-loading {
  color: #888;
  text-align: center;
  padding: 20px !important;
  justify-content: center !important;
}

/* ========== HISTORIAL ========== */
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--yara-blue);
  border-radius: 3px;
}

.history-list li {
  padding: 10px 0;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.history-list li:last-child {
  border-bottom: none;
}

.history-time {
  color: var(--yara-yellow);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ========== SOCIAL FEED ========== */
.social-message {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #2a2a2a;
  border-radius: 12px;
  margin-bottom: 12px;
}

.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.msg-content {
  flex: 1;
}

.msg-content strong {
  color: var(--yara-yellow);
  font-size: 0.9rem;
}

.msg-content p {
  margin: 4px 0;
  font-size: 0.9rem;
  color: #ddd;
}

.msg-content small {
  opacity: 0.6;
  font-size: 0.75rem;
  color: #aaa;
}

/* Botones sociales redondos */
.social-round-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 15px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 22px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  color: white;
  border: none;
}

.social-btn:hover {
  transform: scale(1.15) translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  filter: brightness(1.15);
}

.social-btn i {
  color: white;
  font-size: 20px;
}

.facebook { background: #1877f2; }
.instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.twitter { background: #000000; border: 1px solid #333; }
.telegram { background: #0088cc; }

/* ========== AI FACTS ========== */
.ai-fact-text {
  font-style: italic;
  background: #2a2a2a;
  padding: 15px;
  border-radius: 12px;
  margin: 10px 0;
  color: #eee;
  line-height: 1.5;
  border-left: 3px solid var(--yara-yellow);
}

.yara-ai-refresh {
  background: var(--yara-blue);
  color: var(--yara-yellow);
  border: none;
  padding: 10px 24px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.3s ease;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9rem;
}

.yara-ai-refresh:hover {
  background: var(--yara-yellow);
  color: var(--yara-black);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

/* ========== REPRODUCTOR ========== */
.yara-player-wrapper {
  position: relative;
  z-index: 999;
}

.barra-player {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 90px;
  background: linear-gradient(180deg, #282828 0%, #1a1a1a 100%);
  color: #eee;
  display: flex;
  align-items: center;
  padding: 0 24px;
  box-sizing: border-box;
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  justify-content: space-between;
  gap: 20px;
}

.radio-info {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 12px;
}

.radio-logo {
  height: 60px;
  width: auto;
  border-radius: 8px;
  object-fit: contain;
}

.radio-name {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 800;
  color: var(--yara-white);
  letter-spacing: 0.5px;
}

.social-buttons {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.social-btn-sm {
  color: #bbb;
  font-size: 1.3rem;
  text-decoration: none;
  transition: color 0.2s, transform 0.2s;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.social-btn-sm:hover {
  color: var(--yara-yellow);
  transform: scale(1.1);
  background: rgba(255, 215, 0, 0.1);
}

.metadata {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  max-width: 400px;
}

.player-cover {
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: 8px;
  background-color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  position: relative;
}

.player-cover.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #eee;
  border-top-color: transparent;
  animation: yara-spin 1s linear infinite;
}

@keyframes yara-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s;
}

.song-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  min-width: 0;
}

.song-title {
  font-size: 1rem;
  margin: 0 0 4px 0;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--yara-white);
}

.song-artist {
  font-size: 0.8rem;
  margin: 0;
  color: #bbb;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}

.player-button {
  background: var(--yara-white);
  color: #333;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.1rem;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s ease;
  position: relative;
}

.player-button:hover {
  background: var(--yara-yellow);
  transform: scale(1.08);
}

.player-button-play {
  width: 50px;
  height: 50px;
  font-size: 1.3rem;
}

.player-button-play.playing {
  background: var(--yara-yellow);
  color: var(--yara-black);
}

.player-button-play.playing::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.3);
  z-index: -1;
  animation: yara-pulse 2s infinite;
}

@keyframes yara-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  80% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: #f0f0f0;
  border-radius: 8px;
  height: 8px;
  width: 120px;
  cursor: pointer;
  display: none;
  z-index: 10;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--yara-accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #e34a4a;
}

.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--yara-accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #e34a4a;
}

.visualizer-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 35%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
  opacity: 1;
  transition: opacity 0.3s;
  filter: blur(1px);
}

.visualizer-container.visualizer-hidden {
  opacity: 0;
}

#audio-visualizer {
  display: block;
  width: 100%;
  height: 100%;
}

.dynamic-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0.04;
  z-index: -1;
  transition: background-image 0.5s ease;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .barra-player {
    height: auto;
    min-height: 70px;
    padding: 10px 15px;
    gap: 10px;
  }

  .radio-info {
    display: none;
  }

  .metadata {
    margin-right: 0;
    max-width: none;
    flex: 1;
  }

  .player-cover {
    width: 50px;
    height: 50px;
  }

  .song-title {
    font-size: 0.9rem;
  }

  .song-artist {
    font-size: 0.75rem;
  }

  .social-buttons {
    display: none;
  }

  .controls {
    gap: 8px;
  }

  .player-button {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .player-button-play {
    width: 44px;
    height: 44px;
  }

  .volume-slider {
    width: 80px;
  }

  .visualizer-container {
    height: 30px;
  }

  .yara-nowplaying-sc,
  .yara-history-widget-sc,
  .yara-top8-widget-sc,
  .yara-social-shortcode {
    padding: 15px;
  }

  .top-position {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }
}

@media (min-width: 769px) {
  .social-buttons {
    display: flex;
  }

  .radio-info {
    display: flex;
  }
}

/* Evitar desbordes cuando el nombre de una cancion llega demasiado largo. */
.np-sc-song {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.np-sc-artist, .np-sc-show, .np-song, .np-artist-name, .np-show-name, .np-host-name, .song-title, .song-artist {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.song-title, .np-song {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
