/* ==========================================================================
   Espace Documentaire – Shortcode [documents]
   Classes CSS conservées à l'identique de SO Documents pour compatibilité
   avec le CSS existant du thème.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Conteneur global
   -------------------------------------------------------------------------- */
.so-documents {
	width: 100%;
	font-size: 14px;
}

/* --------------------------------------------------------------------------
   Barre de filtres
   -------------------------------------------------------------------------- */
.so-documents-filters {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
}

.so-documents-filters-left {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	flex: 1 1 auto;
}

.so-documents-filters > *,
.so-documents-filters-left > * {
	width: min-content !important;
}

.so-documents-filters select,
.so-documents-filters input {
	padding: 8px 12px;
	border: 1px solid #d5d5d5;
	border-radius: 4px;
	font-size: 14px;
	background-color: #fff;
}

.so-documents-filters select {
	appearance: none;
	-webkit-appearance: none;
	background-image: url("../../assets/arrow-select.svg");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 32px;
	cursor: pointer;
}

.so-documents-filter-search {
	flex-grow: 1;
	min-width: 200px;
}

/* --------------------------------------------------------------------------
   Toggle liste / grille
   -------------------------------------------------------------------------- */
.so-documents-view-toggle {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
}

.so-documents-toggle-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid #d5d5d5;
	border-radius: 4px;
	background: #fff;
	color: #888;
	cursor: pointer;
	padding: 0;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.so-documents-toggle-btn:hover {
	background: #f4f4f4;
	color: #333;
}

.so-documents-toggle-btn.is-active {
	background: #222;
	border-color: #222;
	color: #fff;
}

/* --------------------------------------------------------------------------
   Grille / conteneur Isotope
   .so-documents-grid : conteneur de l'en-tête + liste (conservé de l'original)
   .so-documents-list : conteneur des items Isotope
   -------------------------------------------------------------------------- */
.so-documents-grid {
	width: 100%;
}

.so-documents-list {
	width: 100%;
}

/* --------------------------------------------------------------------------
   En-tête de liste (visible uniquement en vue liste)
   -------------------------------------------------------------------------- */
.so-documents-header {
	font-weight: 600;
	border-bottom: 2px solid #222;
}

/* Masqué en vue grille */
.so-documents--grid .so-documents-header {
	display: none;
}

/* --------------------------------------------------------------------------
   Ligne générique (conservée de l'original)
   -------------------------------------------------------------------------- */
.so-documents-row {
	display: grid;
	grid-template-columns: 48px 2fr 1fr 80px 110px 100px;
	gap: 12px;
	align-items: center;
	padding: 12px 8px;
	width: 100%;
}

/* --------------------------------------------------------------------------
   VUE LISTE – so-document-item
   -------------------------------------------------------------------------- */

/* En vue grille, on cache la partie liste de chaque item
   et on annule le display:grid hérité de .so-documents-row */
.so-documents--grid .so-document-item {
	display: block;
	width: auto;
	border-bottom: none;
	padding: 0;
}

.so-document-item {
	border-bottom: 1px solid #e5e5e5;
	width: 100%;
}
.so-document-item a {
	text-decoration: none!important;
}

.so-document-item[style*="display: none"] {
	border-bottom: none;
}

/* Lien liste : reprend la grille de .so-documents-row */
.so-document-item-list {
	display: grid;
	grid-template-columns: 48px 2fr 1fr 80px 110px 100px;
	gap: 12px;
	align-items: center;
	padding: 12px 8px;
	width: 100%;
	color: inherit;
	transition: background 0.1s;
}

.so-document-item-list:hover {
	background: #f9f9f9;
}

/* Masqué en vue grille */
.so-documents--grid .so-document-item-list {
	display: none;
}

/* Icône SVG inline – vue liste */
.so-documents-col-thumb {
	display: flex;
	align-items: center;
	justify-content: center;
}

.so-documents-file-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 48px;
	flex-shrink: 0;
}

.so-documents-file-icon svg {
	width: 40px;
	height: 48px;
	display: block;
}

/* Icône SVG inline – vue grille (centrée dans la zone thumb) */
.so-documents-file-icon--card {
	width: 72px;
	height: 86px;
}

.so-documents-file-icon--card svg {
	width: 72px;
	height: 86px;
}

/* Titre + extrait */
.so-documents-item-title {
	display: block;
	font-weight: 600;
	color: #111;
}

.so-documents-item-excerpt {
	display: block;
	color: #666;
	font-size: 12px;
	margin-top: 2px;
	/* white-space: nowrap; */
	/* overflow: hidden; */
	text-overflow: ellipsis;
}

.so-documents-col-categories,
.so-documents-col-date {
	color: #555;
}

/* Bouton consulter (remplace le bouton télécharger de l'original) */
.so-documents-consult-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	text-decoration: none;
	color: #222;
	font-size: 14px;
	padding: 5px 10px;
	border: 1px solid #222;
	border-radius: 4px;
	white-space: nowrap;
}

/* Bouton télécharger (conservé pour compatibilité CSS thème) */
.so-documents-download-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	text-decoration: none;
	color: #222;
	font-size: 14px;
}

.so-documents-download-icon {
	width: 14px;
	height: 14px;
}

/* --------------------------------------------------------------------------
   VUE GRILLE – so-document-item-card
   -------------------------------------------------------------------------- */

/* Masquée en vue liste */
.so-document-item-card {
	display: none;
}

/* Activation en vue grille
   ─ Isotope est neutralisé : on force position:static sur le conteneur
     et les items pour que CSS Grid natif reprenne la main. ─ */
.so-documents--grid .so-documents-list {
	display: grid !important;
	grid-template-columns: repeat( var(--ed-grid-cols, 4), minmax( 0, 1fr ) );
	gap: 20px;
	/* Annule le positionnement relatif + hauteur calculée qu'Isotope impose */
	position: static !important;
	height: auto !important;
}

/* En vue grille, les items ne doivent PAS hériter du display:grid de .so-documents-row
   ni du positionnement absolu + left/top injecté par Isotope */
.so-documents--grid .so-document-item {
	display: flex !important;
	flex-direction: column;
	width: auto !important;
	padding: 0;
	border-bottom: none;
	position: static !important;
	transform: none !important;
}

.so-documents--grid .so-document-item-card {
	display: flex;
	flex-direction: column;
	border: 1px solid #e5e5e5;
	border-radius: 6px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: box-shadow 0.15s, transform 0.15s;
	flex: 1; /* remplit toute la hauteur de la cellule grille */
}

.so-documents--grid .so-document-item-card:hover {
	box-shadow: 0 4px 16px rgba(0,0,0,.10);
	transform: translateY(-2px);
}

/* Zone thumb carte – hauteur fixe identique pour toutes les cartes */
.so-documents-card-thumb {
	position: relative;
	width: 100%;
	height: 160px;
	overflow: hidden;
	background: #f3f4f6;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.so-documents-card-thumb .so-documents-file-icon--card {
	position: static;
	margin: 0;
	top: auto;
	left: auto;
	transform: none;
}

/* Badges sur la carte */
.so-documents-card-badge,
.so-documents-card-type {
	position: absolute;
	font-size: 11px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 10px;
	line-height: 1.6;
}

.so-documents-card-badge { top: 8px; right: 8px; }
.so-documents-card-type  { bottom: 8px; left: 8px; }

/* Corps de la carte */
.so-documents-card-body {
	padding: 14px;
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 6px;
}

.so-documents-card-title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: #111;
	line-height: 1.3;
}

.so-documents-card-excerpt {
	margin: 0;
	font-size: 13px;
	color: #555;
	flex: 1;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

.so-documents-card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 12px;
	color: #888;
	margin-top: auto;
}

.so-documents-card-cats::before { content: '· '; }

/* Badges communs : type de fichier */
.so-documents-badge-type {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
}

.so-documents-type-pdf   { background: #fef2f2; color: #dc2626; }
.so-documents-type-word  { background: #eff6ff; color: #2563eb; }
.so-documents-type-odt   { background: #f0fdf4; color: #16a34a; }
.so-documents-type-image { background: #fefce8; color: #ca8a04; }

/* --------------------------------------------------------------------------
   Message aucun résultat
   -------------------------------------------------------------------------- */
.so-documents-no-results {
	padding: 24px 0;
	text-align: center;
	color: #888;
	font-style: italic;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media ( max-width: 768px ) {
	.so-documents-row,
	.so-document-item-list {
		grid-template-columns: 40px 1fr;
	}

	.so-documents-col-categories,
	.so-documents-col-type,
	.so-documents-col-date, 
	.so-documents-col-action { display: none; }

	.so-documents--grid .so-documents-list {
		grid-template-columns: 1fr; /* 1 colonne sur mobile quels que soient les réglages */
		gap: 12px;
	}
}
