/* ==========================================================================
   VIRTUALFORCE WYSIWYG BBCODE EDITOR & GLOBAL POST STYLES
   ========================================================================== */

/* Masquage de la barre de boutons BBCode phpBB legacy */
#format-buttons, .format-buttons {
    display: none !important;
}

/* Masquage du textarea natif sous l'éditeur */
.vf-editor-hidden-textarea {
    display: none !important;
    position: absolute !important;
    left: -9999px !important;
    height: 0 !important;
    width: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Conteneur principal de l'éditeur */
.vf-editor-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--dk, #0d1117);
    border: 1px solid var(--border2, rgba(255, 255, 255, 0.13));
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    margin-bottom: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vf-editor-wrapper.vf-focus {
    border-color: var(--accent, #c8922a);
    box-shadow: 0 0 15px rgba(200, 146, 42, 0.25);
}

/* ── BARRE D'OUTILS ── */
.vf-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: var(--card, #161b24);
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    user-select: none;
}

.vf-editor-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.07));
    border-radius: 8px;
    padding: 2px;
}

.vf-editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--sub, #8b949e);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.15s ease;
    box-sizing: border-box;
    gap: 4px;
}

.vf-editor-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text, #e6edf3);
    border-color: var(--border2, rgba(255, 255, 255, 0.15));
}

.vf-editor-btn.is-active {
    background: var(--accent, #c8922a);
    color: #000000 !important;
}

.vf-editor-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.vf-editor-btn i {
    font-size: 16px;
    display: inline-block;
    vertical-align: middle;
}

/* ── BLOC INDÉPENDANT DES BALISES ACP (STYLE ORANGÉ / DORÉ) ── */
.vf-editor-group.vf-custom-group {
    background: rgba(200, 146, 42, 0.04) !important;
    border: 1px solid rgba(200, 146, 42, 0.2) !important;
    border-radius: 8px !important;
    padding: 3px !important;
    gap: 4px !important;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent, #c8922a) transparent;
}

.vf-editor-btn.vf-custom-tag-btn {
    font-size: 11.5px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: var(--accent2, #e0a83a) !important;
    padding: 0 10px !important;
    height: 28px !important;
    background: rgba(200, 146, 42, 0.08) !important;
    border: 1px solid rgba(200, 146, 42, 0.25) !important;
    border-radius: 5px !important;
    white-space: nowrap !important;
    gap: 5px !important;
    display: inline-flex !important;
    align-items: center !important;
    transition: all 0.15s ease !important;
}

.vf-editor-btn.vf-custom-tag-btn i {
    font-size: 14px !important;
    color: var(--accent2, #e0a83a) !important;
}

.vf-editor-btn.vf-custom-tag-btn:hover {
    background: var(--accent, #c8922a) !important;
    color: #000000 !important;
    border-color: var(--accent, #c8922a) !important;
}

.vf-editor-btn.vf-custom-tag-btn:hover i {
    color: #000000 !important;
}

/* ── ZONE DE SAISIE VISUELLE (MAX 650PX) ── */
.vf-editor-content {
    min-height: 380px;
    max-height: 650px !important;
    overflow-y: auto;
    padding: 16px 20px;
    color: var(--text, #e6edf3);
    background: var(--dk, #0d1117);
    font-family: var(--font, 'Barlow', sans-serif);
    font-size: 15px;
    line-height: 1.75;
    outline: none;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-break: break-word;
}

.vf-editor-content:empty::before {
    content: attr(data-placeholder);
    color: rgba(139, 148, 158, 0.6);
    pointer-events: none;
    display: block;
}

/* Images & Contraintes de dimensions */
.vf-editor-content img,
.vf-editor-content details img,
.vf-editor-content .rules-box img {
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    display: inline-block !important;
    border-radius: 6px;
    box-sizing: border-box !important;
}

.vf-editor-content img.vf-img-over,
.vf-img-over-rendered {
    border-radius: 8px !important;
    transition: opacity 0.2s ease !important;
}

/* Images Encapsulées 40% */
.vf-img-left,
.content img.vf-img-left,
.postbody img.vf-img-left,
.vf-editor-content img.vf-img-left {
    float: left !important;
    width: 40% !important;
    min-width: 180px !important;
    max-width: 320px !important;
    height: auto !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    margin: 4px 20px 16px 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35) !important;
}

.vf-img-right,
.content img.vf-img-right,
.postbody img.vf-img-right,
.vf-editor-content img.vf-img-right {
    float: right !important;
    width: 40% !important;
    min-width: 180px !important;
    max-width: 320px !important;
    height: auto !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    margin: 4px 0 16px 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35) !important;
}

/* Normalisation du gras */
.content strong, .content b,
.postbody strong, .postbody b,
.vf-editor-content strong, .vf-editor-content b {
    font-weight: 700 !important;
    font-size: inherit !important;
    color: #ffffff !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: inherit !important;
}

.vf-editor-content em, .vf-editor-content i { font-style: italic; color: #cdd9e5; }
.vf-editor-content u { text-decoration: underline; }
.vf-editor-content s, .vf-editor-content strike { text-decoration: line-through; opacity: 0.8; }
.vf-editor-content a { color: #58a6ff; text-decoration: underline; }
.vf-editor-content sub { vertical-align: sub; font-size: smaller; }
.vf-editor-content sup { vertical-align: super; font-size: smaller; }

.vf-editor-content div[align="center"], .vf-editor-content .vf-align-center { text-align: center; }
.vf-editor-content div[align="right"], .vf-editor-content .vf-align-right { text-align: right; }
.vf-editor-content div[align="justify"], .vf-editor-content .vf-align-justify { text-align: justify; }
.vf-editor-content div[align="left"], .vf-editor-content .vf-align-left { text-align: left; }

.vf-editor-content hr,
hr.vf-hr,
.content hr.vf-hr,
.postbody hr.vf-hr {
    border: 0 !important;
    height: 1px !important;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent) !important;
    margin: 20px 0 !important;
}

/* ── CITATIONS GLOBALES (ÉDITEUR ET SUJETS PUBLIÉS) ── */
blockquote,
.content blockquote,
.postbody blockquote,
.vf-editor-content blockquote {
    margin: 14px 0 !important;
    padding: 12px 18px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-left: 3px solid var(--accent, #c8922a) !important;
    border-radius: 10px 8px 0 !important;
    color: #cdd9e5 !important;
    font-style: italic !important;
    display: block !important;
}

blockquote cite,
.content blockquote cite,
.postbody blockquote cite,
.vf-editor-content blockquote cite {
    display: block !important;
    font-weight: 700 !important;
    font-style: normal !important;
    color: var(--accent2, #e0a83a) !important;
    margin-bottom: 6px !important;
    font-size: 13px !important;
    letter-spacing: 0.3px !important;
}

/* ── BLOCS DE CODE / SCRIPTS ── */
.vf-editor-content pre, .codebox, .codebox code, .content .codebox pre {
    display: block !important;
    background: #141820 !important;
    border: 1px solid rgba(200, 146, 42, 0.25) !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    margin: 14px 0 !important;
    color: #e0a83a !important;
    font-family: 'Consolas', 'Fira Code', monospace !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    box-sizing: border-box !important;
}

/* ── STYLE DES TABLEAUX ── */
.vf-table, .content table.vf-table, .postbody table.vf-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 14px 0 !important;
    background: #12161f !important;
    border: 1px solid var(--border2, rgba(255, 255, 255, 0.15)) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.vf-table th, .content table.vf-table th, .postbody table.vf-table th {
    background: var(--card, #1c2333) !important;
    color: var(--accent2, #e0a83a) !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    font-size: 13px !important;
    letter-spacing: 0.5px !important;
    padding: 10px 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    text-align: left !important;
}

.vf-table td, .content table.vf-table td, .postbody table.vf-table td {
    padding: 10px 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: var(--text, #e6edf3) !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
}

.vf-table tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02) !important;
}

/* ── BALISES RICHES VIRTUALFORCE ── */

/* 1. Cadre Lumineux / Side-Select */
.vf-side-select, .content .vf-side-select, .postbody .vf-side-select {
    display: inline-block !important;
    border: 2px solid #2ea043 !important;
    background: rgba(46, 160, 67, 0.12) !important;
    box-shadow: 0 0 15px rgba(46, 160, 67, 0.25) !important;
    border-radius: 8px !important;
    padding: 10px 16px !important;
    margin: 8px 0 !important;
    color: #7ee787 !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* 2. Texte Défilant */
.vf-editor-content .marquee {
    width: 100% !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px dashed rgba(200, 146, 42, 0.35) !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    margin: 10px 0 !important;
}

.vf-editor-content .marquee span {
    display: block !important;
    white-space: normal !important;
    word-break: break-word !important;
    padding-left: 0 !important;
    animation: none !important;
    color: var(--accent2, #e0a83a) !important;
    font-weight: 600 !important;
}

/* ── TEXTE DÉFILANT AVEC PAUSE AU SURVOL ── */
.marquee, .content .marquee, .postbody .marquee {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px dashed rgba(200, 146, 42, 0.35) !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    margin: 10px 0 !important;
    cursor: default;
}

/* Pause automatique quand la souris survole le texte */
.marquee:hover span,
.content .marquee:hover span,
.postbody .marquee:hover span {
    animation-play-state: paused !important;
    cursor: pointer;
}

.marquee span, .content .marquee span, .postbody .marquee span {
    display: inline-block !important;
    white-space: nowrap !important;
    padding-left: 100% !important;
    animation-name: vfMarqueeAnim !important;
    animation-timing-function: linear !important;
    animation-iteration-count: infinite !important;
    animation-duration: 35s; /* Vitesse par défaut ralentie */
    color: var(--accent2, #e0a83a) !important;
    font-weight: 600 !important;
}

@keyframes vfMarqueeAnim {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* 3. Warning & Spoiler */
.rules-box, .vf-editor-content .rules-box {
    display: block !important;
    background: rgba(200, 146, 42, 0.12) !important;
    border: 1px solid rgba(200, 146, 42, 0.4) !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    margin: 12px 0 !important;
    color: var(--accent2, #e0a83a) !important;
}

details, .vf-editor-content details, details.vf-spoiler, .content details.vf-spoiler {
    background: var(--card, #161b24) !important;
    border: 1px solid var(--border2, rgba(255, 255, 255, 0.12)) !important;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    margin: 12px 0 !important;
}

details summary, .vf-editor-content details summary {
    cursor: pointer !important;
    color: var(--accent2, #e0a83a) !important;
    font-weight: 700 !important;
}

.vf-spoiler-content {
    margin-top: 8px !important;
    padding-top: 8px !important;
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08)) !important;
}

/* 4. Highlight */
.vf-highlight-box, .content .vf-highlight-box, .postbody .vf-highlight-box {
    border-left: 4px solid rgba(255, 255, 255, 0.35) !important;
    border-right: 4px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 8px !important;
    padding: 12px 18px !important;
    margin: 14px 0 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35) !important;
    word-break: break-word !important;
    display: block !important;
}

/* 5. Progress */
.vf-progress-wrapper, .content .vf-progress-wrapper, .postbody .vf-progress-wrapper {
    background: #141820 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    height: 24px !important;
    padding: 3px !important;
    border-radius: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 14px 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    display: block !important;
}

.vf-progress-bar, .content .vf-progress-bar, .postbody .vf-progress-bar {
    display: block !important;
    height: 100% !important;
    background: linear-gradient(90deg, #c8922a, #e0a83a) !important;
    color: #000000 !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    text-align: center !important;
    line-height: 18px !important;
    border-radius: 4px !important;
    box-shadow: 0 0 10px rgba(200, 146, 42, 0.3) !important;
}

/* 6. Lecteur Audio Compact & Alignable */
.vf-audio-player,
.content .vf-audio-player,
.postbody .vf-audio-player,
.vf-editor-content .vf-audio-player {
    display: inline-block !important;
    width: auto !important;
    max-width: 360px !important;
    margin: 8px 0 !important;
    vertical-align: middle !important;
}

.vf-audio-player audio {
    width: 340px !important;
    max-width: 100% !important;
    height: 36px !important;
    border-radius: 8px !important;
}

/* 7. Mentions en Badge Doré */
.mention,
.content .mention,
.postbody .mention,
.vf-editor-content .mention {
    display: inline-block !important;
    background: rgba(200, 146, 42, 0.15) !important;
    color: var(--accent2, #e0a83a) !important;
    border: 1px solid rgba(200, 146, 42, 0.35) !important;
    border-radius: 4px !important;
    padding: 1px 7px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    user-select: all !important;
    margin: 0 2px !important;
}

/* 8. Vidéos & Widgets */
.vf-video-wrapper, .vf-editor-content .vf-video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 10px;
    margin: 14px 0;
    background: #000000;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.vf-video-wrapper iframe, .vf-editor-content .vf-video-wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

.vf-editor-content .vf-video-wrapper iframe {
    pointer-events: none;
}

.vf-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #161b24;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 8px 14px;
    color: #58a6ff;
    font-size: 13px;
    margin: 6px 0;
    user-select: none;
}

.vf-badge-imgur { border-color: rgba(27, 183, 110, 0.4); color: #1bb76e; }
.vf-badge-pinterest { border-color: rgba(230, 0, 35, 0.4); color: #e60023; }

.vf-imgur-embed {
    clear: both !important;
    margin: 16px 0 !important;
    display: block !important;
}

/* ── MENUS DÉROULANTS ── */
.vf-editor-dropdown {
    position: absolute;
    background: var(--card, #161b24);
    border: 1px solid var(--border2, rgba(255, 255, 255, 0.15));
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    z-index: 10000;
    min-width: 180px;
    max-height: 280px;
    overflow-y: auto;
}

.vf-dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text, #e6edf3);
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.15s ease;
}

.vf-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent, #c8922a);
}

.vf-color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    padding: 4px;
}

.vf-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.vf-color-swatch:hover {
    transform: scale(1.2);
    border-color: #ffffff;
    z-index: 1;
}

/* ── PALETTE ET SLIDER D'OPACITÉ (HIGHLIGHT) ── */
.vf-color-grid-compact {
    display: grid !important;
    grid-template-columns: repeat(8, 1fr) !important;
    gap: 6px !important;
    padding: 6px 0 12px 0 !important;
}

.vf-color-grid-compact .vf-color-swatch {
    width: 100% !important;
    height: 26px !important;
    border-radius: 6px !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, border-color 0.15s ease !important;
}

.vf-color-grid-compact .vf-color-swatch:hover {
    transform: scale(1.15) !important;
    border-color: #ffffff !important;
    z-index: 2 !important;
}

.vf-opacity-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 14px 0;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.vf-opacity-slider-container input[type="range"] {
    flex: 1;
    accent-color: var(--accent, #c8922a);
    cursor: pointer;
}

.vf-opacity-val {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent2, #e0a83a);
    min-width: 35px;
    text-align: right;
}

/* ── CRÉDITS AU BAS DES SMILEYS ── */
.vf-editor-credits {
    font-size: 9.5px !important;
    color: var(--sub, #8b949e) !important;
    opacity: 0.55;
    text-align: center !important;
    padding: 10px 4px 4px 4px !important;
    margin-top: 12px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    user-select: none !important;
    letter-spacing: 0.3px;
}

/* ── MODE SOURCE (MAX 650PX) ── */
.vf-editor-source {
    display: none;
    width: 100%;
    min-height: 380px;
    max-height: 650px !important;
    padding: 16px 20px;
    box-sizing: border-box;
    background: #090d12;
    color: #e0a83a;
    border: none;
    font-family: monospace, 'Barlow', sans-serif;
    font-size: 13px;
    line-height: 1.6;
    outline: none;
    resize: vertical;
}

.vf-editor-wrapper.is-source-mode .vf-editor-content { display: none; }
.vf-editor-wrapper.is-source-mode .vf-editor-source { display: block; }

/* ── MODALES ── */
.vf-editor-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vf-editor-modal {
    background: var(--card, #161b24);
    border: 1px solid var(--border2, rgba(255, 255, 255, 0.15));
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
    color: var(--text, #e6edf3);
}

.vf-editor-modal h3 {
    margin: 0 0 14px 0;
    font-size: 16px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vf-editor-modal label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--sub, #8b949e);
    margin-bottom: 5px;
}

.vf-editor-modal input[type="text"],
.vf-editor-modal input[type="url"],
.vf-editor-modal input[type="number"] {
    width: 100%;
    background: var(--dk, #0d1117);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    border-radius: 6px;
    color: var(--text, #e6edf3);
    padding: 8px 12px;
    font-size: 14px;
    box-sizing: border-box;
    margin-bottom: 12px;
    outline: none;
}

.vf-editor-modal input:focus {
    border-color: var(--accent, #c8922a);
}

.vf-editor-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.vf-editor-btn-cancel, .vf-editor-btn-confirm {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.vf-editor-btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text, #e6edf3);
}

.vf-editor-btn-confirm {
    background: var(--accent, #c8922a);
    color: #000000;
}

.vf-editor-wrapper.is-fullscreen {
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    width: 100vw !important; height: 100vh !important;
    z-index: 999999 !important;
    border-radius: 0 !important;
    border: none !important;
}

.vf-editor-wrapper.is-fullscreen .vf-editor-content,
.vf-editor-wrapper.is-fullscreen .vf-editor-source {
    max-height: none !important;
    height: calc(100vh - 55px) !important;
}