/**
 * Styles Corpus
 */

/* Bouton retour Mes corpus */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-light, #f5f5f5);
    color: var(--text, #333);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color, #ddd);
}

.back-link:hover {
    background: var(--primary, #4a7c59);
    color: white;
    border-color: var(--primary, #4a7c59);
}

/* Container */
.corpus-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Actions */
.corpus-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

/* Description */
.corpus-description {
    background: var(--bg-light, #f5f5f5);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    color: var(--text-secondary, #666);
    font-size: 0.95rem;
}

.corpus-description small {
    color: var(--text-muted, #888);
}

/* Onglets */
.corpus-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Filtres */
.corpus-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    min-width: 150px;
}

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

/* Carte corpus */
.corpus-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color, #eee);
}

.corpus-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.corpus-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: var(--text-primary, #333);
}

.corpus-card .corpus-desc {
    margin: 0 0 1rem 0;
    color: var(--text-secondary, #666);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Badges */
.corpus-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.corpus-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-niveau {
    background: var(--primary-light, #e8f5e9);
    color: var(--primary-color, #4a7c59);
}

.badge-periode {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-classe {
    background: #fff3e0;
    color: #e65100;
}

/* Meta */
.corpus-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
    margin-bottom: 1rem;
    align-items: center;
}

.corpus-author {
    font-style: italic;
}

/* Actions */
.corpus-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Formulaire création */
.creer-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 1rem;
}

.form-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.form-section h2 {
    margin: 0 0 1.5rem 0;
    font-size: 1.3rem;
    color: var(--text-primary, #333);
    border-bottom: 2px solid var(--primary-color, #4a7c59);
    padding-bottom: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary, #333);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color, #4a7c59);
    box-shadow: 0 0 0 3px var(--primary-light, rgba(74, 124, 89, 0.1));
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group .hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
}

/* Section séries */
.series-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.series-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color, #eee);
    border-radius: 8px;
}

.series-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color, #eee);
    cursor: pointer;
    transition: background 0.2s;
}

.series-item:last-child {
    border-bottom: none;
}

.series-item:hover {
    background: var(--bg-hover, #f9f9f9);
}

.series-item.selected {
    background: var(--primary-light, #e8f5e9);
}

.series-item input[type="checkbox"] {
    margin-right: 0.75rem;
}

.series-item-info {
    flex: 1;
}

.series-item-title {
    font-weight: 500;
}

.series-item-meta {
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
}

.series-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary, #888);
}

/* Actions finales */
.form-actions-final {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
}

/* ========================================
   Guide programmes
   ======================================== */
.guide-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
}

.guide-section h2 {
    color: #0369a1;
    border-bottom-color: #0ea5e9;
}

.guide-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.guide-badge {
    background: #0ea5e9;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.guide-niveau {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0369a1;
}

.guide-message {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    line-height: 1.6;
    border-left: 4px solid #0ea5e9;
}

.guide-message strong {
    color: #0369a1;
}

.guide-infos {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.guide-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.guide-info-icon {
    font-size: 1.2rem;
}

.guide-composition,
.guide-relations {
    margin-top: 1rem;
}

.guide-composition h4,
.guide-relations h4 {
    font-size: 0.9rem;
    color: #0369a1;
    margin: 0 0 0.5rem 0;
}

.guide-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.guide-tag {
    background: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid #bae6fd;
    color: #0369a1;
}

.guide-tag.relation {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

/* ========================================
   Suggestions de thèmes
   ======================================== */
.suggestions-section {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 1px solid #fde047;
}

.suggestions-section h3 {
    color: #a16207;
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.themes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.theme-suggestion {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #fde047;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.theme-suggestion:hover {
    background: #fefce8;
    border-color: #facc15;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(250, 204, 21, 0.3);
}

.theme-title {
    font-weight: 600;
    color: #a16207;
    margin-bottom: 0.25rem;
}

.theme-desc {
    font-size: 0.8rem;
    color: #78716c;
    line-height: 1.3;
}

.empty-themes {
    text-align: center;
    color: #a16207;
    padding: 1rem;
}

/* ========================================
   Indicateur de conformité
   ======================================== */
.conformite-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.conformite-badge.high {
    background: #dcfce7;
    color: #166534;
}

.conformite-badge.medium {
    background: #fef3c7;
    color: #92400e;
}

.conformite-badge.low {
    background: #fee2e2;
    color: #991b1b;
}

.conformite-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.conformite-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.conformite-bar-fill.high {
    background: #22c55e;
}

.conformite-bar-fill.medium {
    background: #f59e0b;
}

.conformite-bar-fill.low {
    background: #ef4444;
}

/* Conformité sur les cartes */
.corpus-conformite {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary, #666);
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: var(--bg-light, #f9fafb);
    border-radius: 6px;
}

.corpus-conformite span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* ========================================
   Corpus modèles
   ======================================== */
.modele-card {
    border: 2px solid var(--primary-color, #4a7c59);
    position: relative;
}

.modele-badge-container {
    position: absolute;
    top: -10px;
    right: 15px;
}

.modele-badge {
    background: var(--primary-color, #4a7c59);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-cycle {
    background: #f3e8ff;
    color: #7c3aed;
}

.modele-themes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.modele-theme {
    background: var(--bg-light, #f5f5f5);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary, #666);
}

.modele-mots {
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    margin-bottom: 1rem;
    font-style: italic;
}

.modele-mots strong {
    color: var(--text-primary, #333);
    font-style: normal;
}

/* Modal large */
.modal-large {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modele-details-header {
    margin-bottom: 1.5rem;
}

.modele-details-header h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color, #4a7c59);
}

.modele-details-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color, #eee);
}

.modele-details-section:last-of-type {
    border-bottom: none;
}

.modele-details-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: var(--text-primary, #333);
}

.modele-details-section ul {
    margin: 0;
    padding-left: 1.5rem;
}

.modele-details-section li {
    margin-bottom: 0.25rem;
}

.composition-categorie {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.composition-categorie strong {
    text-transform: capitalize;
    color: var(--primary-color, #4a7c59);
}

.guide-section-mini {
    background: #f0f9ff;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #0ea5e9;
}

.guide-section-mini h4 {
    color: #0369a1;
}

.guide-section-mini p {
    margin: 0;
    line-height: 1.5;
}

/* ========================================
   Bandeau info modèle
   ======================================== */
.modele-info-banner {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #6ee7b7;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.modele-info-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.modele-info-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.modele-info-text {
    flex: 1;
}

.modele-info-text strong {
    display: block;
    color: #065f46;
    margin-bottom: 0.25rem;
}

.modele-info-text p {
    margin: 0;
    font-size: 0.9rem;
    color: #047857;
}

.modele-info-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #065f46;
    padding: 0;
    line-height: 1;
}

.modele-info-close:hover {
    color: #064e3b;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .corpus-filters {
        flex-direction: column;
    }

    .filter-select {
        width: 100%;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .guide-infos {
        flex-direction: column;
    }

    .themes-list {
        grid-template-columns: 1fr;
    }

    .modal-large {
        max-width: 95%;
        margin: 1rem;
    }
}
