/*
 * File: community/assets/voice-replies.css
 * Brief 16 — voice reply recorder + player chrome
 *
 * Uses cf-* prefix to slot inside the existing community/forum.php styles.
 * Falls back to neutral colors if msd CSS vars aren't on the page (the
 * forum lives inside the same wrapper that loads mobile-style/msd-mobile-style.php,
 * but the recorder may render before that style file's :root tokens cascade).
 */

/* ── Composer mic button ─────────────────────────────────────────────────── */
.cf-voice-mic {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--msd-bg-3, #141414);
    color: var(--msd-text, #efefef);
    border: 1px solid var(--msd-border-2, #242424);
    border-radius: 8px;
    padding: 8px 14px;
    font-family: var(--msd-font-cond, 'Barlow Condensed', sans-serif);
    font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    font-size: 13px;
    cursor: pointer;
    margin-left: 8px;
    transition: background var(--msd-transition-fast, 0.15s ease);
}
.cf-voice-mic:hover:not(:disabled) {
    background: var(--msd-gold-dim, rgba(201, 168, 76, 0.13));
    color: var(--msd-gold, #C9A84C);
}
.cf-voice-mic:disabled { cursor: not-allowed; }

/* ── Recorder pane ──────────────────────────────────────────────────────── */
.cf-voice-recorder {
    margin-top: 12px;
    padding: 14px 16px;
    background: var(--msd-bg-2, #0d0d0d);
    border: 1px solid var(--msd-border-2, #242424);
    border-radius: 10px;
}
.cf-voice-rec-row {
    display: flex; align-items: center;
    gap: 12px; flex-wrap: wrap;
}
.cf-voice-rec-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--msd-red, #ff5252);
    animation: cf-voice-pulse 1.2s ease-in-out infinite;
}
@keyframes cf-voice-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.3); }
}
.cf-voice-rec-time {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 13px;
    color: var(--msd-text, #efefef);
    min-width: 90px;
}
.cf-voice-rec-meter {
    flex: 1;
    height: 6px;
    background: var(--msd-bg-4, #1c1c1c);
    border-radius: 999px;
    overflow: hidden;
    min-width: 160px;
}
.cf-voice-rec-bar {
    height: 100%; width: 0%;
    background: linear-gradient(to right,
        var(--msd-green, #3ecf8e),
        var(--msd-amber, #f5a842),
        var(--msd-red, #ff5252));
    transition: width 0.2s linear;
}
.cf-voice-recorder button {
    background: var(--msd-bg-4, #1c1c1c);
    color: var(--msd-text, #efefef);
    border: 1px solid var(--msd-border-2, #242424);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    font-family: var(--msd-font-cond, 'Barlow Condensed', sans-serif);
    font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer;
}
.cf-voice-recorder button:hover { background: var(--msd-bg-5, #242424); }
.cf-voice-rec-send {
    background: var(--msd-gold, #C9A84C) !important;
    color: #000 !important;
    border-color: var(--msd-gold, #C9A84C) !important;
}
.cf-voice-rec-cancel { color: var(--msd-text-2, #7a7a7a) !important; }

.cf-voice-rec-preview audio {
    height: 36px; max-width: 280px; flex: 1;
}
.cf-voice-rec-msg {
    margin-top: 8px; font-size: 12px;
    min-height: 16px;
}
.cf-voice-rec-msg.is-ok  { color: var(--msd-green, #3ecf8e); }
.cf-voice-rec-msg.is-err { color: var(--msd-red,   #ff5252); }

/* ── Inline voice player (rendered into reply cards) ────────────────────── */
.cf-voice {
    margin-top: 10px;
    padding: 12px 14px;
    background: var(--msd-bg-3, #141414);
    border: 1px solid var(--msd-border-2, #242424);
    border-radius: 10px;
}
.cf-voice-label {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 11px;
    color: var(--msd-text-2, #7a7a7a);
    margin-bottom: 8px;
}
.cf-voice-player {
    display: flex; align-items: center;
    gap: 10px; flex-wrap: wrap;
}
.cf-voice-play {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--msd-gold, #C9A84C);
    color: #000;
    border: none;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
}
.cf-voice-progress {
    flex: 1;
    height: 4px;
    background: var(--msd-bg-4, #1c1c1c);
    border-radius: 999px;
    overflow: hidden;
    min-width: 100px;
}
.cf-voice-progress-bar {
    height: 100%; width: 0%;
    background: var(--msd-gold, #C9A84C);
    transition: width 0.1s linear;
}
.cf-voice-time {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 12px;
    color: var(--msd-text, #efefef);
    min-width: 80px;
    text-align: right;
}
.cf-voice-speed {
    display: flex; gap: 4px;
    flex-basis: 100%;
    justify-content: flex-end;
    margin-top: 4px;
}
.cf-voice-speed button {
    background: transparent;
    color: var(--msd-text-2, #7a7a7a);
    border: 1px solid var(--msd-border-2, #242424);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 10px;
    font-family: ui-monospace, Menlo, monospace;
    cursor: pointer;
}
.cf-voice-speed button:hover { color: var(--msd-text, #efefef); }
.cf-voice-speed button.is-active {
    background: var(--msd-gold-dim, rgba(201, 168, 76, 0.13));
    color: var(--msd-gold, #C9A84C);
    border-color: var(--msd-gold, #C9A84C);
}

.cf-voice-transcript-toggle {
    margin-top: 10px;
    background: transparent;
    color: var(--msd-text-2, #7a7a7a);
    border: none;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.cf-voice-transcript-toggle:hover { color: var(--msd-gold, #C9A84C); }

.cf-voice-transcript {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--msd-bg-2, #0d0d0d);
    border-left: 2px solid var(--msd-gold, #C9A84C);
    border-radius: 4px;
    font-size: 12px;
    color: var(--msd-text, #efefef);
    line-height: 1.5;
}

/* ── Audio element used inside the player wraps is hidden — we use
       our own controls + bind to it via JS. */
.cf-voice-player audio { display: none; }

/* Mobile tweaks */
@media (max-width: 600px) {
    .cf-voice-rec-meter { min-width: 100px; }
    .cf-voice-rec-preview audio { max-width: 100%; }
    .cf-voice-speed { flex-basis: auto; margin-top: 0; }
    .cf-voice-speed button { padding: 2px 6px; font-size: 9px; }
}
