/**
 * Ressources de série - Styles
 */

/* Header */
.ressources-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
}

.ressources-header .header-center {
    flex: 1;
    text-align: center;
}

.ressources-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.back-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.back-link:hover {
    color: var(--primary);
}

.btn-share {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-share:hover {
    background: var(--primary-dark);
}

/* Share menu dropdown */
.share-container {
    position: relative;
}

.share-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 100;
    overflow: hidden;
}

.share-menu.hidden {
    display: none;
}

.share-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.share-option:hover {
    background: var(--background);
}

.share-option:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.share-icon {
    font-size: 1.1rem;
}

/* Content */
.ressources-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Serie info */
.serie-info {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px var(--shadow);
    text-align: center;
}

.serie-title {
    font-size: 1.8rem;
    margin: 0 0 0.5rem;
    color: var(--primary);
}

.serie-description {
    color: var(--text-light);
    margin: 0 0 1rem;
}

.serie-meta {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.meta-badge {
    background: var(--background);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text);
}

.meta-badge.theme {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.meta-badge.author {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

/* Download buttons */
.download-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.btn-download {
    background: var(--white);
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-download:hover {
    background: var(--primary);
    color: white;
}

.btn-download:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Sections */
.ressources-section {
    margin-bottom: 2rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.section-icon {
    font-size: 1.5rem;
    color: var(--ill-orange, #E8703D);
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.section-icon svg,
.section-icon i[data-lucide] {
    width: 22px;
    height: 22px;
    stroke-width: 1.6;
}

.section-count {
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-weight: normal;
}

/* Grid */
.ressources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Cards */
.ressource-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ressource-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px var(--shadow);
}

.ressource-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ressource-card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    color: var(--ill-orange, #E8703D);
    display: inline-flex;
    align-items: center;
}

.ressource-card-icon svg,
.ressource-card-icon i[data-lucide] {
    width: 24px;
    height: 24px;
    stroke-width: 1.6;
}

.ressource-badge svg,
.ressource-badge i[data-lucide] {
    width: 12px;
    height: 12px;
    stroke-width: 2;
    vertical-align: middle;
    margin-right: 2px;
}

.error-state .error-icon {
    color: var(--text-light, #999);
    display: flex;
    justify-content: center;
    font-size: 4rem;
}

.error-state .error-icon svg,
.error-state .error-icon i[data-lucide] {
    width: 56px;
    height: 56px;
    stroke-width: 1.5;
}

.empty-resources .empty-icon svg,
.empty-resources .empty-icon i[data-lucide] {
    width: 56px;
    height: 56px;
    stroke-width: 1.5;
}

.ressource-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    flex: 1;
}

.ressource-card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.ressource-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--background);
    color: var(--text-light);
}

.ressource-badge.type-memory { background: #e3f2fd; color: #1565c0; }
.ressource-badge.type-qcm { background: #f3e5f5; color: #7b1fa2; }
.ressource-badge.type-defi { background: #fff3e0; color: #e65100; }
.ressource-badge.type-dictee { background: #e8f5e9; color: #2e7d32; }
.ressource-badge.type-prononciation { background: #fce4ec; color: #c2185b; }
.ressource-badge.type-complete { background: #e0f7fa; color: #00838f; }
.ressource-badge.type-familles { background: #f1f8e9; color: #558b2f; }
.ressource-badge.owner { background: #fff8e1; color: #f57c00; border: 1px solid #ffe082; }

.ressource-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ressource-card-actions .btn-action {
    flex: 1;
    min-width: 60px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    text-align: center;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.ressource-card-actions .btn-action:hover {
    background: var(--border);
}

.ressource-card-actions .btn-action.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.ressource-card-actions .btn-action.primary:hover {
    background: var(--primary-dark);
}

/* Aperçu grille */
.apercu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.apercu-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.apercu-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.apercu-card-text {
    text-align: center;
    font-weight: 600;
    padding: 0.5rem 0.4rem;
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apercu-no-image {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    font-size: 2.5rem;
    color: var(--text-light);
}

/* Empty state */
.empty-resources {
    text-align: center;
    padding: 3rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.empty-resources .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-resources h3 {
    margin: 0 0 0.5rem;
    color: var(--text);
}

.empty-resources p {
    color: var(--text-light);
    margin: 0;
}

/* Error state */
.error-state {
    text-align: center;
    padding: 4rem 2rem;
}

.error-state .error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-state h2 {
    margin: 0 0 0.5rem;
}

.error-state p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* Loading */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Modal sélection PDF */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-small);
}

.btn-close:hover {
    background: var(--background);
    color: var(--text);
}

.modal-body {
    padding: 1rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--background);
    border-radius: 0 0 var(--radius) var(--radius);
}

.modal-footer .selected-count {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* PDF sections */
.pdf-section {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.pdf-section-header {
    background: var(--background);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.pdf-section-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 600;
}

.pdf-section-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.pdf-count {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: normal;
}

.pdf-items-list {
    padding: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.pdf-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-small);
    cursor: pointer;
    background: var(--white);
    border: 1px solid transparent;
    transition: all 0.15s;
}

.pdf-item:hover {
    background: var(--background);
}

.pdf-item.dragging {
    opacity: 0.5;
    border: 1px dashed var(--primary);
}

.pdf-item.drag-over {
    border-top: 2px solid var(--primary);
}

.pdf-item-drag {
    cursor: grab;
    color: var(--text-light);
    font-size: 1rem;
    padding: 0 0.25rem;
    user-select: none;
}

.pdf-item-drag:active {
    cursor: grabbing;
}

.pdf-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.pdf-item-title {
    flex: 1;
    font-size: 0.9rem;
}

.pdf-item-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

.pdf-item-order {
    font-size: 0.7rem;
    color: var(--text-light);
    background: var(--background);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    min-width: 20px;
    text-align: center;
}

.pdf-empty {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-small);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--background);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   BATCH ACTIVITÉS
   ============================================ */

.batch-btn-container {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.batch-btn {
    background: var(--primary);
    color: white;
    border: 2px solid var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.batch-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.batch-modal-content {
    max-width: 700px;
}

/* Paramètres globaux */
.batch-global {
    background: var(--background);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.batch-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.batch-field textarea,
.batch-field select,
.batch-field input[type="text"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.batch-field textarea:focus,
.batch-field select:focus,
.batch-field input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* Sélectionner tout */
.batch-select-all {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.batch-select-all label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.batch-select-all input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Liste des activités */
.batch-activities-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.batch-warnings {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #856404;
}

.batch-activity-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--white);
}

.batch-activity-item.batch-activity-disabled {
    opacity: 0.5;
}

.batch-activity-warn {
    padding: 4px 16px 8px;
    font-size: 0.8rem;
    color: #b45309;
}

.batch-activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--background);
}

.batch-activity-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    flex: 1;
}

.batch-activity-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.batch-activity-icon {
    font-size: 1.2rem;
}

.batch-activity-type {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.batch-activity-num {
    font-size: 0.75rem;
    background: var(--primary);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.batch-toggle-detail {
    background: none;
    border: none;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-small);
}

.batch-toggle-detail:hover {
    background: var(--border);
    color: var(--text);
}

/* Ligne titre */
.batch-activity-title-row {
    padding: 0.5rem 0.75rem;
}

.batch-titre-input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    font-size: 0.9rem;
    box-sizing: border-box;
}

.batch-titre-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* Détails dépliables */
.batch-activity-detail {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--white);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.batch-activity-detail.hidden {
    display: none;
}

.batch-note {
    font-size: 0.8rem;
    color: var(--text-light);
    font-style: italic;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .ressources-header {
        padding: 1rem;
    }

    .ressources-header h1 {
        font-size: 1.2rem;
    }

    .ressources-content {
        padding: 1rem;
    }

    .serie-info {
        padding: 1rem;
    }

    .serie-title {
        font-size: 1.4rem;
    }

    .ressources-grid {
        grid-template-columns: 1fr;
    }

    .apercu-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }

    /* Modal responsive */
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    .modal-footer .selected-count {
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1;
    }
}
