/* ============================================
   FORMATION MODULE v2 - User Styles
   Premium dark theme matching formation-v2.html
   ============================================ */

:root {
    --fm-bg: #0a0a0f;
    --fm-bg-secondary: #12121a;
    --fm-bg-tertiary: #1a1a25;
    --fm-card: #15151f;
    --fm-card-hover: #1c1c28;
    --fm-gold: #d4a854;
    --fm-gold-dim: #b8934a;
    --fm-emerald: #2dd4a7;
    --fm-blue: #4a9eff;
    --fm-text: #f5f5f7;
    --fm-text-sec: #a0a0b0;
    --fm-text-muted: #6a6a7a;
    --fm-border: rgba(255,255,255,0.06);
    --fm-border-gold: rgba(212, 168, 84, 0.3);
    --fm-success: #22c55e;
    --fm-warning: #f59e0b;
    --fm-error: #ff3b30;
    --fm-locked: #4a4a5a;
}

/* ============================================
   CONTAINER
   ============================================ */
#rnd-tab-formation {
    padding: 0 16px 120px 16px;
    max-width: 800px;
    margin: 0 auto;
}

/* ============================================
   BACK BUTTON
   ============================================ */
.fm-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--fm-border);
    border-radius: 8px;
    color: var(--fm-text-sec);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 16px 0;
}

.fm-back-btn:hover {
    color: var(--fm-gold);
    border-color: var(--fm-gold);
}

/* ============================================
   CATEGORIES GRID
   ============================================ */
.fm-categories-header {
    margin-bottom: 20px;
    padding-top: 16px;
}

.fm-categories-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--fm-text);
}

.fm-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.fm-category-card {
    background: var(--fm-card);
    border: 1px solid var(--fm-border);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.fm-category-card:hover {
    background: var(--fm-card-hover);
    border-color: var(--fm-gold);
    transform: translateY(-2px);
}

.fm-category-card:active {
    transform: scale(0.97);
}

.fm-category-icon {
    font-size: 36px;
    margin-bottom: 12px;
    display: block;
}

.fm-category-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--fm-text);
    margin-bottom: 4px;
}

.fm-category-desc {
    font-size: 13px;
    color: var(--fm-text-sec);
    margin-bottom: 12px;
    line-height: 1.4;
}

.fm-category-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fm-category-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--fm-bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.fm-category-progress-fill {
    height: 100%;
    background: var(--fm-gold);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.fm-category-progress-text {
    font-size: 12px;
    color: var(--fm-text-muted);
    white-space: nowrap;
}

/* ============================================
   GLOBAL PROGRESS CARD
   ============================================ */
.fm-global-card {
    background: linear-gradient(135deg, rgba(212, 168, 84, 0.12) 0%, rgba(212, 168, 84, 0.03) 100%);
    border: 1px solid var(--fm-border-gold);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.fm-global-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.fm-global-header:hover {
    background: rgba(255,255,255,0.02);
}

.fm-global-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.fm-global-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--fm-gold) 0%, var(--fm-gold-dim) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.fm-global-info h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
    color: var(--fm-text);
}

.fm-global-info p {
    font-size: 0.85rem;
    color: var(--fm-text-sec);
}

.fm-global-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.fm-global-percent {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--fm-gold);
}

.fm-chevron {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fm-text-muted);
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.fm-global-card.expanded .fm-chevron {
    transform: rotate(180deg);
    background: rgba(212, 168, 84, 0.2);
    color: var(--fm-gold);
}

.fm-module-card.expanded > .fm-module-header .fm-chevron {
    transform: rotate(180deg);
    background: rgba(74, 158, 255, 0.2);
    color: var(--fm-blue);
}

.fm-global-content {
    display: none;
    padding: 0 1.5rem 1.5rem;
    border-top: 1px solid var(--fm-border);
}

.fm-global-card.expanded .fm-global-content {
    display: block;
}

.fm-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.fm-stat-box {
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.fm-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fm-emerald);
    margin-bottom: 0.2rem;
}

.fm-stat-label {
    font-size: 0.75rem;
    color: var(--fm-text-muted);
}

/* ============================================
   SECTION TITLE
   ============================================ */
.fm-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--fm-text-muted);
    margin-bottom: 1rem;
    font-weight: 600;
    padding-left: 0.5rem;
}

/* ============================================
   MODULE CARD
   ============================================ */
.fm-module-card {
    background: var(--fm-card);
    border: 1px solid var(--fm-border);
    border-radius: 16px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: fm-slideIn 0.4s ease forwards;
    opacity: 0;
}

.fm-module-card:nth-child(1) { animation-delay: 0.1s; }
.fm-module-card:nth-child(2) { animation-delay: 0.15s; }
.fm-module-card:nth-child(3) { animation-delay: 0.2s; }
.fm-module-card:nth-child(4) { animation-delay: 0.25s; }
.fm-module-card:nth-child(5) { animation-delay: 0.3s; }
.fm-module-card:nth-child(6) { animation-delay: 0.35s; }

.fm-module-card:hover {
    border-color: rgba(255,255,255,0.1);
}

.fm-module-card.expanded {
    border-color: var(--fm-blue);
    box-shadow: 0 0 0 1px rgba(74, 158, 255, 0.1);
}

.fm-module-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.fm-module-header:hover {
    background: var(--fm-card-hover);
}

.fm-module-number {
    width: 40px;
    height: 40px;
    background: var(--fm-bg-tertiary);
    border: 2px solid var(--fm-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--fm-text-sec);
    flex-shrink: 0;
}

.fm-module-card.completed .fm-module-number {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--fm-success);
    color: var(--fm-success);
}

.fm-module-card.in-progress .fm-module-number {
    background: rgba(74, 158, 255, 0.15);
    border-color: var(--fm-blue);
    color: var(--fm-blue);
}

.fm-module-card.locked .fm-module-number {
    background: var(--fm-bg-tertiary);
    border-color: var(--fm-locked);
    color: var(--fm-locked);
}

.fm-module-card.locked .fm-module-header {
    cursor: default;
}

.fm-module-info {
    flex: 1;
    min-width: 0;
}

.fm-module-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--fm-text);
}

.fm-module-card.locked .fm-module-title {
    color: var(--fm-text-muted);
}

.fm-module-meta {
    font-size: 0.8rem;
    color: var(--fm-text-muted);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fm-module-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-right: 0.5rem;
}

.fm-module-progress-bar {
    width: 100px;
    height: 6px;
    background: var(--fm-bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
}

.fm-module-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--fm-emerald), #34d399);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.fm-module-card.locked .fm-module-progress-fill {
    background: var(--fm-locked);
}

.fm-module-percent {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--fm-emerald);
    min-width: 40px;
    text-align: right;
}

.fm-module-card.locked .fm-module-percent {
    color: var(--fm-locked);
}

/* Module content (expanded) */
.fm-module-content {
    display: none;
    border-top: 1px solid var(--fm-border);
    background: rgba(0,0,0,0.15);
}

.fm-module-card.expanded .fm-module-content {
    display: block;
    animation: fm-slideDown 0.3s ease;
}

/* ============================================
   SUBJECT ITEM
   ============================================ */
.fm-subject-item {
    border-bottom: 1px solid var(--fm-border);
}

.fm-subjects-list > .fm-subject-item:last-child {
    border-bottom: none;
}

.fm-subject-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fm-subject-row:hover {
    background: rgba(255,255,255,0.02);
}

.fm-subject-item.active .fm-subject-row,
.fm-subject-item.playing .fm-subject-row {
    background: rgba(74, 158, 255, 0.08);
}

.fm-subject-item.locked .fm-subject-row {
    cursor: default;
    opacity: 0.7;
}

.fm-subject-number {
    width: 32px;
    height: 32px;
    background: var(--fm-bg-tertiary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--fm-text-muted);
    flex-shrink: 0;
}

.fm-subject-item.completed .fm-subject-number {
    background: rgba(34, 197, 94, 0.15);
    color: var(--fm-success);
}

.fm-subject-item.active .fm-subject-number,
.fm-subject-item.playing .fm-subject-number {
    background: rgba(74, 158, 255, 0.15);
    color: var(--fm-blue);
}

.fm-subject-info {
    flex: 1;
    min-width: 0;
}

.fm-subject-title {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
    color: var(--fm-text);
}

.fm-subject-item.locked .fm-subject-title {
    color: var(--fm-text-muted);
}

.fm-subject-meta {
    font-size: 0.75rem;
    color: var(--fm-text-muted);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fm-subject-status {
    font-size: 1rem;
    flex-shrink: 0;
}

/* Subject text content (text mode) - supports HTML */
.fm-subject-text-content {
    padding: 0 1.5rem 1rem;
    padding-left: calc(1.5rem + 32px + 1rem);
    font-size: 0.85rem;
    color: var(--fm-text-sec);
    line-height: 1.6;
}

.fm-subject-text-content b,
.fm-subject-text-content strong {
    color: var(--fm-text);
    font-weight: 600;
}

.fm-subject-text-content em,
.fm-subject-text-content i {
    color: var(--fm-gold);
}

.fm-subject-text-content ul,
.fm-subject-text-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.fm-subject-text-content li {
    margin: 4px 0;
}

.fm-subject-text-content h4 {
    color: var(--fm-text);
    font-size: 0.9rem;
    margin: 12px 0 6px;
}

.fm-subject-text-content a {
    color: var(--fm-emerald);
    text-decoration: underline;
}

.fm-subject-text-content p {
    margin: 6px 0;
}

/* ============================================
   FORMAT TOGGLE (Audio / Texte)
   ============================================ */
.fm-format-toggle {
    display: flex;
    background: var(--fm-bg-tertiary);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}

.fm-format-btn {
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--fm-text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.fm-format-btn.active {
    background: var(--fm-blue);
    color: white;
}

.fm-format-btn:hover:not(.active) {
    color: var(--fm-text);
}

/* ============================================
   QCM ITEM (in module footer)
   ============================================ */
.fm-qcm-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(212, 168, 84, 0.08) 0%, rgba(212, 168, 84, 0.02) 100%);
    border-top: 1px solid var(--fm-border-gold);
}

.fm-qcm-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--fm-gold) 0%, var(--fm-gold-dim) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.fm-qcm-info {
    flex: 1;
}

.fm-qcm-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
    color: var(--fm-text);
}

.fm-qcm-meta {
    font-size: 0.75rem;
    color: var(--fm-text-muted);
}

.fm-qcm-btn {
    background: var(--fm-gold);
    color: var(--fm-bg);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.fm-qcm-btn:hover {
    background: var(--fm-gold-dim);
    transform: translateY(-1px);
}

.fm-qcm-btn:disabled {
    background: var(--fm-locked);
    cursor: not-allowed;
    transform: none;
    color: var(--fm-text-muted);
}

.fm-qcm-score {
    text-align: right;
    flex-shrink: 0;
}

.fm-qcm-score-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--fm-success);
}

.fm-qcm-score-label {
    font-size: 0.7rem;
    color: var(--fm-text-muted);
}

/* ============================================
   LOCKED BADGE
   ============================================ */
.fm-locked-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--fm-locked);
    background: rgba(74, 74, 90, 0.2);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.fm-empty {
    text-align: center;
    padding: 60px 20px;
}

.fm-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.fm-empty p {
    color: var(--fm-text-muted);
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fm-slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fm-slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   QCM ENGINE STYLES
   (classes used by qcmEngine.js - do NOT rename)
   ============================================ */
.formation-qcm {
    padding: 8px 0;
}

.formation-qcm-header {
    margin-bottom: 24px;
}

.formation-qcm-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--fm-text);
    margin-bottom: 8px;
}

.formation-qcm-info {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.formation-qcm-badge {
    padding: 4px 10px;
    background: rgba(212, 168, 84, 0.15);
    color: var(--fm-gold);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.formation-qcm-questions {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.formation-qcm-question {
    background: var(--fm-card);
    border: 1px solid var(--fm-border);
    border-radius: 16px;
    padding: 20px;
}

.formation-qcm-question-header {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.formation-qcm-question-number {
    width: 28px;
    height: 28px;
    background: var(--fm-gold);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.formation-qcm-question-text {
    font-size: 15px;
    color: var(--fm-text);
    line-height: 1.5;
    margin: 0;
    padding-top: 3px;
}

.formation-qcm-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.formation-qcm-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--fm-bg);
    border: 1px solid var(--fm-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.formation-qcm-option:hover {
    border-color: var(--fm-gold);
    background: rgba(212, 168, 84, 0.08);
}

.formation-qcm-option.selected {
    border-color: var(--fm-gold);
    background: rgba(212, 168, 84, 0.08);
}

.formation-qcm-option.correct {
    border-color: var(--fm-success);
    background: rgba(34, 197, 94, 0.1);
}

.formation-qcm-option.incorrect {
    border-color: var(--fm-error);
    background: rgba(255, 59, 48, 0.1);
}

.formation-qcm-option input[type="radio"],
.formation-qcm-option input[type="checkbox"] {
    display: none;
}

.formation-qcm-option-radio {
    width: 18px;
    height: 18px;
    border: 2px solid var(--fm-text-muted);
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s;
}

.formation-qcm-option.selected .formation-qcm-option-radio {
    border-color: var(--fm-gold);
}

.formation-qcm-option.selected .formation-qcm-option-radio::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    background: var(--fm-gold);
    border-radius: 50%;
}

.formation-qcm-option.correct .formation-qcm-option-radio {
    border-color: var(--fm-success);
    background: var(--fm-success);
}

.formation-qcm-option.incorrect .formation-qcm-option-radio {
    border-color: var(--fm-error);
    background: var(--fm-error);
}

/* Checkbox style pour multi-reponses */
.formation-qcm-option-check {
    width: 18px;
    height: 18px;
    border: 2px solid var(--fm-text-muted);
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s;
}

.formation-qcm-option.selected .formation-qcm-option-check {
    border-color: var(--fm-gold);
    background: var(--fm-gold);
}

.formation-qcm-option.selected .formation-qcm-option-check::after {
    content: '\2713';
    position: absolute;
    top: -1px;
    left: 2px;
    font-size: 13px;
    color: #000;
    font-weight: 700;
}

.formation-qcm-option.correct .formation-qcm-option-check {
    border-color: var(--fm-success);
    background: var(--fm-success);
}

.formation-qcm-option.correct .formation-qcm-option-check::after {
    content: '\2713';
    position: absolute;
    top: -1px;
    left: 2px;
    font-size: 13px;
    color: #000;
    font-weight: 700;
}

.formation-qcm-option.incorrect .formation-qcm-option-check {
    border-color: var(--fm-error);
    background: var(--fm-error);
}

.formation-qcm-option.incorrect .formation-qcm-option-check::after {
    content: '\2717';
    position: absolute;
    top: -1px;
    left: 2px;
    font-size: 13px;
    color: #fff;
    font-weight: 700;
}

/* Hint multi-reponses */
.formation-qcm-multi-hint {
    font-size: 12px;
    color: var(--fm-emerald);
    font-style: italic;
    margin-left: 6px;
}

.formation-qcm-option-text {
    font-size: 14px;
    color: var(--fm-text);
}

.formation-qcm-explanation {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.formation-qcm-explanation.correct {
    background: rgba(34, 197, 94, 0.1);
    color: var(--fm-success);
}

.formation-qcm-explanation.incorrect {
    background: rgba(255, 59, 48, 0.1);
    color: var(--fm-error);
}

.formation-qcm-footer {
    margin-top: 24px;
}

.formation-qcm-submit-btn {
    width: 100%;
    padding: 16px;
    background: var(--fm-gold);
    color: #000;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.formation-qcm-submit-btn:hover {
    filter: brightness(1.1);
}

.formation-qcm-submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.formation-qcm-submit-btn:disabled:hover {
    filter: none;
}

.formation-qcm-result {
    text-align: center;
    padding: 24px;
    border-radius: 16px;
}

.formation-qcm-result.passed {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--fm-success);
}

.formation-qcm-result.failed {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid var(--fm-error);
}

.formation-qcm-result-score {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 8px;
}

.formation-qcm-result.passed .formation-qcm-result-score {
    color: var(--fm-success);
}

.formation-qcm-result.failed .formation-qcm-result-score {
    color: var(--fm-error);
}

.formation-qcm-result p {
    font-size: 16px;
    color: var(--fm-text);
    margin-bottom: 4px;
}

.formation-qcm-result-detail {
    font-size: 13px !important;
    color: var(--fm-text-muted) !important;
}

.formation-qcm-success,
.formation-qcm-failed {
    text-align: center;
    padding: 40px 20px;
}

.formation-qcm-success-icon {
    font-size: 48px;
    color: var(--fm-success);
    margin-bottom: 12px;
}

.formation-qcm-failed-icon {
    font-size: 48px;
    color: var(--fm-error);
    margin-bottom: 12px;
}

.formation-qcm-success h3,
.formation-qcm-failed h3 {
    font-size: 20px;
    color: var(--fm-text);
    margin-bottom: 8px;
}

.formation-qcm-success p,
.formation-qcm-failed p {
    color: var(--fm-text-muted);
    font-size: 14px;
}

.formation-qcm-meta {
    font-size: 12px !important;
    color: var(--fm-text-muted) !important;
    margin-top: 8px;
}

/* ============================================
   MINI-PLAYER (fixed bottom)
   (classes used by audioPlayer.js - do NOT rename)
   ============================================ */
.formation-mini-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(21, 21, 31, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--fm-border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.formation-player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.formation-player-btn {
    background: none;
    border: none;
    color: var(--fm-text);
    cursor: pointer;
    padding: 6px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.formation-player-btn:hover {
    opacity: 1;
}

.formation-player-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.formation-player-btn.play-pause {
    width: 36px;
    height: 36px;
    background: var(--fm-gold);
    border-radius: 50%;
    color: #000;
    opacity: 1;
}

.formation-player-btn.play-pause:hover {
    filter: brightness(1.1);
}

.formation-player-icon {
    font-size: 14px;
    line-height: 1;
}

.formation-player-info {
    flex: 1;
    min-width: 0;
}

.formation-player-title-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--fm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.formation-player-subtitle-text {
    font-size: 11px;
    color: var(--fm-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.formation-player-progress {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.formation-player-progress-bar {
    flex: 1;
    height: 3px;
    background: var(--fm-border);
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
}

.formation-player-progress-fill {
    height: 100%;
    background: var(--fm-gold);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s linear;
}

.formation-player-time {
    font-size: 10px;
    color: var(--fm-text-muted);
    white-space: nowrap;
    min-width: 34px;
    text-align: center;
}

.formation-player-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.formation-player-speed-btn {
    background: rgba(212, 168, 84, 0.15);
    border: none;
    color: var(--fm-gold);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.formation-player-speed-btn:hover {
    background: rgba(212, 168, 84, 0.25);
}

.formation-player-close-btn {
    background: none;
    border: none;
    color: var(--fm-text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    line-height: 1;
}

.formation-player-close-btn:hover {
    color: var(--fm-text);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
    #rnd-tab-formation {
        padding: 0 12px 130px 12px;
    }

    .fm-stats-grid {
        grid-template-columns: 1fr;
    }

    .fm-categories-grid {
        grid-template-columns: 1fr;
    }

    .fm-module-progress-bar {
        width: 60px;
    }

    .fm-format-toggle {
        padding: 2px;
        gap: 1px;
    }

    .fm-format-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    .fm-module-header {
        padding: 1rem;
        gap: 0.75rem;
    }

    .fm-subject-row {
        padding: 0.85rem 1rem;
        gap: 0.75rem;
    }

    .formation-mini-player {
        padding: 8px 12px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .formation-player-btn.prev-next {
        display: none;
    }
}
