/**
 * Reformistas Features — diferenciadores front-end
 *
 *  • Bottom nav mobile (sticky bottom, 4 ícones)
 *  • Dark mode (tokens via [data-theme="dark"])
 *  • Player áudio flutuante persistente
 *  • Botão "Compartilhar trecho como imagem"
 *
 * Mobile-first, sem framework. Tokens compatíveis com paletas .depto-{slug}.
 */

/* =========================================================
   1. DARK MODE TOKENS
   ========================================================= */
:root {
    --rf-bg:        #ffffff;
    --rf-bg-soft:   #f7f8fb;
    --rf-bg-card:   #ffffff;
    --rf-text:      #1a1f36;
    --rf-text-soft: #5b6479;
    --rf-border:    #e5e9f0;
    --rf-shadow:    0 2px 12px rgba(10,36,94,0.06);
    --rf-link:      #0F3999;
    --rf-overlay:   rgba(255,255,255,0.92);
}

[data-theme="dark"] {
    --rf-bg:        #0c1220;
    --rf-bg-soft:   #131a2a;
    --rf-bg-card:   #1a2236;
    --rf-text:      #e8ecf3;
    --rf-text-soft: #98a3b8;
    --rf-border:    #2a3247;
    --rf-shadow:    0 2px 12px rgba(0,0,0,0.45);
    --rf-link:      #6FA8FF;
    --rf-overlay:   rgba(12,18,32,0.92);

    color-scheme: dark;
}

[data-theme="dark"] body {
    background: var(--rf-bg) !important;
    color: var(--rf-text);
}

[data-theme="dark"] img:not([data-rf-no-dim]) { filter: brightness(.92); }
[data-theme="dark"] .l-section,
[data-theme="dark"] .w-grid,
[data-theme="dark"] .vc_row { background-color: transparent; }
[data-theme="dark"] .w-post-elm.post_title,
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6 {
    color: var(--rf-text) !important;
}
[data-theme="dark"] .w-post-elm.post_content,
[data-theme="dark"] p { color: var(--rf-text-soft); }

/* =========================================================
   2. THEME TOGGLE BUTTON (canto sup. dir.)
   ========================================================= */
.rf-theme-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 9998;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--rf-border);
    background: var(--rf-bg-card);
    color: var(--rf-text);
    box-shadow: var(--rf-shadow);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease, background .2s ease;
    font-size: 18px;
    line-height: 1;
}
.rf-theme-toggle:hover { transform: scale(1.08); }
.rf-theme-toggle .ic-sun { display: none; }
.rf-theme-toggle .ic-moon { display: inline; }
[data-theme="dark"] .rf-theme-toggle .ic-sun { display: inline; }
[data-theme="dark"] .rf-theme-toggle .ic-moon { display: none; }

@media (max-width: 768px) {
    .rf-theme-toggle { top: auto; bottom: 76px; right: 12px; width: 40px; height: 40px; }
}

/* =========================================================
   3. BOTTOM NAV MOBILE
   ========================================================= */
.rf-bottom-nav { display: none; }

@media (max-width: 768px) {
    body { padding-bottom: 64px; } /* espaço pra nav fixa */

    .rf-bottom-nav {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9997;
        background: var(--rf-overlay);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid var(--rf-border);
        box-shadow: 0 -2px 14px rgba(10,36,94,0.08);
        padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
    }
    .rf-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 4px;
        text-decoration: none;
        color: var(--rf-text-soft);
        font-size: 10px;
        font-weight: 600;
        transition: color .15s ease;
    }
    .rf-bottom-nav a svg {
        width: 22px;
        height: 22px;
        stroke: currentColor;
        fill: none;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    .rf-bottom-nav a:hover,
    .rf-bottom-nav a.is-current {
        color: #0F3999;
    }
    [data-theme="dark"] .rf-bottom-nav a.is-current,
    [data-theme="dark"] .rf-bottom-nav a:hover {
        color: #6FA8FF;
    }
    .rf-bottom-nav a span { line-height: 1; }
}

/* =========================================================
   4. AUDIO PLAYER FLUTUANTE
   ========================================================= */
.rf-audio-player {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: 480px;
    margin: 0 auto;
    z-index: 9996;
    background: var(--rf-bg-card);
    border: 1px solid var(--rf-border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(10,36,94,0.18);
    padding: 10px 12px;
    display: none;
    grid-template-columns: 36px 1fr 28px;
    gap: 10px;
    align-items: center;
    transform: translateY(120%);
    transition: transform .25s ease;
}
.rf-audio-player.is-visible {
    display: grid;
    transform: translateY(0);
}
@media (max-width: 768px) {
    .rf-audio-player.is-visible { bottom: 76px; }
}

.rf-ap-play {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 0;
    background: #0F3999;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.rf-ap-play svg { width: 14px; height: 14px; fill: currentColor; }
.rf-ap-meta { min-width: 0; }
.rf-ap-title {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--rf-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rf-ap-progress {
    width: 100%;
    height: 3px;
    background: var(--rf-border);
    border-radius: 99px;
    margin-top: 4px;
    cursor: pointer;
    overflow: hidden;
}
.rf-ap-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0F3999, #F4A580);
    transition: width .25s linear;
    border-radius: 99px;
}
.rf-ap-time {
    font-size: 10px;
    color: var(--rf-text-soft);
    margin-top: 2px;
    display: flex;
    justify-content: space-between;
}
.rf-ap-close {
    width: 28px; height: 28px;
    border: 0;
    background: transparent;
    color: var(--rf-text-soft);
    cursor: pointer;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
}
.rf-ap-close:hover { background: var(--rf-bg-soft); color: var(--rf-text); }

/* "Reproduzir" trigger inline (usado em vez de <audio> nu) */
.rf-audio-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #0A245E;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border: 0;
    cursor: pointer;
    transition: background .15s ease;
}
.rf-audio-trigger:hover { background: #0F3999; }
.rf-audio-trigger svg { width: 14px; height: 14px; fill: currentColor; }

/* =========================================================
   5. SHARE-AS-IMAGE (botão flutuante + modal)
   ========================================================= */
.rf-share-trigger {
    position: absolute;
    z-index: 9995;
    transform: translate(-50%, -120%);
    background: #0A245E;
    color: #fff;
    padding: 6px 12px;
    border-radius: 99px;
    border: 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(10,36,94,0.25);
    display: none;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.rf-share-trigger.is-visible { display: inline-flex; }
.rf-share-trigger svg { width: 12px; height: 12px; fill: currentColor; }

.rf-share-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(10, 18, 32, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.rf-share-modal.is-open { display: flex; }
.rf-share-card {
    background: #fff;
    border-radius: 14px;
    max-width: 560px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.rf-share-card-head {
    background: #0A245E;
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.rf-share-card-head h3 { margin: 0; font-size: 16px; }
.rf-share-card-close {
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}
.rf-share-canvas-wrap {
    padding: 18px;
    background: #f7f8fb;
    text-align: center;
}
.rf-share-canvas-wrap canvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.rf-share-actions {
    padding: 14px 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    border-top: 1px solid var(--rf-border);
}
.rf-share-actions button {
    border: 0;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.rf-share-actions .btn-primary { background: #0A245E; color: #fff; }
.rf-share-actions .btn-secondary { background: #f7f8fb; color: #0A245E; border: 1px solid var(--rf-border); }
.rf-share-actions .btn-primary:hover { background: #0F3999; }

/* =========================================================
   6. RESPEITAR USER PREF (no-motion / tela alta densidade)
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    .rf-audio-player,
    .rf-theme-toggle,
    .rf-share-trigger { transition: none !important; }
}

@media print {
    .rf-bottom-nav,
    .rf-theme-toggle,
    .rf-audio-player,
    .rf-share-trigger,
    .rf-share-modal { display: none !important; }
}
