/* Reproductor de Audio Moderno */
.simple-audio-player-custom {
    max-width: 100%;
    margin: 20px auto;
    padding: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    overflow: hidden;
}
.sap--audioyoo .ay-player { position: relative; overflow: hidden; }
.sap--audioyoo .ay-player::before{
    content: "";
    position: absolute; inset: -28px; z-index: 0;
    background-image: var(--ay-cover);
    background-size: cover; background-position: center;
    filter: blur(48px) brightness(.65) saturate(1.1);
    transform: scale(1.12);
}
.sap--audioyoo .ay-player > * { position: relative; z-index: 1; }

/* Efecto de cristal */
.simple-audio-player-custom::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    z-index: 1;
}

.simple-audio-player-custom > * {
    position: relative;
    z-index: 2;
}

.simple-audio-player-custom .audio-title {
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 1.4em;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

/* Description text under title */
.simple-audio-player-custom .audio-desc {
    margin: -8px auto 16px auto;
    max-width: 880px;
    font-size: 0.95em;
    text-align: center;
    line-height: 1.5;
    opacity: 0.95;
}

.simple-audio-player-custom .native-audio {
    width: 100%;
    margin: 15px 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ===== Custom controls (AudioYoo) ===== */
.ay-player {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
}

.ay-cover {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    flex: 0 0 64px;
    box-shadow: 0 6px 20px rgba(0,0,0,.15);
    border: 1px solid rgba(255,255,255,.25);
}
.ay-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ay-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    transition: transform .2s ease, box-shadow .2s ease;
}

.ay-btn:hover { transform: scale(1.04); box-shadow: 0 8px 24px rgba(0,0,0,.16); }

.ay-progress { position: relative; flex: 1; height: 8px; background: rgba(255,255,255,.35); border-radius: 6px; cursor: pointer; overflow: hidden; }
.ay-progress-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: rgba(255,255,255,.95); border-radius: 6px; transition: width .1s linear; }
/* Knob base: oculto por defecto; se activa/estiliza en AudioYoo */
.ay-progress-knob { display: none; position: absolute; top: 50%; left: 0%; transform: translate(-50%, -50%); width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.35); pointer-events: none; z-index: 2; }

.ay-time { display: flex; align-items: center; gap: 6px; color: rgba(255,255,255,.95); font-weight: 600; font-size: .9em; }
.ay-sep { opacity: .75; }

.ay-volume { display: flex; align-items: center; gap: 8px; }
.ay-volume-slider { width: 90px; accent-color: #667eea; }

/* Visual state when playing */
.ay-player.is-playing .ay-btn {
    box-shadow: 0 0 0 3px rgba(255,255,255,.55), 0 8px 24px rgba(0,0,0,.18);
}
.ay-player.is-playing .ay-progress-fill {
    background: #fff;
}

/* ===== Variantes de estilo ===== */
/* AudioYoo (moderno) ya coincide con los estilos por defecto */
.sap--audioyoo .ay-volume-slider { accent-color: #667eea; }

/* ===== Variant: AudioYoo (modern, adaptive) ===== */
.sap--audioyoo {
    /* adaptive background via JS-set CSS vars */
    --ay-bg: linear-gradient(135deg, #3a1f16 0%, #2a120b 100%);
    --ay-bg-soft: rgba(255,255,255,0.12);
    --ay-text: #fff;
    --ay-subtext: rgba(255,255,255,.85);
    --ay-accent: #e74c3c; /* play icon color */
    background: var(--ay-bg);
    padding: 24px 24px 20px;
    border-radius: 18px;
    box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.sap--audioyoo .audio-title { color: var(--ay-text); text-shadow: 0 1px 2px rgba(0,0,0,.18); font-size: 1.9em; line-height: 1.15; font-weight: 700; margin: 0 0 6px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sap--audioyoo .audio-desc { color: var(--ay-subtext); text-shadow: 0 1px 2px rgba(0,0,0,.15); font-size: 1.05em; line-height: 1.35; margin: 0 0 10px; text-align: left; opacity: .85; max-width: 48ch; display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.sap--audioyoo .ay-btn { background: #fff; color: var(--ay-accent); width: 52px; height: 52px; border-radius: 50%; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.sap--audioyoo .ay-btn .material-icons { color: var(--ay-accent); font-size: 28px; }
.sap--audioyoo .ay-progress { background: rgba(255,255,255,.25); height: 4px; overflow: visible; }
.sap--audioyoo .ay-progress-fill { background: rgba(255,255,255,.92); }
.sap--audioyoo .ay-time { color: rgba(255,255,255,.92); }
/* Knob visible y con acento para AudioYoo */
.sap--audioyoo .ay-progress-knob { display: block; pointer-events: auto; background: #fff; border: 2px solid var(--ay-accent); width: 20px; height: 20px; cursor: grab; }
.sap--audioyoo .ay-player.is-scrubbing { user-select: none; }
.sap--audioyoo .ay-player.is-scrubbing .ay-progress-knob { cursor: grabbing; }

/* Layout similar a la referencia: cover izquierda, info/controles derecha */
.sap--audioyoo .ay-player {
  display: grid !important;
  grid-template-columns: 200px 1fr;
  grid-template-rows: auto auto 1fr auto auto;
  grid-template-areas:
    "cover title"
    "cover desc"
    "cover time"
    "cover progress"
    "cover play";
  column-gap: 20px; row-gap: 6px; align-items: center;
  height: 200px; /* La carátula marca la altura del player */
  overflow: hidden;
}
.sap--audioyoo .audio-title { grid-area: title; }
.sap--audioyoo .audio-desc { grid-area: desc; }
.sap--audioyoo .ay-cover { width: 200px; height: 200px; border-radius: 14px; box-shadow: none; border: none; grid-area: cover; }
.sap--audioyoo .ay-time { grid-area: time; display: flex; justify-content: space-between; font-weight: 500; opacity: .9; }
.sap--audioyoo .ay-sep { display: none; }
.sap--audioyoo .ay-progress { grid-area: progress; }
.sap--audioyoo .ay-btn { grid-area: play; justify-self: center; margin-top: 6px; }
.sap--audioyoo .ay-volume { display: none; }

/* Responsive: ajustar tamaño de carátula y grid en móviles */
@media (max-width: 700px) {
  .sap--audioyoo .ay-player {
    grid-template-columns: 140px 1fr;
    grid-template-rows: auto auto 1fr auto auto;
    grid-template-areas:
      "cover title"
      "cover desc"
      "cover time"
      "cover progress"
      "cover play";
    column-gap: 16px; row-gap: 6px;
    height: 140px;
  }
  .sap--audioyoo .ay-cover { width: 140px; height: 140px; }
  .sap--audioyoo .audio-title { font-size: 1.6em; line-height: 1.2; }
  .sap--audioyoo .ay-btn { grid-column: 1 / -1; justify-self: center; }
}
@media (max-width: 460px) {
  .sap--audioyoo .ay-player {
    grid-template-columns: 110px 1fr;
    grid-template-rows: auto auto 1fr auto auto;
    grid-template-areas:
      "cover title"
      "cover desc"
      "cover time"
      "cover progress"
      "cover play";
    height: 110px;
  }
  .sap--audioyoo .ay-cover { width: 110px; height: 110px; }
  .sap--audioyoo .audio-title { font-size: 1.4em; line-height: 1.2; }
}

/* ===== Variant: SimpleYoo (minimal) ===== */
.sap--simpleyoo {
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    border: 1px solid #e6e9ef;
    padding: 16px;
    border-radius: 12px;
}
.sap--simpleyoo::before { display: none; }
.sap--simpleyoo .audio-title { color: #222; text-shadow: none; margin-bottom: 10px; }
.sap--simpleyoo .audio-desc { color: #444; text-shadow: none; margin-bottom: 14px; }

/* Layout square cover */
.sap--simpleyoo .ay-player { position: relative; display: block; padding: 0; width: 100%; max-width: min(100%, var(--ay-cover-w, 480px)); margin: 0 auto; }
.sap--simpleyoo .ay-cover { width: 100%; height: auto; border-radius: 12px; overflow: hidden; flex: none; box-shadow: none; border: none; aspect-ratio: 1 / 1; }
.sap--simpleyoo .ay-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sap--simpleyoo .ay-cover.no-image { background: #eef1f5; }

/* Centered play button over cover */
.sap--simpleyoo .ay-btn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 72px; height: 72px; background: rgba(0,0,0,.6); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.sap--simpleyoo .ay-btn .material-icons { color: #fff; }
.sap--simpleyoo .ay-btn:hover { transform: translate(-50%, -50%) scale(1.04); }
.sap--simpleyoo .ay-icon-play { border-color: transparent transparent transparent currentColor; }

/* Hide all other controls */
.sap--simpleyoo .ay-progress,
.sap--simpleyoo .ay-time,
.sap--simpleyoo .ay-volume { display: none !important; }

/* Playing state glow */
.sap--simpleyoo .ay-player.is-playing .ay-btn { box-shadow: 0 0 0 6px rgba(255,255,255,.25), 0 8px 24px rgba(0,0,0,.35); }

.sap--simpleyoo:hover { box-shadow: 0 10px 24px rgba(0,0,0,.10); }

/* ===== Material Icons adjustments ===== */
/* Neutralize old triangle/bars shapes and size Material icons nicely */
.ay-btn .material-icons { font-size: 28px; line-height: 1; text-shadow: 0 0 2px rgba(0,0,0,.25); display: inline-block; }
.ay-icon { border: 0; width: auto; height: auto; display: inline-flex; align-items: center; justify-content: center; }
.ay-icon-pause::before, .ay-icon-pause::after { content: none; }

.audio-error {
    background: rgba(231, 76, 60, 0.15);
    color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(231, 76, 60, 0.3);
    backdrop-filter: blur(10px);
    font-weight: 500;
}

/* Animación sutil */
.simple-audio-player-custom {
    animation: fadeInUp 0.6s ease-out;
}

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

/* Responsive */
@media (max-width: 768px) {
    .simple-audio-player-custom {
        margin: 15px auto;
        padding: 20px;
        border-radius: 12px;
    }
    
    .simple-audio-player-custom .audio-title {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
}

/* Hover effect */
.simple-audio-player-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}
/* Hover más sutil para SimpleYoo */
.sap--simpleyoo:hover { box-shadow: 0 10px 24px rgba(0,0,0,.10); }
