/**
 * nLPD Consent Manager — styles de la bannière et de la modale.
 * Neutre et sobre pour s'intégrer à un thème Storefront ; surchargez
 * dans le thème enfant si nécessaire (sélecteurs .nlpd-*).
 */

/* ------------------------------------------------------------------ *
 * Cohabitation avec les éléments fixés en bas de page
 *
 * Tant que la bannière est visible, le body porte .nlpd-banner-visible
 * et --nlpd-banner-height contient sa hauteur réelle (posée par le JS).
 * Le sélecteur de langue GTranslate est alors remonté juste au-dessus
 * de la bannière sur tous les formats d'écran, puis retrouve sa
 * position d'origine une fois le choix effectué. Le !important est
 * nécessaire pour surclasser le style inline (bottom:15px) de GTranslate.
 * ------------------------------------------------------------------ */

body.nlpd-banner-visible .gt_switcher_wrapper,
body.nlpd-banner-visible .gtranslate_wrapper .gt_switcher_wrapper {
	bottom: calc(var(--nlpd-banner-height, 0px) + 15px) !important;
	transition: bottom 0.2s ease;
}

/* ------------------------------------------------------------------ *
 * Bannière
 * ------------------------------------------------------------------ */

.nlpd-banner {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 999990;
	background: #ffffff;
	border-top: 1px solid #e2e2e2;
	box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
	padding: 20px 16px;
	font-size: 15px;
	line-height: 1.5;
	color: #222;
}

.nlpd-banner[hidden],
.nlpd-modal[hidden],
.nlpd-cat__details[hidden] {
	display: none !important;
}

.nlpd-banner__inner {
	max-width: 1080px;
	margin: 0 auto;
}

.nlpd-banner__title {
	margin: 0 0 8px;
	font-size: 17px;
	font-weight: 600;
	color: #111;
}

.nlpd-banner__text {
	margin: 0 0 14px;
}

.nlpd-banner__link {
	text-decoration: underline;
}

.nlpd-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* ------------------------------------------------------------------ *
 * Boutons
 * ------------------------------------------------------------------ */

.nlpd-btn {
	appearance: none;
	border-radius: 4px;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
	border: 1px solid transparent;
}

.nlpd-btn:focus-visible {
	outline: 2px solid var(--nlpd-primary, #1a4b8c);
	outline-offset: 2px;
}

.nlpd-btn--primary {
	background: var(--nlpd-primary, #1a4b8c);
	color: var(--nlpd-primary-text, #fff);
	border-color: var(--nlpd-primary, #1a4b8c);
}

.nlpd-btn--primary:hover {
	background: var(--nlpd-primary-hover, #143a6d);
	border-color: var(--nlpd-primary-hover, #143a6d);
	color: var(--nlpd-primary-text, #fff);
}

.nlpd-btn--ghost {
	background: transparent;
	color: #333;
	border-color: #bbb;
}

.nlpd-btn--ghost:hover {
	background: #f2f2f2;
	color: #111;
}

/* ------------------------------------------------------------------ *
 * Modale de préférences
 * ------------------------------------------------------------------ */

.nlpd-modal {
	position: fixed;
	inset: 0;
	z-index: 1000001; /* Au-dessus du sélecteur GTranslate (999999). */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.nlpd-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.nlpd-modal__panel {
	position: relative;
	background: #fff;
	border-radius: 8px;
	max-width: 680px;
	width: 100%;
	max-height: 85vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
	font-size: 15px;
	color: #222;
}

.nlpd-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid #e8e8e8;
}

.nlpd-modal__header h2 {
	margin: 0;
	font-size: 18px;
}

.nlpd-modal__close {
	appearance: none;
	background: none;
	border: 0;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: #555;
	padding: 4px 8px;
}

.nlpd-modal__close:hover {
	color: #000;
}

.nlpd-modal__body {
	padding: 16px 20px;
	overflow-y: auto;
}

.nlpd-modal__footer {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
	padding: 14px 20px;
	border-top: 1px solid #e8e8e8;
}

/* Blocage du scroll de la page quand la modale est ouverte. */
body.nlpd-no-scroll {
	overflow: hidden;
}

/* ------------------------------------------------------------------ *
 * Catégories
 * ------------------------------------------------------------------ */

.nlpd-cat {
	border: 1px solid #e5e5e5;
	border-radius: 6px;
	padding: 12px 14px;
	margin-bottom: 12px;
}

.nlpd-cat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.nlpd-switch {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
}

.nlpd-cat__checkbox {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.nlpd-switch__slider {
	position: relative;
	width: 40px;
	height: 22px;
	background: #c4c4c4;
	border-radius: 22px;
	transition: background-color 0.15s ease;
	flex-shrink: 0;
}

.nlpd-switch__slider::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	transition: transform 0.15s ease;
}

.nlpd-cat__checkbox:checked + .nlpd-switch__slider {
	background: var(--nlpd-primary, #1a4b8c);
}

.nlpd-cat__checkbox:checked + .nlpd-switch__slider::after {
	transform: translateX(18px);
}

.nlpd-cat__checkbox:disabled + .nlpd-switch__slider {
	background: #7f97b8;
	cursor: not-allowed;
}

.nlpd-cat__checkbox:focus-visible + .nlpd-switch__slider {
	outline: 2px solid var(--nlpd-primary, #1a4b8c);
	outline-offset: 2px;
}

.nlpd-cat__label {
	font-weight: 600;
}

.nlpd-cat__description {
	margin: 8px 0 0;
	color: #555;
	font-size: 14px;
}

.nlpd-cat__toggle {
	appearance: none;
	background: none;
	border: 0;
	color: var(--nlpd-primary, #1a4b8c);
	text-decoration: underline;
	cursor: pointer;
	font-size: 13px;
	padding: 2px 4px;
}

/* ------------------------------------------------------------------ *
 * Tableau des cookies
 * ------------------------------------------------------------------ */

.nlpd-cat__details {
	margin-top: 10px;
	overflow-x: auto;
}

.nlpd-cookie-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.nlpd-cookie-table th,
.nlpd-cookie-table td {
	border: 1px solid #e5e5e5;
	padding: 6px 8px;
	text-align: left;
	vertical-align: top;
}

.nlpd-cookie-table th {
	background: #f7f7f7;
	font-weight: 600;
}

.nlpd-cookie-table code {
	font-size: 12px;
	word-break: break-all;
}

/* Shortcode [nlpd_liste_cookies] (page « Politique des Cookies »). */
.nlpd-cookie-list .nlpd-cookie-table {
	margin-bottom: 28px;
}

.nlpd-cookie-list__title {
	margin: 24px 0 4px;
}

.nlpd-cookie-list__description {
	margin: 0 0 10px;
	color: #555;
	font-size: 14px;
}

/* ------------------------------------------------------------------ *
 * Responsive & accessibilité
 * ------------------------------------------------------------------ */

@media (max-width: 600px) {
	.nlpd-banner {
		padding: 16px 12px;
		font-size: 14px;
	}

	.nlpd-banner__actions .nlpd-btn {
		flex: 1 1 100%;
		text-align: center;
	}

	.nlpd-modal__footer .nlpd-btn {
		flex: 1 1 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nlpd-btn,
	.nlpd-switch__slider,
	.nlpd-switch__slider::after {
		transition: none;
	}
}
