/**
 * Rádio Portal Curupira Player - Folha de Estilos Otimizada
 * Paridade visual 100% com Live Preview, responsivo e sem conflitos de tema
 */

:root {
  --crp-primary: #1b5e20;
  --crp-accent: #f27d26;
  --crp-bg: #0d1117;
  --crp-text: #ffffff;
  --crp-text-muted: #94a3b8;
  --crp-offset-v: 24px;
  --crp-offset-h: 24px;
  --crp-radius: 9999px;
  --crp-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.7);
  --crp-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container Principal Fixo */
.crp-player-wrapper {
  position: fixed;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  box-sizing: border-box;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.crp-player-wrapper * {
  box-sizing: border-box;
}

/* Posições e Deslocamentos (Offsets) Customizáveis */
.crp-pos-bottom-left {
  bottom: var(--crp-offset-v, 24px);
  left: var(--crp-offset-h, 24px);
}

.crp-pos-bottom-right {
  bottom: var(--crp-offset-v, 24px);
  right: var(--crp-offset-h, 24px);
}

.crp-pos-bottom-bar {
  bottom: var(--crp-offset-v, 0px);
  left: 0;
  right: 0;
  width: 100%;
}

.crp-pos-bottom-bar .crp-card {
  border-radius: 0;
  max-width: 100%;
  justify-content: center;
}

.crp-pos-top-bar {
  top: var(--crp-offset-v, 0px);
  left: 0;
  right: 0;
  width: 100%;
}

.crp-pos-top-bar .crp-card {
  border-radius: 0;
  max-width: 100%;
  justify-content: center;
}

.crp-mode-inline {
  position: relative;
  z-index: 10;
  margin: 16px 0;
}

/* Card Visual com Backdrop Blur e Efeito Glow */
.crp-card {
  background: var(--crp-bg, #0d1117);
  color: var(--crp-text, #ffffff);
  border-radius: var(--crp-radius, 9999px);
  box-shadow: var(--crp-shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: var(--crp-transition);
  max-width: 420px;
}

.crp-is-playing .crp-card {
  border-color: rgba(242, 125, 38, 0.4);
  box-shadow: 0 12px 36px -4px rgba(0, 0, 0, 0.8), 0 0 25px rgba(242, 125, 38, 0.2);
}

.crp-player-wrapper:hover .crp-card {
  border-color: rgba(255, 255, 255, 0.22);
}

/* Botão de Play/Pause Principal */
.crp-btn-play {
  background: var(--crp-accent, #f27d26);
  color: #000000;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(242, 125, 38, 0.4);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, filter 0.2s ease;
  outline: none;
}

.crp-btn-play:hover {
  transform: scale(1.06);
  filter: brightness(1.1);
}

.crp-btn-play:active {
  transform: scale(0.95);
}

/* Animação do Spinner ao Conectar */
.crp-icon-spinner svg {
  animation: crp-spin 1s linear infinite;
}

@keyframes crp-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Informações da Estação */
.crp-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}

.crp-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crp-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--crp-text, #ffffff);
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.crp-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.crp-subtitle {
  font-size: 11px;
  color: var(--crp-text-muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

/* Badges de Status Dinâmicos */
.crp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.crp-badge-dot-wrap {
  position: relative;
  display: inline-flex;
  width: 8px;
  height: 8px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crp-badge-dot {
  position: relative;
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
}

.crp-badge-ping {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #34d399;
  opacity: 0.75;
}

/* Estado AO VIVO (Verde esmeralda com ping pulsante) */
.crp-badge-live {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.crp-badge-live .crp-badge-ping {
  display: inline-block;
  animation: crp-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.crp-badge-live .crp-badge-dot {
  background: #10b981;
}

@keyframes crp-ping {
  75%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Estado CONECTANDO (Amarelo) */
.crp-badge-connecting {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.crp-badge-connecting .crp-badge-dot {
  background: #f59e0b;
  animation: crp-blink 0.8s ease-in-out infinite;
}

@keyframes crp-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* Estado PAUSADO (Cinza) */
.crp-badge-paused {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.crp-badge-paused .crp-badge-dot {
  background: #94a3b8;
}

/* Estado RECONECTANDO (Laranja) */
.crp-badge-reconnecting {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.crp-badge-reconnecting .crp-badge-dot {
  background: #f97316;
  animation: crp-blink 0.5s infinite;
}

/* Estado ERRO / OFF-LINE (Vermelho) */
.crp-badge-error {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.crp-badge-error .crp-badge-dot {
  background: #f43f5e;
}

/* Equalizador Visual de 4 Barras Animadas */
.crp-equalizer {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  width: 16px;
  flex-shrink: 0;
}

.crp-eq-bar {
  width: 2.5px;
  background: #34d399;
  border-radius: 9999px;
  height: 4px;
  opacity: 0.4;
  transition: all 0.3s ease;
}

.crp-eq-active .crp-eq-bar {
  opacity: 1;
}

.crp-eq-active .crp-eq-1 { animation: crp-bounce-1 0.8s ease-in-out infinite alternate; }
.crp-eq-active .crp-eq-2 { animation: crp-bounce-2 1.1s ease-in-out infinite 0.2s alternate; }
.crp-eq-active .crp-eq-3 { animation: crp-bounce-3 0.9s ease-in-out infinite 0.4s alternate; }
.crp-eq-active .crp-eq-4 { animation: crp-bounce-4 1.2s ease-in-out infinite 0.1s alternate; }

@keyframes crp-bounce-1 {
  0% { height: 4px; }
  100% { height: 12px; }
}
@keyframes crp-bounce-2 {
  0% { height: 4px; }
  100% { height: 10px; }
}
@keyframes crp-bounce-3 {
  0% { height: 4px; }
  100% { height: 12px; }
}
@keyframes crp-bounce-4 {
  0% { height: 4px; }
  100% { height: 8px; }
}

/* Controle de Volume Retrátil Inteligente (Desktop e Mobile) */
.crp-volume-box {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  position: relative;
}

.crp-btn-icon {
  background: transparent;
  border: none;
  color: var(--crp-text-muted, #94a3b8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
  transition: var(--crp-transition);
  outline: none;
  min-width: 28px;
  min-height: 28px;
}

.crp-btn-icon:hover {
  color: var(--crp-text, #ffffff);
  background: rgba(255, 255, 255, 0.1);
}

/* Barra de volume Oculta/Recolhida por padrão */
.crp-volume-slider-wrap {
  width: 0 !important;
  max-width: 0 !important;
  opacity: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  margin-left: 0 !important;
  pointer-events: none !important;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, margin-left 0.2s ease !important;
}

/* Expansão sob Hover do Mouse (:hover), Foco do Teclado (:focus-within) ou Ativação JS (.crp-volume-open) */
.crp-volume-box:hover .crp-volume-slider-wrap,
.crp-volume-box:focus-within .crp-volume-slider-wrap,
.crp-volume-box.crp-volume-open .crp-volume-slider-wrap {
  width: 68px !important;
  max-width: 68px !important;
  opacity: 1 !important;
  margin-left: 4px !important;
  pointer-events: auto !important;
}

.crp-volume-slider-wrap input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 64px;
  height: 4px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
  accent-color: var(--crp-accent, #f27d26);
  touch-action: manipulation;
}

.crp-volume-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--crp-text, #ffffff);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease;
}

.crp-volume-slider-wrap input[type="range"]::-webkit-slider-thumb:hover,
.crp-volume-slider-wrap input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.25);
}

.crp-volume-slider-wrap input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--crp-text, #ffffff);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   SKINS E PRESETS VISUAIS
   ========================================================================== */

/* Skin: Micro Pílula (Ultra-Compacto para telas pequenas/mobile) */
.crp-skin-compact-capsule .crp-card {
  padding: 4px 10px 4px 4px;
  border-radius: 9999px;
  gap: 8px;
}
.crp-skin-compact-capsule .crp-btn-play {
  width: 34px;
  height: 34px;
}
.crp-skin-compact-capsule .crp-title {
  font-size: 13px;
  font-weight: 700;
}
.crp-skin-compact-capsule .crp-subtitle {
  display: none;
}

/* Skin: Amazônia Curupira (Floresta Verde Esmeralda) */
.crp-skin-curupira-forest .crp-card {
  background: linear-gradient(135deg, #052214 0%, #03140c 100%);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 10px 30px -5px rgba(5, 34, 20, 0.8), 0 0 15px rgba(16, 185, 129, 0.15);
}
.crp-skin-curupira-forest .crp-btn-play {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Skin: Minimal Clean Light (Modo Claro / Fundo Branco) */
.crp-skin-minimal-light .crp-card {
  background: #ffffff;
  color: #0f172a;
  border-color: #e2e8f0;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}
.crp-skin-minimal-light .crp-title {
  color: #0f172a;
}
.crp-skin-minimal-light .crp-subtitle {
  color: #64748b;
}
.crp-skin-minimal-light .crp-volume-box {
  border-left-color: #e2e8f0;
}
.crp-skin-minimal-light .crp-btn-icon {
  color: #64748b;
}
.crp-skin-minimal-light .crp-btn-icon:hover {
  color: #0f172a;
  background: #f1f5f9;
}
.crp-skin-minimal-light .crp-volume-slider-wrap input[type="range"] {
  background: #e2e8f0;
}
.crp-skin-minimal-light .crp-volume-slider-wrap input[type="range"]::-webkit-slider-thumb {
  background: #0f172a;
}
.crp-skin-minimal-light .crp-badge-paused {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

/* Skin: Cyber Crimson (Sunset / Vermelho Rubro) */
.crp-skin-curupira-crimson .crp-card {
  background: linear-gradient(135deg, #1c090e 0%, #0d0407 100%);
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow: 0 10px 30px -5px rgba(28, 9, 14, 0.8), 0 0 15px rgba(244, 63, 94, 0.18);
}
.crp-skin-curupira-crimson .crp-btn-play {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}

/* Skin: Floating Glass Card (Card Arredondado 16px) */
.crp-skin-glass-card .crp-card {
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
}

/* Modo Minimizado */
.crp-collapsed .crp-info,
.crp-collapsed .crp-volume-box {
  display: none !important;
}

.crp-collapsed .crp-card {
  padding: 4px;
  border-radius: 50px;
  gap: 4px;
}

/* Responsividade Mobile - Volume e Equalizador Inteligentes */
@media (max-width: 600px) {
  .crp-pos-bottom-left,
  .crp-pos-bottom-right {
    bottom: var(--crp-offset-v, 16px);
    left: var(--crp-offset-h, 16px);
    right: var(--crp-offset-h, 16px);
    max-width: calc(100% - 32px);
  }

  .crp-card {
    max-width: 100%;
    width: 100%;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    justify-content: space-between;
  }

  .crp-info {
    min-width: 0;
    flex: 1;
  }

  .crp-title {
    font-size: 13px;
  }

  .crp-subtitle {
    max-width: 110px;
    font-size: 10px;
  }

  .crp-volume-box {
    display: flex !important;
    padding-left: 4px;
    gap: 2px;
  }

  .crp-volume-box:hover .crp-volume-slider-wrap,
  .crp-volume-box:focus-within .crp-volume-slider-wrap,
  .crp-volume-box.crp-volume-open .crp-volume-slider-wrap {
    width: 54px !important;
    max-width: 54px !important;
  }

  .crp-volume-slider-wrap input[type="range"] {
    width: 50px;
    height: 5px;
  }

  .crp-volume-slider-wrap input[type="range"]::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
  }
}
