/* Marketplace CSS */
.reports-dashboard {
    padding: 0;
}

/* Header - Style tableau de bord */
.dashboard-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    background-color: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-icon {
    background-color: #0c84e4;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 1rem;
}

.header-content {
    flex-grow: 1;
}

.header-title {
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.header-description {
    color: #7f8c8d;
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    flex-direction: column;
}

/* Formulaire de recherche */
.search-form {
    display: flex;
    justify-content: flex-end;
}

.search-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    flex-grow: 1;
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background-color: white;
}

/* Statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}

.stat-content h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: #2c3e50;
}

.stat-content p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Badges de statistiques pour les QCM achetés */
.qcm-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.8rem;
    margin-bottom: 0.8rem;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.stat-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.stat-badge i {
    font-size: 1rem;
    flex-shrink: 0;
    opacity: 0.85;
}

.stat-badge strong {
    font-size: 1.1rem;
    font-weight: 700;
    margin-left: 0.15rem;
}

.stat-badge.stat-total {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #0d47a1;
    border: 2px solid #2196f3;
}

.stat-badge.stat-total i {
    color: #1976d2;
}

.stat-badge.stat-available {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #1b5e20;
    border: 2px solid #4caf50;
}

.stat-badge.stat-available i {
    color: #2e7d32;
}

.stat-badge.stat-completed {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #e65100;
    border: 2px solid #ff9800;
}

.stat-badge.stat-completed i {
    color: #f57c00;
}

.stat-badge.stat-assigned {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    color: #4a148c;
    border: 2px solid #9c27b0;
}

.stat-badge.stat-assigned i {
    color: #6a1b9a;
}

/* Badge: en cours (licence assignée) */
.stat-badge.stat-inprogress {
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    color: #004d40;
    border: 2px solid #00acc1;
}

.stat-badge.stat-inprogress i {
    color: #00838f;
}

/* Section Marketplace */
.marketplace-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
    overflow: hidden;
}

.section-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.section-header h3 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header p {
    margin: 0;
    font-size: 0.9rem;
    color: #6c757d;
}

/* ── Grid ── */
.qcm-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    padding: 20px;
}
@media (max-width: 1400px) { .qcm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .qcm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 580px)  { .qcm-grid { grid-template-columns: 1fr; padding: 12px; gap: 10px; } }

@media (max-width: 768px) {
    .qcm-grid {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 15px;
    }
}

/* ── Card ── */
.qcm-card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e8ecf2;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    display: flex;
    flex-direction: column;
    transition: box-shadow .18s, transform .18s, border-color .18s;
}
.qcm-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.11);
    border-color: #c7d2fe;
}
.qcm-card-accent { display: none; }

/* ── Cover ── */
.qcm-cover {
    height: 120px;
    position: relative;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.qcm-cover-icon {
    font-size: 2.4rem;
    color: rgba(255,255,255,.45);
}
.qcm-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.04) 0%, rgba(0,0,0,.22) 100%);
    pointer-events: none;
}
.qcm-cover--img {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.qcm-cover--img .qcm-cover-icon { display: none; }

/* ── Difficulty chip ── */
.qcm-chip {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.69rem;
    letter-spacing: .2px;
    color: #fff;
    background: rgba(0,0,0,.32);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,.18);
}
.qcm-chip.tag-blue  { background: rgba(59,130,246,.80); }
.qcm-chip.tag-brown { background: rgba(180,125,47,.85); }
.qcm-chip.tag-red   { background: rgba(185,28,28,.80); }
.qcm-chip--top-right { top: 10px; right: 10px; left: auto; bottom: auto; }
.qcm-chip--top-left  { top: 10px; left: 10px; right: auto; bottom: auto; gap: 4px; }
.qcm-chip--flag { font-size: 1rem; padding: 0 6px; line-height: 1; }

.qcm-header {
    padding: 1rem;
    background:
        radial-gradient(1200px 600px at -10% -30%, rgba(102, 126, 234, 0.25) 0%, rgba(102, 126, 234, 0.00) 55%),
        radial-gradient(900px 450px at 110% 0%, rgba(118, 75, 162, 0.22) 0%, rgba(118, 75, 162, 0.00) 55%),
        linear-gradient(180deg, #fbfcff 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    border-bottom: none;
    padding-bottom: 0;
}

.qcm-header h3 {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    text-transform: none;
    color: #1f2937;
    margin: 0;
}

.qcm-date {
    font-size: 0.82rem;
    color: rgba(15, 23, 42, 0.55);
    margin-top: 6px;
    font-size: 0.8rem;
    color: #666;
}

.qcm-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Tags ── */
.qcm-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 3px;
}
.qcm-tag {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 600;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
}
.qcm-tag--more {
    background: #e0e7ff;
    border-color: #c7d2fe;
    color: #3730a3;
}
body.dark-mode .qcm-tag {
    background: rgba(15,22,32,.55);
    border-color: rgba(255,255,255,.12);
    color: rgba(255,255,255,.8);
}
body.dark-mode .qcm-tag--more {
    background: rgba(102,126,234,.18);
    border-color: rgba(102,126,234,.30);
}

/* ── Card body ── */
.qcm-card-body {
    padding: 11px 13px 9px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.qcm-cat-chip {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
    background: #eff6ff;
    color: #1d4ed8;
    width: fit-content;
    margin-bottom: 1px;
}
.qcm-title {
    margin: 0;
    font-size: .91rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.qcm-title small {
    font-size: .7rem;
    font-weight: 500;
    color: #9ca3af;
    vertical-align: middle;
}
.qcm-subtitle {
    margin: 0;
    font-size: .77rem;
    color: #6b7280;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.qcm-meta { display: none; }

/* ── Footer ── */
.qcm-footer {
    display: flex;
    flex-direction: column;
    background: #fafbfe;
    border-top: 1px solid #f1f5f9;
}
.qcm-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 13px;
}
/* QCM meta (XP max + temps alloué) — rangée d'infos au-dessus des actions */
.qcm-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 9px 13px 0;
}
.qcm-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .76rem;
    font-weight: 600;
    color: #475569;
}
.qcm-meta-item i { font-size: .8rem; }
.qcm-meta-item.xp i   { color: #f59e0b; }
.qcm-meta-item.time i { color: #4a6cf7; }
body.dark-mode .qcm-meta-item { color: rgba(255,255,255,.8); }

/* "En savoir plus" : CTA principal de la card (retour pilote : doit ressortir) */
.btn-details {
    display: block;
    text-align: center;
    font-size: .85rem;
    font-weight: 700;
    color: #fff;
    background: #4a6cf7;
    text-decoration: none;
    padding: 11px 13px;
    margin: 10px 13px 13px;
    border-radius: 9px;
    transition: background .15s, transform .15s, box-shadow .15s;
    letter-spacing: .2px;
}
.btn-details:hover {
    color: #fff;
    background: #3d5dd6;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74,108,247,.3);
}
.price-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .88rem;
    font-weight: 800;
    color: #1e40af;
}
.price-badge i { font-size: .75rem; color: #f59e0b; }
.qcm-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.qcm-actions .btn-cart {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: none;
    background: #16a34a;
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    transform: none;
    position: static;
    white-space: nowrap;
}
.qcm-actions .btn-cart:hover {
    background: #15803d;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22,163,74,.3);
}
.btn-buy {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 7px;
    border: none;
    background: #4a6cf7;
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.btn-buy:hover { background: #3d5dd6; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(74,108,247,.3); }
.btn-buy.disabled, .btn-buy:disabled { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.qcm-actions .btn-cart.disabled, .qcm-actions .btn-cart:disabled { opacity: .55; cursor: not-allowed; }
.btn-assign {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    border-radius: 7px;
    background: #0d9488;
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    text-decoration: none;
    transition: all .15s;
    white-space: nowrap;
}
.btn-assign:hover { background: #0f766e; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13,148,136,.3); text-decoration: none; }

/* Bouton panier dans le header marketplace */
.mp-header-cart-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
    white-space: nowrap;
}
.mp-header-cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    border-radius: 9999px;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    line-height: 1;
}

.qcm-card-footer,.qcm-footer-left,.qcm-avatar,.qcm-footer-meta,.qcm-footer-name,.qcm-footer-date { display: none; }

.qcm-card-footer {
    padding: 1rem;
    border-top: 1px solid rgba(15,23,42,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: transparent;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.qcm-footer-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
}

.qcm-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(102,126,234,0.18);
    border: 1px solid rgba(102,126,234,0.25);
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(47, 128, 237, 0.15);
    border: 1px solid rgba(47, 128, 237, 0.20);
}

.qcm-footer-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.qcm-footer-name {
    font-weight: 800;
    font-size: 0.86rem;
    color: rgba(15,23,42,0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    font-weight: 800;
    color: #1f2937;
}

.qcm-footer-date {
    font-size: 0.78rem;
    color: rgba(15,23,42,0.55);
    font-size: 0.78rem;
    color: #666;
}

.qcm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: center;
    gap: 12px;
}

/* legacy overrides */
.qcm-card .btn { all: unset; }

/* Boutons */
.btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn i {
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid transparent;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd9 0%, #6a4192 100%);
}

.btn-success {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    border: 2px solid transparent;
}

.btn-success:hover {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
}

.btn-outline-primary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    box-shadow: none;
}

.btn-outline-primary:hover {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.25);
}

.btn-outline-secondary {
    background: white;
    color: #6c757d;
    border: 2px solid #dee2e6;
    box-shadow: none;
}

.btn-outline-secondary:hover {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.25);
}

/* Style pour le bouton désactivé */
.btn.disabled, .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn.disabled:hover, .btn:disabled:hover {
    transform: none !important;
}

/* État vide */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #dee2e6;
}

.mb-3 {
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .reports-dashboard {
        padding: 1rem;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-icon {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .search-container {
        flex-direction: column;
        width: 100%;
    }
    
    .search-input, .sort-select, .btn {
        width: 100%;
    }
    
    /* Cartes QCM en mode mobile */
    .qcm-grid {
        padding: 15px;
        gap: 15px;
    }
    
    .qcm-card {
        flex-direction: column;
        min-height: auto;
    }
    
    .qcm-card:hover {
        transform: translateY(-3px);
        transform: translateX(0);
    }
    
    .qcm-card-accent {
        width: 100%;
        height: 6px;
    }
    
    .qcm-cover { height: 145px; }
    
    .qcm-header h3 {
        font-size: 1.1rem;
    }
    
    .qcm-header {
        padding: 15px;
    }
    
    .qcm-body {
        padding: 15px;
    }
    
    .qcm-footer {
        padding: 15px;
    }
    
    .qcm-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .qcm-actions .btn {
        width: 100%;
    }
    
    /* Amélioration des badges sur mobile */
    .stat-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
        gap: 0.4rem;
    }
    
    .stat-badge i {
        font-size: 0.9rem;
    }
    
    .stat-badge strong {
        font-size: 1rem;
    }
    
    /* Grille de statistiques responsive */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Boutons en mode mobile */
    .btn {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
}
