/* ===========================================
   Activités - Hub des activités pédagogiques
   =========================================== */

/* Layout principal */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: var(--white);
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.4rem;
    color: var(--text);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name {
    font-weight: 500;
    color: var(--text);
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--radius-small);
    color: var(--text-light);
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Barre d'outils */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: var(--background);
    flex-wrap: wrap;
    gap: 15px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Tabs */
.content-tabs {
    display: flex;
    gap: 5px;
    background: var(--white);
    padding: 5px;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px var(--shadow);
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
}

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

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

/* Filtres */
.filter-type select,
.filter-format select,
.filter-groupby select,
.filter-auteur select {
    padding: 10px 16px;
    background: var(--white);
    border: 1px solid #ddd;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    transition: all 0.2s;
}

.filter-type select:hover,
.filter-format select:hover,
.filter-groupby select:hover,
.filter-auteur select:hover {
    background: var(--background);
    border-color: var(--primary);
}

.filter-type select:focus,
.filter-format select:focus,
.filter-groupby select:focus,
.filter-auteur select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Bouton créer */
.btn-create {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

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

/* Zone principale */
.main-content {
    flex: 1;
    padding: 25px;
    padding-bottom: 60px;
}

/* Loading */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* État vide */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text);
}

.empty-state p {
    margin-bottom: 20px;
}

/* Grille d'activités */
.activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Carte d'activité */
.activity-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.activity-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px var(--shadow);
}

.activity-card.highlight {
    animation: highlightCard 2s ease-out;
}

@keyframes highlightCard {
    0% {
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.6);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 2px 8px var(--shadow);
        transform: scale(1);
    }
}

.activity-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.activity-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.activity-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.activity-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.3;
    /* Permettre 2 lignes max */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.activity-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 500;
}

.badge-type {
    background: var(--secondary);
    color: var(--text);
}

.badge-format-online {
    background: #dbeafe;
    color: #1e40af;
}

.badge-format-print {
    background: #fef3c7;
    color: #92400e;
}

.badge-format-both {
    background: #d1fae5;
    color: #065f46;
}

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

.badge-private {
    background: #ECEFF1;
    color: #607D8B;
}

/* Bouton de visibilité cliquable */
.btn-visibility {
    cursor: pointer;
    border: none;
    transition: background 0.2s, color 0.2s;
    font-size: 0.75rem;
    padding: 3px 8px;
    line-height: 1;
    vertical-align: middle;
    min-width: 60px;
    text-align: center;
    border-radius: 10px;
}

.btn-visibility.badge-private:hover {
    background: #dcfce7;
    color: #166534;
}

.btn-visibility.badge-public:hover {
    background: #ECEFF1;
    color: #607D8B;
}

.activity-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.meta-tag {
    font-size: 0.8rem;
    color: var(--text-light);
    background: var(--background);
    padding: 3px 10px;
    border-radius: 15px;
}

.activity-date {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 10px;
}

.activity-author {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.activity-author a {
    color: var(--primary-dark);
    text-decoration: none;
    cursor: pointer;
}

.activity-author a:hover {
    text-decoration: underline;
}

.activity-objective {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 10px;
    font-style: italic;
}

.activity-consigne {
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 15px;
    flex: 1;
}

.activity-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.btn-action {
    flex: 1 1 auto;
    min-width: fit-content;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: var(--white);
    border-radius: var(--radius-small);
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text);
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
    text-align: center;
}

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

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

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

.btn-action.danger {
    color: #dc2626;
    border-color: #dc2626;
}

.btn-action.danger:hover {
    background: #fef2f2;
}

/* Groupes d'activités (par série) */
.activities-group {
    margin-bottom: 30px;
}

.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.group-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.group-title {
    font-size: 1.2rem;
    color: var(--text);
    font-weight: 600;
    margin: 0;
}

.serie-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.serie-link {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    padding: 4px 10px;
    background: var(--secondary);
    border-radius: 15px;
    transition: background 0.2s, color 0.2s;
}

.serie-link:hover {
    background: var(--primary);
    color: white;
}

.serie-link-primary {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 6px 14px;
    background: var(--primary);
    color: white;
}

.serie-link-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.group-count {
    background: var(--primary);
    color: var(--text);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
}

/* Séparateur entre groupes */
.activities-group + .activities-group {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e0e0e0;
}

/* ===========================================
   Accordéon pour les groupes d'activités
   =========================================== */

.accordion-group {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 15px;
    overflow: hidden;
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--secondary) 0%, #f0f4f8 100%);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    border-bottom: 2px solid transparent;
}

.accordion-header:hover {
    background: linear-gradient(135deg, #e8ecf0 0%, #dde3e9 100%);
}

.accordion-group.open .accordion-header {
    background: linear-gradient(135deg, var(--primary) 0%, #5a8f6a 100%);
    border-bottom-color: var(--primary-dark);
}

.accordion-group.open .accordion-header .accordion-title,
.accordion-group.open .accordion-header .accordion-emoji,
.accordion-group.open .accordion-header .accordion-icon {
    color: white;
}

.accordion-group.open .accordion-header .accordion-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.accordion-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.accordion-icon {
    font-size: 0.75rem;
    color: var(--text-light);
    transition: transform 0.3s ease;
}

.accordion-group.open .accordion-icon {
    transform: rotate(90deg);
}

.accordion-emoji {
    font-size: 1.4rem;
}

.accordion-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.accordion-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.accordion-count {
    background: var(--primary);
    color: white;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.accordion-link {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    padding: 6px 12px;
    background: white;
    border-radius: 15px;
    transition: all 0.2s;
}

.accordion-link:hover {
    background: var(--primary);
    color: white;
}

.accordion-group.open .accordion-link {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary);
}

.accordion-group.open .accordion-link:hover {
    background: white;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 20px;
}

.accordion-group.open .accordion-content {
    max-height: 2000px;
    padding: 20px;
    transition: max-height 0.5s ease-in, padding 0.3s ease-in;
}

/* Responsive accordéon */
@media (max-width: 768px) {
    .accordion-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 15px;
    }

    .accordion-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .accordion-title {
        font-size: 1rem;
    }
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

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

/* Responsive - Tablettes */
@media (max-width: 1024px) {
    .toolbar-left {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        justify-content: center;
    }

    .content-tabs {
        width: 100%;
        justify-content: center;
    }

    .filter-type,
    .filter-format,
    .filter-auteur {
        width: 100%;
    }

    .filter-type select,
    .filter-format select,
    .filter-auteur select {
        width: 100%;
    }

    .btn-create {
        width: 100%;
        justify-content: center;
    }

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

    .main-content {
        padding: 15px;
    }

    .activity-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    .btn-action {
        flex: 1 1 auto;
        min-width: fit-content;
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .header-actions {
        gap: 10px;
    }

    .activity-title {
        font-size: 1.05rem;
    }

    .activity-badges {
        flex-wrap: wrap;
    }
}

/* ===========================================
   Modal signalement
   =========================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white, #fff);
    padding: 2rem;
    border-radius: var(--radius, 8px);
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin: 0 0 1rem;
    color: var(--text, #333);
}

.modal-content p {
    color: var(--text-light, #666);
    margin-bottom: 0.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

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

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

.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border, #ddd);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
}

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

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