/*
 * PostTTS Pro WPX — Estilos do Player Front-end
 *
 * CSS puro, sem dependências externas.
 * TODAS as cores usam `currentColor`, `inherit` ou variáveis CSS genéricas
 * para herdar a paleta do tema WordPress ativo.
 * Apenas opacidades e transições neutras são valores fixos.
 *
 * Modelos:
 *   .posttts-player--model1  Minimalista
 *   .posttts-player--model2  Card Flutuante
 *   .posttts-player--model3  Inline
 */

/* ============================================================
   Variáveis CSS genéricas
   Estas variáveis herdam do tema; podem ser sobrescritas
   pelo tema ou pelo usuário sem tocar no plugin.
   ============================================================ */
:root {
    --posttts-accent:       currentColor;
    --posttts-bg:           transparent;
    --posttts-border-color: currentColor;
    --posttts-radius:       6px;
    --posttts-transition:   0.2s ease;
    --posttts-track-height: 4px;
    --posttts-thumb-size:   12px;
}

/* ============================================================
   Elemento <audio> oculto (controle nativo ocultado)
   ============================================================ */
#posttts-audio-el {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

/* ============================================================
   Base compartilhada por todos os modelos
   ============================================================ */
.posttts-player {
    box-sizing: border-box;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.4;
    color: inherit;
    margin-bottom: 1.5em;
}

/* Botão Play/Pause — base */
.posttts-player__play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 2px solid currentColor;
    border-radius: 50%;
    cursor: pointer;
    color: inherit;
    padding: 0;
    flex-shrink: 0;
    transition:
        background-color var(--posttts-transition),
        color var(--posttts-transition),
        opacity var(--posttts-transition);
}

.posttts-player__play-btn:hover,
.posttts-player__play-btn:focus {
    background-color: currentColor;
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Inverte cor do SVG quando hover preenche o botão */
.posttts-player__play-btn:hover svg,
.posttts-player__play-btn:focus svg {
    fill: #fff;
    mix-blend-mode: difference;
}

.posttts-player__play-btn:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

/* Ícones SVG dentro do botão */
.posttts-player__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Barra de progresso — base */
.posttts-player__progress-wrap {
    flex: 1;
    cursor: pointer;
    padding: 8px 0; /* Aumenta área clicável verticalmente */
    position: relative;
    min-width: 60px;
}

.posttts-player__progress-track {
    position: relative;
    height: var(--posttts-track-height);
    background-color: currentColor;
    opacity: 0.15;
    border-radius: calc(var(--posttts-track-height) / 2);
    overflow: visible;
}

.posttts-player__progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background-color: currentColor;
    opacity: 1;
    border-radius: inherit;
    transition: width 0.1s linear;
    pointer-events: none;
}

.posttts-player__progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: var(--posttts-thumb-size);
    height: var(--posttts-thumb-size);
    border-radius: 50%;
    background-color: currentColor;
    opacity: 0;
    transition:
        left 0.1s linear,
        opacity var(--posttts-transition);
    pointer-events: none;
}

.posttts-player__progress-wrap:hover .posttts-player__progress-thumb,
.posttts-player--playing .posttts-player__progress-thumb {
    opacity: 1;
}

/* Texto de tempo */
.posttts-player__time {
    font-size: 0.75em;
    opacity: 0.7;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

/* Botão de velocidade */
.posttts-player__speed-btn {
    background: none;
    border: 1px solid currentColor;
    border-radius: 3px;
    color: inherit;
    cursor: pointer;
    font-size: 0.72em;
    font-weight: 600;
    line-height: 1;
    padding: 3px 6px;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0.75;
    transition: opacity var(--posttts-transition);
}

.posttts-player__speed-btn:hover,
.posttts-player__speed-btn:focus {
    opacity: 1;
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

/* ============================================================
   Modelo 1 — Minimalista
   Barra compacta horizontal, borda fina em volta
   ============================================================ */
.posttts-player--model1 {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid currentColor;
    border-radius: var(--posttts-radius);
    opacity: 0.9;
}

.posttts-player--model1:hover {
    opacity: 1;
}

.posttts-player--model1 .posttts-player__play-btn {
    width: 36px;
    height: 36px;
}

.posttts-player--model1 .posttts-player__meta {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.posttts-player--model1 .posttts-player__label {
    font-size: 0.78em;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0.8;
    flex-shrink: 0;
}

.posttts-player--model1 .posttts-player__speed-wrap {
    flex-shrink: 0;
}

/* ============================================================
   Modelo 2 — Card Flutuante
   Painel com cabeçalho decorativo e controles completos
   ============================================================ */
.posttts-player--model2 {
    border: 1px solid currentColor;
    border-radius: calc(var(--posttts-radius) * 1.5);
    overflow: hidden;
    opacity: 0.9;
}

.posttts-player--model2:hover {
    opacity: 1;
}

.posttts-player--model2 .posttts-player__wave {
    display: block;
    width: 100%;
    height: 32px;
    opacity: 0.3;
    overflow: hidden;
}

.posttts-player--model2 .posttts-player__wave svg {
    width: 100%;
    height: 100%;
    display: block;
    color: inherit;
}

.posttts-player--model2 .posttts-player__body {
    padding: 8px 14px 12px;
}

.posttts-player--model2 .posttts-player__header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
}

.posttts-player--model2 .posttts-player__icon-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    flex-shrink: 0;
}

.posttts-player--model2 .posttts-player__post-title {
    font-size: 0.82em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.85;
    flex-shrink: 1; /* Permite diminuir sem sumir */
    min-width: 50px;
}

.posttts-player--model2 .posttts-player__controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.posttts-player--model2 .posttts-player__play-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

/* ============================================================
   Modelo 3 — Inline
   Uma linha compacta integrada ao texto do artigo
   ============================================================ */
.posttts-player--model3 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 99px; /* Pill shape */
    border: 1px solid currentColor;
    font-size: 0.85em;
    opacity: 0.85;
    max-width: 100%;
    margin-bottom: 1em;
}

.posttts-player--model3:hover {
    opacity: 1;
}

.posttts-player--model3 .posttts-player__play-btn {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.posttts-player--model3 .posttts-player__inline-label {
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0.75;
    flex-shrink: 0;
}

.posttts-player--model3 .posttts-player__progress-wrap {
    min-width: 80px;
    max-width: 200px;
}

/* ============================================================
   Responsividade — telas muito pequenas
   ============================================================ */
@media screen and ( max-width: 480px ) {

    .posttts-player--model1 .posttts-player__label {
        display: none; /* Remove rótulo para ganhar espaço */
    }

    .posttts-player--model3 .posttts-player__inline-label {
        display: none;
    }
    
    .posttts-player__volume-slider-container {
        display: none; /* Oculta slider no mobile para poupar espaço */
    }
}

/* ============================================================
   Controles de Volume
   ============================================================ */
.posttts-player__volume-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.posttts-player__volume-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 2px;
    opacity: 0.75;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--posttts-transition);
}

.posttts-player__volume-btn:hover,
.posttts-player__volume-btn:focus {
    opacity: 1;
    outline: none;
}

.posttts-player__volume-slider-container {
    display: flex;
    align-items: center;
    width: 60px; /* Largura do slider */
}

.posttts-player__volume-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: currentColor;
    opacity: 0.3;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: opacity var(--posttts-transition);
}

.posttts-player__volume-slider:hover,
.posttts-player__volume-slider:focus {
    opacity: 0.6;
}

.posttts-player__volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    cursor: pointer;
}

.posttts-player__volume-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    cursor: pointer;
    border: none;
}
