/* ============================================================
   BANDEAU COOKIES — Loi 25 Québec + PIPEDA
   ============================================================ */

/* === Carte compacte flottante (vue principale) === */
#ticq-cookie-banner[hidden] {
	display: none !important;
}

#ticq-cookie-banner {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%) translateY(130%);
	width: calc(100% - 48px);
	max-width: 460px;
	z-index: 9999999 !important;
	transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

#ticq-cookie-banner.is-visible {
	transform: translateX(-50%) translateY(0);
}

#ticq-cookie-banner.no-transition {
	transition: none !important;
}

/* === Modale "Personnaliser" — centrée à l'écran === */
#ticq-cookie-banner.is-detail {
	inset: 0;
	width: 100%;
	max-width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
	background: rgba(0, 0, 0, 0.5);
	transform: none !important;
	transition: opacity 0.3s ease;
	opacity: 0;
	pointer-events: none;
}

#ticq-cookie-banner.is-detail.is-visible {
	opacity: 1;
	pointer-events: auto;
}

/* --- Panneau blanc (carte ou modale) --- */
.ticq-cookie-wrap {
	background: #fff;
	border-radius: var(--ticq-radius-md);
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
	overflow: hidden;
}

#ticq-cookie-banner.is-detail .ticq-cookie-wrap {
	max-width: 520px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ticq-cookie-container {
	padding: 22px 26px;
}

/* ── Vue principale ── */
#ticq-cookie-main {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* L'attribut HTML `hidden` seul ne suffit pas : une règle CSS normale de
   l'auteur (display:flex ci-dessus) prime toujours sur la règle normale
   du navigateur ([hidden]{display:none}), quelle que soit la spécificité.
   Sans cette règle explicite, #ticq-cookie-main reste affiché même avec
   l'attribut hidden posé par cookies.js → vue principale et vue détail
   superposées (boutons et titres dupliqués à l'écran). */
#ticq-cookie-main[hidden] {
	display: none;
}

/* Même garde-fou, par précaution, si une règle display venait un jour
   s'ajouter sur #ticq-cookie-detail. */
#ticq-cookie-detail[hidden] {
	display: none;
}

.ticq-cookie-text h3 {
	font-size: 16px;
	font-weight: 700;
	color: #1a0f0a;
	margin: 0 0 8px;
}

.ticq-cookie-text p {
	font-size: 14px;
	line-height: 1.65;
	color: #5a4030;
	margin: 0 0 10px;
}

.ticq-cookie-text a {
	font-size: 13px;
	color: var(--ticq-color-primary);
	text-decoration: underline;
}

.ticq-cookie-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
}

/* ── Boutons ── */
.ticq-cbtn {
	padding: 10px 22px;
	border-radius: var(--ticq-radius-pill);
	font-size: 13px;
	font-weight: 600;
	border: 2px solid transparent;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s;
	white-space: nowrap;
	font-family: var(--ticq-font-body);
	line-height: 1.4;
}

.ticq-cbtn--primary {
	background: var(--ticq-color-primary);
	color: #fff;
	border-color: var(--ticq-color-primary);
}

.ticq-cbtn--primary:hover {
	opacity: 0.87;
	box-shadow: 0 4px 14px rgba(107, 58, 42, 0.38);
}

.ticq-cbtn--outline {
	background: transparent;
	color: var(--ticq-color-primary);
	border-color: var(--ticq-color-primary);
}

.ticq-cbtn--outline:hover {
	background: var(--ticq-color-primary);
	color: #fff;
}

.ticq-cbtn--ghost {
	background: transparent;
	color: #8a7060;
	border-color: #d0c0b0;
}

.ticq-cbtn--ghost:hover {
	background: #f5f0eb;
	border-color: #b0a090;
	color: #5a4030;
}

/* ── Vue paramètres détaillés ── */
#ticq-cookie-detail {
	padding-top: 4px;
}

.ticq-cookie-detail-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
	gap: 12px;
}

.ticq-cookie-detail-header h3 {
	font-size: 17px;
	font-weight: 700;
	color: #1a0f0a;
	margin: 0;
	font-family: var(--ticq-font-heading);
}

.ticq-cookie-back {
	display: flex;
	align-items: center;
	gap: 5px;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 13px;
	color: #8a7060;
	font-family: var(--ticq-font-body);
	padding: 6px 10px;
	border-radius: var(--ticq-radius-pill);
	transition: background 0.15s, color 0.15s;
}

.ticq-cookie-back:hover {
	background: #f5f0eb;
	color: #5a4030;
}

.ticq-cookie-back svg {
	width: var(--ticq-icon-sm);
	height: var(--ticq-icon-sm);
	fill: currentColor;
}

.ticq-cookie-note {
	font-size: 13px;
	color: #7a6050;
	margin: 0 0 20px;
	line-height: 1.65;
	padding: 12px 16px;
	background: #faf6f3;
	border-radius: var(--ticq-radius-sm);
	border-left: 3px solid var(--ticq-color-primary);
}

/* ── Catégories ── */
.ticq-cookie-cats {
	display: flex;
	flex-direction: column;
	margin-bottom: 20px;
}

.ticq-cookie-cat {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 24px;
	padding: 16px 0;
	border-bottom: 1px solid #f0e8e0;
}

.ticq-cookie-cat:last-child {
	border-bottom: none;
}

.ticq-cookie-cat__info {
	flex: 1;
}

.ticq-cookie-cat__name {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #2d1a10;
	margin-bottom: 4px;
}

label.ticq-cookie-cat__name {
	cursor: pointer;
}

.ticq-cookie-cat__desc {
	font-size: 12px;
	color: #8a7060;
	line-height: 1.6;
	display: block;
}

/* Badge "Toujours actifs" */
.ticq-always-on {
	font-size: 11px;
	font-weight: 600;
	color: #3a8a4a;
	background: #e8f5ec;
	padding: 4px 12px;
	border-radius: var(--ticq-radius-pill);
	white-space: nowrap;
	flex-shrink: 0;
	margin-top: 2px;
}

/* ── Toggle switch ── */
.ticq-toggle {
	position: relative;
	display: inline-block;
	width: 46px;
	height: 26px;
	flex-shrink: 0;
	margin-top: 2px;
	cursor: pointer;
}

.ticq-toggle input {
	opacity: 0;
	width: 0;
	height: 0;
	position: absolute;
}

.ticq-toggle__slider {
	position: absolute;
	inset: 0;
	background: #d0c0b0;
	border-radius: 26px;
	transition: background-color 0.22s;
	cursor: pointer;
}

.ticq-toggle__slider::before {
	content: '';
	position: absolute;
	width: 20px;
	height: 20px;
	border-radius: var(--ticq-radius-round);
	background: #fff;
	top: 3px;
	left: 3px;
	transition: transform 0.22s;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.ticq-toggle input:checked + .ticq-toggle__slider {
	background: var(--ticq-color-primary);
}

.ticq-toggle input:checked + .ticq-toggle__slider::before {
	transform: translateX(20px);
}

.ticq-toggle input:focus-visible + .ticq-toggle__slider {
	outline: 2px solid var(--ticq-color-primary);
	outline-offset: 2px;
}

/* ── Actions + mentions légales ── */
.ticq-cookie-detail-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.ticq-cookie-legal {
	font-size: 11px;
	color: #a09080;
	line-height: 1.5;
	margin: 0;
	padding-top: 12px;
	border-top: 1px solid #f0e8e0;
}

.ticq-cookie-legal a {
	color: var(--ticq-color-primary);
	text-decoration: underline;
}

/* ── Bouton flottant "Rouvrir" ── */
#ticq-cookie-reopen {
	position: fixed;
	bottom: 16px;
	left: 16px;
	z-index: 9999998 !important;
	background: #fff;
	border: 1px solid #e0d0c0;
	border-radius: var(--ticq-radius-pill);
	padding: 7px 14px 7px 10px;
	font-size: 12px;
	font-family: var(--ticq-font-body);
	color: #5a4030;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 7px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
	transition: box-shadow 0.2s, color 0.2s, opacity 0.3s, transform 0.3s;
	opacity: 0;
	transform: translateY(6px);
	pointer-events: none;
}

#ticq-cookie-reopen.is-visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

#ticq-cookie-reopen:hover {
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
	color: var(--ticq-color-primary);
}


#ticq-cookie-reopen svg {
	width: 15px;
	height: 15px;
	fill: currentColor;
	flex-shrink: 0;
}

/* ── Décaler le bouton chat sur mobile quand la carte est ouverte ── */
@media (max-width: 599px) {
	body.ticq-cookie-open #ticq-chat-toggle {
		bottom: 170px;
	}
}

/* ============================================================
   RESPONSIVE — Bandeau cookies
   ============================================================ */

/* ── Mobile (≤ 599 px) ── */
@media (max-width: 599px) {
	#ticq-cookie-banner {
		bottom: 16px;
		width: calc(100% - 32px);
	}

	/* Modale alignée en bas sur mobile */
	#ticq-cookie-banner.is-detail {
		align-items: flex-end;
		padding: 0;
	}

	#ticq-cookie-banner.is-detail .ticq-cookie-wrap {
		max-height: 88vh;
		max-height: 88dvh;
		border-radius: 20px 20px 0 0;
	}

	.ticq-cookie-container {
		padding: 18px 16px;
		padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	}

	.ticq-cookie-actions {
		flex-direction: column;
		gap: 8px;
		width: 100%;
	}

	.ticq-cbtn {
		width: 100%;
		text-align: center;
	}

	.ticq-cookie-detail-actions {
		flex-direction: column;
	}

	.ticq-cookie-detail-actions .ticq-cbtn {
		width: 100%;
	}

	.ticq-cookie-cat {
		gap: 16px;
		padding: 14px 0;
	}

	.ticq-cookie-detail-header h3 {
		font-size: 15px;
	}

	#ticq-cookie-reopen {
		left: calc(16px + env(safe-area-inset-left, 0px));
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	}
}

/* ── Paysage mobile ── */
@media (max-width: 991px) and (orientation: landscape) {
	#ticq-cookie-banner.is-detail {
		align-items: center;
		padding: 16px;
	}

	#ticq-cookie-banner.is-detail .ticq-cookie-wrap {
		max-height: 80vh;
		max-height: 80dvh;
		border-radius: var(--ticq-radius-md);
	}
}

/* Masquer le bouton flottant "Cookies" tant que la bannière est active */
body.ticq-cookie-open #ticq-cookie-reopen {
	opacity: 0 !important;
	pointer-events: none !important;
	transform: translateY(6px) !important;
}
