/* ===========================================
   Cahiers multimédias — liste des cahiers
   (barre d'outils et états vides : ressources/ressources.css)
   =========================================== */

/* Choix de la présentation */
.cah-vues {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    overflow: hidden;
}

.cah-vue {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.8rem;
    border: 0;
    background: var(--white);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.cah-vue + .cah-vue { border-left: 1px solid var(--border); }

.cah-vue[aria-pressed="true"] {
    background: var(--primary);
    color: #fff;
}

.cah-vue:focus-visible,
.cah-btn:focus-visible,
.cah-lien-serie:focus-visible {
    outline: 3px solid var(--primary-dark);
    outline-offset: 2px;
}

.cah-vue svg { width: 16px; height: 16px; }

/* Un cahier : mêmes morceaux, deux dispositions */
.cah-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    overflow: hidden;
}

.cah-titre {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.cah-corps {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}

.cah-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.cah-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
}

.cah-badge-moi { background: var(--primary-light); color: var(--text); }
.cah-badge-autre { background: var(--bg-sunken); color: var(--text-light); }

.cah-contenu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.cah-morceau {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.cah-morceau svg { width: 15px; height: 15px; }

.cah-image {
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-sunken);
}

.cah-sans-image {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.cah-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.cah-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.88rem;
    min-height: 40px;
    text-decoration: none;
    white-space: nowrap;
}

.cah-btn svg { width: 16px; height: 16px; }

.cah-lien-serie {
    font-size: 0.85rem;
    color: var(--primary-dark);
    white-space: nowrap;
}

/* --- Cartes --- */
.cah-cartes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.cah-cartes .cah-item { flex-direction: column; }
.cah-cartes .cah-image { width: 100%; height: 140px; }
.cah-cartes .cah-sans-image svg { width: 44px; height: 44px; }
.cah-cartes .cah-corps { padding: 0.9rem 1rem 0.4rem; flex: 1; }
.cah-cartes .cah-actions { padding: 0.5rem 1rem 1rem; }

/* --- Lignes --- */
.cah-lignes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cah-lignes .cah-item {
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1rem;
}

.cah-lignes .cah-image { width: 50px; height: 50px; border-radius: 6px; }
.cah-lignes .cah-sans-image svg { width: 22px; height: 22px; }
.cah-lignes .cah-corps { flex: 1; gap: 0.3rem; }
.cah-lignes .cah-actions { flex-wrap: nowrap; flex-shrink: 0; }

@media (max-width: 800px) {
    .cah-lignes .cah-item { flex-wrap: wrap; }
    .cah-lignes .cah-corps { flex: 1 1 calc(100% - 70px); }
    .cah-lignes .cah-actions { width: 100%; flex-wrap: wrap; }
    .cah-vue span { display: none; }
}

/* Message « lien copié » */
.cah-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: #1f2933;
    color: #fff;
    padding: 0.7rem 1.2rem;
    border-radius: 999px;
    font-size: 0.9rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    z-index: 1000;
}

.cah-toast.hidden { display: none; }
