/**
 * Styles front-end du plugin Ochanta Favoris.
 * Variables CSS personnalisables depuis le theme (surcharge simple sans recompilation).
 */

:root {
	--ochfav-couleur-coeur: #c0392b;
	--ochfav-couleur-coeur-vide: #b0b0b0;
	--ochfav-couleur-fond-bouton: #ffffff;
	--ochfav-rayon-bouton: 50%;
	--ochfav-badge-fond: #f7f3ec;
	--ochfav-badge-texte: #6b5b3e;
	--ochfav-badge-rayon: 999px;
	--ochfav-police: inherit;
}

/* Police : appliquee a chaque racine de composant du plugin (surchargee
   depuis Reglages -> Style des favoris, sinon herite du theme). */
.ochfav-bouton-favori,
.ochfav-tableau-favoris,
.ochfav-nav-listes,
.ochfav-liste-badge,
.ochfav-compteur-lien,
.ochfav-myaccount,
.ochfav-widget-liste-section {
	font-family: var(--ochfav-police);
}

/* Bouton favoris (coeur) */
.ochfav-bouton-favori {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25em;
	height: 2.25em;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: var(--ochfav-rayon-bouton);
	background: var(--ochfav-couleur-fond-bouton);
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ochfav-bouton-favori:hover {
	transform: scale(1.08);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.ochfav-bouton-favori.ochfav-en-cours {
	opacity: 0.6;
	pointer-events: none;
}

.ochfav-bouton-favori--boucle {
	position: absolute;
	top: 0.75em;
	right: 0.75em;
	z-index: 2;
}

/* Necessaire pour positionner le bouton en overlay sur la vignette du produit. */
.woocommerce ul.products li.product {
	position: relative;
}

.ochfav-icone-coeur {
	display: block;
	width: 1.1em;
	height: 1.1em;
	position: relative;
}

.ochfav-icone-coeur::before {
	content: "\2665"; /* coeur plein */
	font-size: 1.4em;
	line-height: 1;
	color: var(--ochfav-couleur-coeur-vide);
	transition: color 0.15s ease;
}

.ochfav-est-favori .ochfav-icone-coeur::before {
	color: var(--ochfav-couleur-coeur);
}

/* Tableau de produits favoris (Mes favoris, widget, shortcode) */
.ochfav-tableau-favoris {
	margin: 0 0 2rem;
	overflow-x: auto;
}

.ochfav-table-produits {
	width: 100%;
	border-collapse: collapse;
}

.ochfav-table-produits th,
.ochfav-table-produits td {
	padding: 0.9em 0.75em;
	text-align: left;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	vertical-align: middle;
}

.ochfav-table-produits thead th {
	font-weight: 600;
	border-bottom: 2px solid rgba(0, 0, 0, 0.12);
	white-space: nowrap;
}

.ochfav-col-check,
.ochfav-col-retirer {
	width: 1%;
	white-space: nowrap;
	text-align: center;
}

/* Ligne d'en-tete de categorie parente, inseree entre les groupes de produits. */
.ochfav-groupe-categorie-ligne td {
	padding: 0.6em 0.75em;
	background: #f6f7f7;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	font-weight: 600;
	font-size: 0.9em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #555;
}

.ochfav-groupe-categorie-ligne:first-child td {
	border-top: none;
}

.ochfav-produit-retirer-table {
	background: none;
	border: none;
	color: #999;
	font-size: 1.2em;
	line-height: 1;
	cursor: pointer;
	padding: 0.2em 0.4em;
}

.ochfav-produit-retirer-table:hover {
	color: var(--ochfav-couleur-coeur);
}

.ochfav-produit-lien-table {
	display: flex;
	align-items: center;
	gap: 0.75em;
	color: inherit;
	text-decoration: none;
}

.ochfav-produit-vignette-table img {
	width: 48px;
	height: 48px;
	object-fit: cover;
	display: block;
	border-radius: 4px;
}

.ochfav-produit-nom-table {
	font-weight: 500;
}

.ochfav-col-prix {
	white-space: nowrap;
}

.ochfav-col-date {
	white-space: nowrap;
	color: #666;
}

.ochfav-stock {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	white-space: nowrap;
}

.ochfav-stock .dashicons {
	font-size: 1.1em;
	width: 1.1em;
	height: 1.1em;
}

.ochfav-stock-dispo {
	color: #2e7d32;
}

.ochfav-stock-indispo {
	color: #c62828;
}

.ochfav-col-action {
	white-space: nowrap;
	text-align: right;
}

.ochfav-actions-groupees {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6em;
	margin: 0 0 1.25em;
	padding-bottom: 1.25em;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/*
 * Boutons d'action groupee (au-dessus du tableau) : style dedie et volontairement
 * verrouille en !important. De nombreux themes appliquent leurs propres regles a
 * l'element <button> nu (bordure, fond, coins carres) avec une specificite ou un
 * ordre de chargement qu'on ne maitrise pas ; sans !important ces regles gagnent
 * la cascade et le bouton retombe sur l'apparence brute du navigateur.
 */
.ochfav-btn {
	display: inline-flex !important;
	align-items: center !important;
	gap: 0.4em !important;
	font-family: inherit !important;
	font-size: 0.85em !important;
	font-weight: 600 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	line-height: 1.4 !important;
	padding: 0.65em 1.15em !important;
	margin: 0 !important;
	border-radius: 6px !important;
	border: 1px solid transparent !important;
	appearance: none !important;
	-webkit-appearance: none !important;
	cursor: pointer !important;
	transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease !important;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
}

.ochfav-btn .dashicons {
	width: 1em;
	height: 1em;
	font-size: 1.1em;
}

.ochfav-btn:hover {
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
	transform: translateY(-1px);
}

.ochfav-btn:active {
	transform: translateY(0);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}

.ochfav-btn:focus-visible {
	outline: 2px solid #2c5f8a !important;
	outline-offset: 2px;
}

.ochfav-btn-primaire {
	background-color: #2c5f8a !important;
	border-color: #2c5f8a !important;
	color: #fff !important;
}

.ochfav-btn-primaire:hover {
	background-color: #234a6d !important;
	border-color: #234a6d !important;
	color: #fff !important;
}

.ochfav-btn-danger {
	background-color: #fff !important;
	border-color: #c0392b !important;
	color: #c0392b !important;
}

.ochfav-btn-danger:hover {
	background-color: #c0392b !important;
	border-color: #c0392b !important;
	color: #fff !important;
}

.ochfav-actions-groupees-message {
	margin: -0.5em 0 1.25em;
}

.ochfav-actions-groupees-message:empty {
	display: none;
}

.ochfav-actions-groupees-message:not(:empty) {
	padding: 0.6em 0.9em;
	border-radius: 6px;
	background: #eaf6ec;
	color: #256029;
	font-weight: 500;
}

.ochfav-actions-groupees-message.ochfav-message-erreur:not(:empty) {
	background: #fbeae8;
	color: #c62828;
}

@media (max-width: 600px) {
	.ochfav-produit-nom-table {
		white-space: normal;
	}
}

.ochfav-liste-vide {
	padding: 1.5rem;
	background: #f7f7f7;
	border-radius: 6px;
	color: #555;
}

/* Navigation rapide entre "Mes favoris" et les listes assignees (My Account) */
.ochfav-nav-listes {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em;
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.ochfav-nav-listes-lien {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.55em 1em;
	border-radius: var(--ochfav-badge-rayon);
	background: #f6f7f7;
	color: #333;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.9em;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.ochfav-nav-listes-lien:hover {
	background: #eef2f6;
	color: #2c5f8a;
}

.ochfav-nav-listes-compteur {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.6em;
	height: 1.6em;
	padding: 0 0.4em;
	border-radius: var(--ochfav-badge-rayon);
	background: #fff;
	color: #555;
	font-size: 0.85em;
	font-weight: 700;
}

/* Sections "Mes favoris" (My Account) */
.ochfav-myaccount .ochfav-section {
	margin-bottom: 2.5rem;
	scroll-margin-top: 1.5rem;
}

.ochfav-myaccount .ochfav-section h2 {
	margin-bottom: 0.5rem;
}

.ochfav-liste-description {
	color: #666;
	margin-bottom: 0.5rem;
}

/* Widget Elementor "Mes listes de favoris assignees" */
.ochfav-widget-liste-section {
	margin-bottom: 2.5rem;
}

.ochfav-widget-liste-titre {
	margin-bottom: 0.5rem;
}

.ochfav-liste-badge {
	display: inline-block;
	font-size: 0.8em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--ochfav-badge-texte);
	background: var(--ochfav-badge-fond);
	padding: 0.2em 0.7em;
	border-radius: var(--ochfav-badge-rayon);
	margin-bottom: 1rem;
}

/* Compteur de favoris (header/menu) */
.ochfav-compteur-lien {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	text-decoration: none;
	color: inherit;
}

.ochfav-compteur-lien .dashicons-heart {
	color: var(--ochfav-couleur-coeur);
}

.ochfav-compteur-nombre {
	font-weight: 600;
}
