/* ===== Layout principal ===== */
#asset-library-wrapper {
  display: flex;
  gap: 1.5rem;
  min-height: 60vh;
}

#asset-sidebar {
  width: 250px;
  flex-shrink: 0;
}

.sidebar-inner {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e9ecef;
}

.sidebar-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.sidebar-label {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: #495057;
}

.filter-cb {
  display: block;
  font-size: 0.85rem;
  padding: 2px 0;
  cursor: pointer;
}

.filter-cb input {
  margin-right: 6px;
}

#asset-main {
  flex: 1;
  min-width: 0;
}

/* ===== Toolbar ===== */
#asset-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

#asset-search {
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}

#asset-sort {
  width: auto;
}

#asset-counter-bar {
  margin-bottom: 0.75rem;
}

#asset-counter {
  font-size: 0.88rem;
  color: #6c757d;
}

/* ===== Grille de cartes ===== */
#asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

/* ===== Cartes ===== */
.asset-card {
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid #dee2e6;
  border-radius: 8px;
}

.asset-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.asset-card.card-hidden {
  display: none !important;
}

.card-img-wrapper {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-img-wrapper a {
  display: block;
  width: 100%;
  height: 100%;
}

.card-img-wrapper a img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}

.card-meta {
  font-size: 0.78rem;
}

/* ===== Badge catégorie ===== */
.badge-categorie {
  display: inline-block;
  background: #e7f1ff;
  color: #0d6efd;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 0.25rem;
}

/* ===== Badges domaines ===== */
.domain-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0.25rem;
}

.badge-domain {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
}

.badge-domain:empty {
  display: none;
}

.badge-global {
  background: #d4edda;
  color: #155724;
}

.badge-sante {
  background: #f8d7da;
  color: #721c24;
}

.badge-tee {
  background: #d1ecf1;
  color: #0c5460;
}

.badge-innovation {
  background: #fff3cd;
  color: #856404;
}

/* ===== Footer de carte ===== */
.card-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

/* ===== Masquer les controles natifs Moodle ===== */
.datapreferences {
  display: none !important;
}

.data-paging {
  display: none !important;
}

.urlselect {
  display: none !important;
}

/* ===== Animation filtrage ===== */
@keyframes cardFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.asset-card.card-visible {
  animation: cardFadeIn 0.2s ease;
}

/* ===== Couleurs categories ===== */
.badge-cat-360 { background: #e8daef; color: #6c3483; }
.badge-cat-electricite { background: #fdebd0; color: #b9770e; }
.badge-cat-environment { background: #d5f5e3; color: #1e8449; }
.badge-cat-interface { background: #d6eaf8; color: #2471a3; }
.badge-cat-manuel { background: #f2d7d5; color: #943126; }
.badge-cat-mobilier { background: #e7f1ff; color: #0d6efd; }
.badge-cat-objet { background: #fce4ec; color: #c2185b; }
.badge-cat-personnage { background: #fff9c4; color: #f57f17; }
.badge-cat-securite { background: #ffccbc; color: #bf360c; }

/* ===== Responsive ===== */
@media (max-width: 991px) {
  #asset-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    z-index: 1050;
    background: #fff;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    padding: 1rem;
  }

  #asset-sidebar.show {
    display: block;
  }

  .sidebar-inner {
    position: static;
    max-height: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
  }

  #asset-library-wrapper {
    flex-direction: column;
  }
}

@media (min-width: 992px) {
  #sidebar-toggle {
    display: none !important;
  }
}

/* ===== Alignement présentation Catalogue ===== */

/* Titre de la page centré */
.page-header-headings h2,
.page-header-headings h1 {
  text-align: center;
  width: 100%;
}

/* Masquer le drawer Course Index (fallback CSS) */
#theme_boost-drawers-courseindex {
  display: none !important;
}

/* Masquer le bouton toggle du drawer */
[data-toggler="drawers"][data-target="theme_boost-drawers-courseindex"] {
  display: none !important;
}

/* Masquer l'activity header (conditions d'achèvement) */
.activity-header {
  display: none !important;
}

/* Masquer le fil d'Ariane */
.breadcrumb {
  display: none !important;
}

/* Supprimer la marge gauche causée par show-drawer-left */
#page.drawers.show-drawer-left {
  margin-left: 0 !important;
}