/* WP Content Reader – Frontend Styles v3.0 */

/* ── Bar container ────────────────────────────── */

.wpcr-reader-bar {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 16px 20px 14px;
    margin: 20px auto;
    max-width: 720px;
    width: 100%;
    background: var(--wpcr-bg, #ffffff);
    border: 1px solid var(--wpcr-border, #e0e0e0);
    border-radius: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.07);
    box-sizing: border-box;
}

.wpcr-reader-bar * {
    box-sizing: border-box;
}

/* ── RTL ──────────────────────────────────────── */

.wpcr-rtl {
    direction: rtl;
}

/* ── Floating ─────────────────────────────────── */

.wpcr-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: auto;
    z-index: 9999;
    max-width: 540px;
    margin: 0;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.16);
    border-radius: 14px;
}

.wpcr-rtl.wpcr-floating {
    right: auto;
    left: 20px;
}

/* ── Generic row ──────────────────────────────── */

.wpcr-row {
    display: flex;
    align-items: center;
    width: 100%;
}

/* ── Row 1: Play | CTA | Actions ─────────────── */

.wpcr-row-top {
    gap: 14px;
    padding-bottom: 12px;
}

/* Play column */
.wpcr-col-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Play/Pause toggle */
.wpcr-play-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--wpcr-btn, #222) !important;
    background: transparent !important;
    color: var(--wpcr-btn, #222) !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease, color 0.15s ease;
    padding: 0;
    flex-shrink: 0;
    box-shadow: none !important;
    text-decoration: none !important;
}

.wpcr-play-toggle:hover {
    background: var(--wpcr-hover-bg, rgba(0, 0, 0, 0.05)) !important;
    color: var(--wpcr-hover-icon, var(--wpcr-btn, #222)) !important;
    transform: scale(1.05);
}

.wpcr-play-toggle:active {
    transform: scale(0.94);
}

.wpcr-play-toggle:focus-visible {
    outline: 2px solid var(--wpcr-btn, #222);
    outline-offset: 3px;
}

.wpcr-icon-play,
.wpcr-icon-pause {
    display: block;
    pointer-events: none;
}


/* CTA column (center) */
.wpcr-col-cta {
    flex: 1;
    min-width: 0;
    text-align: center;
    padding: 0 4px;
}

.wpcr-cta-text {
    font-size: 14px;
    color: var(--wpcr-text, #555);
    cursor: pointer;
    transition: color 0.15s ease;
    display: inline;
    line-height: 1.5;
}

.wpcr-cta-text:hover {
    color: var(--wpcr-hover-icon, #000);
    text-decoration: underline;
}

/* Actions column (right) */
.wpcr-col-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.wpcr-action-btn {
    background: transparent !important;
    border: none !important;
    padding: 5px;
    cursor: pointer;
    color: var(--wpcr-btn, #555) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
    box-shadow: none !important;
    text-decoration: none !important;
}

.wpcr-action-btn:hover {
    color: var(--wpcr-hover-icon, var(--wpcr-text, #111)) !important;
    background: var(--wpcr-hover-bg, rgba(0, 0, 0, 0.05)) !important;
}

.wpcr-action-btn:disabled {
    opacity: 0.28;
    cursor: default;
    pointer-events: none;
}

.wpcr-action-btn:focus-visible {
    outline: 2px solid #222;
    outline-offset: 2px;
}

/* Speed button */
.wpcr-speed-btn {
    background: transparent !important;
    border: none !important;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: var(--wpcr-btn, #555) !important;
    border-radius: 5px;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
    min-width: 38px;
    text-align: center;
    font-family: inherit;
    box-shadow: none !important;
    text-decoration: none !important;
}

.wpcr-speed-btn:hover {
    color: var(--wpcr-hover-icon, #111) !important;
    background: var(--wpcr-hover-bg, rgba(0, 0, 0, 0.05)) !important;
}

/* ── Row 2: Progress bar ──────────────────────── */

.wpcr-row-progress {
    gap: 10px;
    padding-top: 0;
}

.wpcr-progress-bar {
    flex: 1;
    height: 3px;
    background: #e5e5e5;
    border-radius: 99px;
    overflow: hidden;
    cursor: pointer;
}

.wpcr-progress-fill {
    height: 100%;
    width: 0;
    background: var(--wpcr-btn, #444);
    border-radius: 99px;
    transition: width 0.35s ease;
}

.wpcr-time {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 34px;
    font-variant-numeric: tabular-nums;
}

.wpcr-time-current { text-align: end; }
.wpcr-time-total   { text-align: start; }

/* ── Row 3: Voice + volume ────────────────────── */

.wpcr-row-extras {
    flex-wrap: wrap;
    gap: 10px 16px;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid var(--wpcr-border, #f0f0f0);
    justify-content: flex-end;
}

.wpcr-label {
    font-size: 10px;
    font-weight: 700;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.wpcr-voice-wrap,
.wpcr-volume-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wpcr-select {
    height: 26px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fafafa;
    color: #333;
    padding: 0 8px;
    max-width: 180px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.wpcr-select:focus {
    border-color: #555;
    outline: none;
}

.wpcr-volume-wrap svg {
    color: #aaa;
    flex-shrink: 0;
}

.wpcr-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 72px;
    height: 3px;
    background: #e5e5e5;
    border-radius: 99px;
    outline: none;
    cursor: pointer;
}

.wpcr-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #444;
    cursor: pointer;
    border: none;
    transition: transform 0.15s;
}

.wpcr-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

.wpcr-volume-slider::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #444;
    cursor: pointer;
    border: none;
}

/* ── Attribution (inline in extras row) ───────── */

.wpcr-attribution {
    flex: 1;
    text-align: center;
    font-size: 9px;
    color: #bbb;
    line-height: 1.4;
    white-space: nowrap;
}

.wpcr-attribution a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}

.wpcr-attribution a:hover {
    color: #555;
    text-decoration: underline;
}

/* ── Sentence highlighting ────────────────────── */

.wpcr-sentence-active {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    outline: 1px solid rgba(0, 0, 0, 0.1);
    outline-offset: 2px;
    transition: background-color 0.25s ease;
}

/* ── Responsive ───────────────────────────────── */

@media (max-width: 560px) {
    .wpcr-reader-bar {
        padding: 14px 14px 12px;
        margin: 14px auto;
    }

    .wpcr-row-top {
        gap: 10px;
    }

    .wpcr-play-toggle {
        width: 42px;
        height: 42px;
    }

    .wpcr-cta-text {
        font-size: 12px;
    }

    .wpcr-col-actions {
        gap: 2px;
    }

    .wpcr-floating {
        right: 10px;
        left: 10px;
        bottom: 10px;
        max-width: none;
    }

    .wpcr-rtl.wpcr-floating {
        right: 10px;
        left: 10px;
    }
}

@media (max-width: 420px) {
    .wpcr-row-top {
        flex-wrap: wrap;
        gap: 8px;
    }

    .wpcr-col-play {
        flex-direction: row;
        gap: 8px;
    }

    .wpcr-col-cta {
        order: -1;
        flex-basis: 100%;
        text-align: center;
    }

    .wpcr-col-actions {
        margin-inline-start: auto;
    }
}
