/* =============================================
   Accessibility TTS — Reproductor de Audio
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap');

:root {
    --atts-bg:        #0f0f13;
    --atts-surface:   #1a1a24;
    --atts-border:    rgba(255,255,255,0.07);
    --atts-accent:    #c084fc;
    --atts-accent2:   #818cf8;
    --atts-text:      #f1f5f9;
    --atts-muted:     #94a3b8;
    --atts-radius:    16px;
    --atts-font:      'DM Sans', system-ui, sans-serif;
}

.atts-audio-player {
    font-family: var(--atts-font);
    background: var(--atts-bg);
    border: 1px solid var(--atts-border);
    border-radius: var(--atts-radius);
    padding: 20px 22px 18px;
    margin: 0 0 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 32px rgba(0,0,0,0.4);
}

/* Glow de fondo */
.atts-audio-player::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 20% 0%, rgba(192,132,252,0.12) 0%, transparent 70%),
                radial-gradient(ellipse 40% 40% at 80% 100%, rgba(129,140,248,0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* --- Header --- */
.atts-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.atts-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--atts-muted);
}

/* Onda animada */
.atts-icon-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 18px;
}

.atts-icon-wave span {
    display: block;
    width: 3px;
    border-radius: 2px;
    background: var(--atts-accent);
    animation: atts-wave 1.2s ease-in-out infinite;
    height: 6px;
}

.atts-icon-wave span:nth-child(1) { animation-delay: 0s;    height: 8px; }
.atts-icon-wave span:nth-child(2) { animation-delay: 0.15s; height: 14px; }
.atts-icon-wave span:nth-child(3) { animation-delay: 0.3s;  height: 18px; }
.atts-icon-wave span:nth-child(4) { animation-delay: 0.15s; height: 14px; }
.atts-icon-wave span:nth-child(5) { animation-delay: 0s;    height: 8px; }

.atts-audio-player:not(.atts-is-playing) .atts-icon-wave span {
    animation-play-state: paused;
}

@keyframes atts-wave {
    0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
    50%       { transform: scaleY(1);   opacity: 1;   }
}

/* --- Alerta sin soporte --- */
.atts-unsupported {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.875rem;
    margin-bottom: 12px;
}

/* --- Progreso --- */
.atts-progress-wrap {
    margin-bottom: 16px;
}

.atts-progress-track {
    position: relative;
    height: 5px;
    background: rgba(255,255,255,0.1);
    border-radius: 99px;
    cursor: pointer;
    margin-bottom: 6px;
    transition: height 0.15s;
}

.atts-progress-track:hover {
    height: 7px;
}

.atts-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--atts-accent2), var(--atts-accent));
    border-radius: 99px;
    transition: width 0.25s linear;
    position: relative;
}

.atts-progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 13px;
    height: 13px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(192,132,252,0.4);
    opacity: 0;
    transition: opacity 0.15s, left 0.25s linear;
    pointer-events: none;
}

.atts-progress-track:hover .atts-progress-thumb {
    opacity: 1;
}

.atts-times {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--atts-muted);
    font-variant-numeric: tabular-nums;
    padding: 0 1px;
}

/* --- Controles --- */
.atts-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
}

.atts-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--atts-border);
    border-radius: 50%;
    color: var(--atts-text);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    padding: 0;
    flex-shrink: 0;
}

.atts-btn:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.06);
}

.atts-btn:active {
    transform: scale(0.95);
}

.atts-btn:focus-visible {
    outline: 2px solid var(--atts-accent);
    outline-offset: 3px;
}

/* Botón play — más grande */
.atts-btn-play {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--atts-accent), var(--atts-accent2));
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(192,132,252,0.35);
}

.atts-btn-play:hover {
    background: linear-gradient(135deg, #d8b4fe, var(--atts-accent));
    box-shadow: 0 6px 24px rgba(192,132,252,0.5);
}

.atts-btn-play svg {
    width: 20px;
    height: 20px;
}

/* Botones secundarios */
.atts-btn-rewind,
.atts-btn-forward {
    width: 40px;
    height: 40px;
}

.atts-btn-rewind svg,
.atts-btn-forward svg {
    width: 16px;
    height: 16px;
}

.atts-btn-restart,
.atts-btn-stop {
    width: 34px;
    height: 34px;
}

.atts-btn-restart svg,
.atts-btn-stop svg {
    width: 14px;
    height: 14px;
}

/* Badge "+10 / -10" */
.atts-btn-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    font-size: 0.55rem;
    font-weight: 700;
    background: var(--atts-accent);
    color: #fff;
    border-radius: 99px;
    padding: 1px 4px;
    letter-spacing: 0;
    line-height: 1.4;
    pointer-events: none;
}

/* --- Velocidad --- */
.atts-speed-row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.atts-speed-label {
    font-size: 0.72rem;
    color: var(--atts-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.atts-speed-pills {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.atts-speed-pill {
    font-family: var(--atts-font);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 99px;
    border: 1px solid var(--atts-border);
    background: transparent;
    color: var(--atts-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.atts-speed-pill:hover {
    background: rgba(255,255,255,0.07);
    color: var(--atts-text);
}

.atts-speed-pill.active {
    background: rgba(192,132,252,0.18);
    border-color: rgba(192,132,252,0.4);
    color: var(--atts-accent);
}

.atts-speed-pill:focus-visible {
    outline: 2px solid var(--atts-accent);
    outline-offset: 2px;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .atts-audio-player {
        padding: 16px 14px 14px;
    }

    .atts-btn-play {
        width: 46px;
        height: 46px;
    }

    .atts-speed-pills {
        gap: 4px;
    }

    .atts-speed-pill {
        font-size: 0.68rem;
        padding: 2px 7px;
    }
}
