/* ============================================================================
 * Dashboard /enseignant/ — Mes activités
 * Toolbar de filtres + tri + vue (grille / liste)
 * ============================================================================ */

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 16px 0 20px;
    flex-wrap: wrap;
}
.dashboard-header h2 {
    color: var(--text);
    margin: 0;
}

/* Toolbar */
.dashboard-toolbar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 20px;
}
.dashboard-toolbar.hidden { display: none; }

.dashboard-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.dashboard-filters .filter-search {
    flex: 1 1 240px;
    min-width: 200px;
}
.dashboard-filters input,
.dashboard-filters select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--white);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.dashboard-filters select { cursor: pointer; }
.dashboard-filters input:focus,
.dashboard-filters select:focus {
    outline: 2px solid var(--primary-dark);
    outline-offset: 1px;
}

.dashboard-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.dashboard-count {
    color: var(--text-light);
    font-size: 14px;
}
.dashboard-tools-right {
    display: flex;
    gap: 10px;
    align-items: center;
}
.dashboard-tools-right select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    background: var(--white);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
}

.view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    overflow: hidden;
}
.view-btn {
    background: var(--white);
    border: none;
    padding: 6px 10px;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-light);
    min-width: 36px;
    transition: background 0.15s ease;
}
.view-btn:hover { background: var(--secondary); }
.view-btn.is-active { background: var(--primary-light); color: var(--text); }
.view-btn + .view-btn { border-left: 1px solid var(--border); }

/* État vide */
.dashboard-empty-search {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    background: var(--white);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

/* ============================================================================
 * Vue GRILLE — cards
 * ============================================================================ */

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

.activite-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.activite-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow);
    border-color: var(--primary-dark);
}
.activite-card-titre {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    line-height: 1.3;
    /* Truncate à 2 lignes */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.activite-card-objectif {
    color: var(--text-light);
    font-size: 13px;
    line-height: 1.4;
    /* Truncate 2 lignes */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
}
.activite-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-light);
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* ============================================================================
 * Vue LISTE — lignes compactes
 * ============================================================================ */

.activites-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.activite-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s ease, border-color 0.15s ease;
}
.activite-row:hover {
    background: var(--secondary);
    border-color: var(--primary-dark);
}
.activite-row-titre {
    flex: 1 1 auto;
    font-weight: 600;
    color: var(--text);
    /* Truncate 1 ligne */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.activite-row-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.activite-row-date {
    color: var(--text-light);
    font-size: 12px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ============================================================================
 * Badges (réutilisés dans les 2 vues)
 * ============================================================================ */

.activite-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.activite-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--secondary);
    color: var(--text);
    line-height: 1.4;
    white-space: nowrap;
}
.activite-badge.is-cycle { background: #BBDEFB; color: #0D47A1; }
.activite-badge.is-niveau { background: #C5CAE9; color: #1A237E; text-transform: none; }
.activite-badge.is-type-ecrit { background: #B2DFDB; color: #00695C; }
.activite-badge.is-type-oral { background: #FFE0B2; color: #E65100; }
.activite-badge.is-type-mixte { background: #D1C4E9; color: #311B92; }
.activite-badge.is-publie { background: var(--success-bg); color: #1B5E20; }
.activite-badge.is-brouillon { background: var(--secondary); color: var(--text-light); }
.activite-badge.is-biblio { background: var(--primary-light); color: var(--text); }

/* ============================================================================
 * Boutons d'actions inline sur cards (style lego3 — tous visibles)
 * ============================================================================ */

.activite-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
/* En vue liste : actions à droite, sans border-top */
.activite-row .activite-actions {
    margin: 0;
    padding: 0;
    border-top: none;
    flex-shrink: 0;
}

.activite-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    cursor: pointer;
    padding: 6px 10px;
    color: var(--text);
    font-size: 16px;
    line-height: 1;
    text-decoration: none;
    min-width: 36px;
    min-height: 36px;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.activite-action-btn:hover:not(:disabled):not(.is-disabled) {
    background: var(--secondary);
    border-color: var(--primary-dark);
}
.activite-action-btn:active:not(:disabled):not(.is-disabled) {
    transform: scale(0.95);
}
.activite-action-btn:disabled,
.activite-action-btn.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.activite-action-btn.is-danger:hover:not(:disabled):not(.is-disabled) {
    background: var(--error-bg);
    border-color: var(--error);
}
.activite-action-btn.is-biblio {
    background: var(--primary-light);
    border-color: var(--primary-dark);
}
.activite-action-btn.is-success-flash {
    background: var(--success-bg);
    border-color: var(--success);
    color: var(--success);
}


/* ============================================================================
 * Modale de confirmation suppression
 * ============================================================================ */

.modal-supprimer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-supprimer.hidden { display: none; }
.modal-supprimer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.modal-supprimer-box {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px 28px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.modal-supprimer-box h3 {
    color: var(--text);
    margin: 0 0 12px;
}
.modal-supprimer-box p {
    color: var(--text);
    line-height: 1.5;
    margin: 8px 0;
}
.modal-supprimer-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
    flex-wrap: wrap;
}
.btn-danger {
    background: var(--error);
    color: var(--white);
    border: 1px solid var(--error);
    padding: 8px 16px;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
}
.btn-danger:hover { filter: brightness(0.92); }
.btn-danger:disabled { opacity: 0.6; cursor: not-allowed; }


/* ============================================================================
 * Responsive
 * ============================================================================ */

@media (max-width: 600px) {
    .dashboard-filters { flex-direction: column; align-items: stretch; }
    .dashboard-filters .filter-search { flex: none; }
    .dashboard-tools { flex-direction: column; align-items: stretch; }
    .dashboard-tools-right { justify-content: space-between; }
    .activites-grid { grid-template-columns: 1fr; }
    .activite-row { flex-wrap: wrap; }
    .activite-row-date { width: 100%; text-align: right; }
}
