/**
 * CBR Planning — Styles du bandeau d'installation PWA (Sprint 1)
 *
 * Bandeau discret, en bas d'écran, masquable. Compatible mode sombre.
 */

#cbr-pwa-install-banner {
	position: fixed;
	left: 12px;
	right: 12px;
	bottom: 16px;
	max-width: 520px;
	margin: 0 auto;
	z-index: 9999;
	background: #ffffff;
	color: #1a1b1f;
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
	border: 1px solid rgba(0, 0, 0, 0.06);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	animation: cbr-pwa-slidein 220ms ease-out;
}

@keyframes cbr-pwa-slidein {
	from { transform: translateY(20px); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

.cbr-pwa-banner-inner {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
}

.cbr-pwa-banner-text {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

.cbr-pwa-banner-text strong {
	font-weight: 600;
	font-size: 14px;
	color: #1a1b1f;
}

.cbr-pwa-banner-text span {
	font-size: 12.5px;
	color: #555;
	margin-top: 2px;
}

.cbr-pwa-banner-actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}

.cbr-pwa-btn {
	border: none;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	padding: 8px 12px;
	cursor: pointer;
	white-space: nowrap;
	transition: background 120ms ease;
}

.cbr-pwa-btn-primary {
	background: #1FA9C4;          /* cyan du logo CBR */
	color: #ffffff;
}
.cbr-pwa-btn-primary:hover { background: #1a96ad; }

.cbr-pwa-btn-ghost {
	background: transparent;
	color: #555;
}
.cbr-pwa-btn-ghost:hover { background: rgba(0, 0, 0, 0.06); }

/* Mode sombre */
html.cbr-dark-page #cbr-pwa-install-banner,
.cbr-dark #cbr-pwa-install-banner {
	background: #23252b;
	color: #ececec;
	border-color: rgba(255, 255, 255, 0.08);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.25);
}
html.cbr-dark-page #cbr-pwa-install-banner .cbr-pwa-banner-text strong,
.cbr-dark #cbr-pwa-install-banner .cbr-pwa-banner-text strong { color: #ececec; }

html.cbr-dark-page #cbr-pwa-install-banner .cbr-pwa-banner-text span,
.cbr-dark #cbr-pwa-install-banner .cbr-pwa-banner-text span { color: #aaa; }

html.cbr-dark-page .cbr-pwa-btn-ghost,
.cbr-dark .cbr-pwa-btn-ghost { color: #ccc; }
html.cbr-dark-page .cbr-pwa-btn-ghost:hover,
.cbr-dark .cbr-pwa-btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }

/* Petits écrans : bandeau plein largeur */
@media (max-width: 480px) {
	#cbr-pwa-install-banner,
	#cbr-notif-optin {
		left: 8px;
		right: 8px;
		bottom: 8px;
		border-radius: 10px;
	}
	.cbr-pwa-banner-inner {
		padding: 10px 12px;
		gap: 8px;
	}
	.cbr-pwa-btn { padding: 7px 10px; font-size: 12.5px; }
}

/* Bandeau opt-in notifications (Sprint 2) — réutilise le styling du bandeau d'install. */
#cbr-notif-optin {
	position: fixed;
	left: 12px;
	right: 12px;
	bottom: 16px;
	max-width: 520px;
	margin: 0 auto;
	z-index: 9998;
	background: #ffffff;
	color: #1a1b1f;
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
	border: 1px solid rgba(0, 0, 0, 0.06);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	animation: cbr-pwa-slidein 220ms ease-out;
}
html.cbr-dark-page #cbr-notif-optin,
.cbr-dark #cbr-notif-optin {
	background: #23252b;
	color: #ececec;
	border-color: rgba(255, 255, 255, 0.08);
}

/* Toast feedback (activation OK, etc.) */
.cbr-pwa-flash {
	position: fixed;
	bottom: 100px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(20, 22, 28, 0.92);
	color: #fff;
	padding: 10px 18px;
	border-radius: 22px;
	font-size: 13.5px;
	font-weight: 500;
	z-index: 10000;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
	transition: opacity 600ms ease, transform 600ms ease;
}
.cbr-pwa-flash.cbr-pwa-flash-out {
	opacity: 0;
	transform: translateX(-50%) translateY(20px);
}

/* ─────────────────────────────────────────────────────────────────────────
 * Sprint 5 — Cloche « Mes notifications »
 *
 * Depuis le 2026-05-23 le bouton vit dans la toolbar (à droite, avant le
 * mode sombre) ; il hérite donc des styles .cbr-btn / .cbr-btn-ghost. On
 * conserve uniquement le réglage d'icône (taille emoji) et le rendu d'état
 * actif éventuel. Le wrap `.cbr-notif-btn-wrap` est obsolète mais on garde
 * sa règle au cas où un thème tiers l'utiliserait encore.
 * ───────────────────────────────────────────────────────────────────────── */

.cbr-notif-btn-wrap {
	margin-top: 12px;
	display: flex;
	justify-content: flex-start;
}
.cbr-notif-btn-icon {
	font-size: 18px;
	line-height: 1;
}

/* ── Modale ────────────────────────────────────────────────────────────── */

.cbr-notif-modal-root {
	position: fixed;
	inset: 0;
	z-index: 10001;
	display: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.cbr-notif-modal-root.is-open {
	display: block;
}
.cbr-notif-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	animation: cbr-notif-fadein 160ms ease-out;
}
@keyframes cbr-notif-fadein {
	from { opacity: 0; } to { opacity: 1; }
}
.cbr-notif-dialog {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(560px, calc(100vw - 24px));
	max-height: calc(100vh - 24px);
	background: #ffffff;
	color: #1a1b1f;
	border-radius: 14px;
	box-shadow: 0 24px 64px rgba(0,0,0,0.28), 0 4px 12px rgba(0,0,0,0.12);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: cbr-notif-popin 200ms ease-out;
}
@keyframes cbr-notif-popin {
	from { transform: translate(-50%, -46%); opacity: 0; }
	to   { transform: translate(-50%, -50%); opacity: 1; }
}
.cbr-notif-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	border-bottom: 1px solid rgba(0,0,0,0.08);
}
.cbr-notif-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}
.cbr-notif-x {
	background: transparent;
	border: 0;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 10px;
	border-radius: 6px;
	color: inherit;
}
.cbr-notif-x:hover { background: rgba(0,0,0,0.06); }
.cbr-notif-body {
	padding: 14px 18px 18px;
	overflow-y: auto;
	font-size: 14px;
	line-height: 1.4;
}

/* ── Bandeau d'état (souscription présente ou non) ───────────────────── */

.cbr-notif-status {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	border-radius: 10px;
	margin-bottom: 16px;
	font-size: 13.5px;
	flex-wrap: wrap;
}
.cbr-notif-status-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	margin-top: 4px;
	flex-shrink: 0;
}
.cbr-notif-status.is-active {
	background: rgba(16, 185, 129, 0.10);
	color: #065f46;
}
.cbr-notif-status.is-active .cbr-notif-status-dot {
	background: #10b981;
}
.cbr-notif-status.is-warning {
	background: rgba(245, 158, 11, 0.12);
	color: #78350f;
}
.cbr-notif-status.is-warning .cbr-notif-status-dot {
	background: #f59e0b;
}
.cbr-notif-btn-enable {
	margin-top: 8px;
	background: #2563eb;
	color: #fff;
	border: 0;
	border-radius: 8px;
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	flex-basis: 100%;
	align-self: flex-start;
}
.cbr-notif-btn-enable:hover:not(:disabled) { background: #1d4ed8; }
.cbr-notif-btn-enable:disabled { opacity: 0.6; cursor: wait; }

/* ── Fieldsets ───────────────────────────────────────────────────────── */

.cbr-notif-fset {
	border: 1px solid rgba(0,0,0,0.08);
	border-radius: 10px;
	padding: 8px 14px 4px;
	margin: 0 0 14px;
}
.cbr-notif-fset legend {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: rgba(0,0,0,0.55);
	padding: 0 6px;
}

.cbr-notif-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 0;
	cursor: pointer;
}
.cbr-notif-row + .cbr-notif-row {
	border-top: 1px solid rgba(0,0,0,0.06);
}
.cbr-notif-row-left {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	flex: 1 1 auto;
	min-width: 0;
}
.cbr-notif-row-left input[type="checkbox"] {
	margin-top: 3px;
	width: 18px;
	height: 18px;
	cursor: pointer;
	accent-color: #2563eb;
	flex-shrink: 0;
}
.cbr-notif-row-text {
	font-size: 13.5px;
}
.cbr-notif-row-text strong { font-weight: 600; }
.cbr-notif-row-text em {
	font-style: normal;
	color: rgba(0,0,0,0.55);
	font-size: 12.5px;
}
.cbr-notif-row-right {
	flex-shrink: 0;
	text-align: right;
}
.cbr-notif-hour-label {
	font-size: 13px;
	color: rgba(0,0,0,0.65);
	cursor: pointer;
	white-space: nowrap;
}
.cbr-notif-hour {
	margin: 0 2px;
	padding: 3px 6px;
	border: 1px solid rgba(0,0,0,0.15);
	border-radius: 6px;
	background: #fff;
	font-size: 13px;
	cursor: pointer;
}
.cbr-notif-immediate {
	font-size: 11.5px;
	color: rgba(0,0,0,0.5);
	font-style: italic;
}

/* ── Actions ─────────────────────────────────────────────────────────── */

.cbr-notif-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 4px;
}
.cbr-notif-btn-action {
	flex: 1 1 auto;
	background: #f3f4f6;
	color: #1a1b1f;
	border: 1px solid rgba(0,0,0,0.08);
	border-radius: 8px;
	padding: 9px 12px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: background 120ms ease;
}
.cbr-notif-btn-action:hover { background: #e5e7eb; }
.cbr-notif-btn-danger {
	color: #b91c1c;
	border-color: rgba(185, 28, 28, 0.25);
	background: rgba(185, 28, 28, 0.06);
}
.cbr-notif-btn-danger:hover { background: rgba(185, 28, 28, 0.12); }

.cbr-notif-savestate {
	margin-top: 10px;
	font-size: 12.5px;
	color: rgba(0,0,0,0.55);
	min-height: 18px;
	text-align: right;
}

/* ── Dark mode ───────────────────────────────────────────────────────── */

/* Note : depuis 2026-05-23 le bouton .cbr-notif-btn vit dans la toolbar et
   hérite des styles .cbr-btn / .cbr-btn-ghost (mode sombre déjà géré via
   .cbr-app.cbr-dark .cbr-btn). On laisse donc tomber les overrides
   spécifiques dark mode du bouton — la modale conserve les siens ci-dessous. */
body.cbr-dark .cbr-notif-dialog,
.cbr-dark .cbr-notif-dialog {
	background: #1f2125;
	color: #e5e7eb;
}
body.cbr-dark .cbr-notif-header,
.cbr-dark .cbr-notif-header {
	border-bottom-color: rgba(255,255,255,0.08);
}
body.cbr-dark .cbr-notif-x:hover,
.cbr-dark .cbr-notif-x:hover { background: rgba(255,255,255,0.08); }
body.cbr-dark .cbr-notif-fset,
.cbr-dark .cbr-notif-fset {
	border-color: rgba(255,255,255,0.10);
}
body.cbr-dark .cbr-notif-fset legend,
.cbr-dark .cbr-notif-fset legend {
	color: rgba(255,255,255,0.55);
}
body.cbr-dark .cbr-notif-row + .cbr-notif-row,
.cbr-dark .cbr-notif-row + .cbr-notif-row {
	border-top-color: rgba(255,255,255,0.08);
}
body.cbr-dark .cbr-notif-row-text em,
.cbr-dark .cbr-notif-row-text em { color: rgba(255,255,255,0.55); }
body.cbr-dark .cbr-notif-hour,
.cbr-dark .cbr-notif-hour {
	background: #2a2d33;
	border-color: rgba(255,255,255,0.16);
	color: #e5e7eb;
}
body.cbr-dark .cbr-notif-hour-label,
.cbr-dark .cbr-notif-hour-label { color: rgba(255,255,255,0.65); }
body.cbr-dark .cbr-notif-immediate,
.cbr-dark .cbr-notif-immediate { color: rgba(255,255,255,0.5); }
body.cbr-dark .cbr-notif-btn-action,
.cbr-dark .cbr-notif-btn-action {
	background: #2a2d33;
	color: #e5e7eb;
	border-color: rgba(255,255,255,0.12);
}
body.cbr-dark .cbr-notif-btn-action:hover,
.cbr-dark .cbr-notif-btn-action:hover { background: #353940; }
body.cbr-dark .cbr-notif-btn-danger,
.cbr-dark .cbr-notif-btn-danger {
	color: #fca5a5;
	background: rgba(185, 28, 28, 0.12);
}
body.cbr-dark .cbr-notif-btn-danger:hover,
.cbr-dark .cbr-notif-btn-danger:hover { background: rgba(185, 28, 28, 0.22); }
body.cbr-dark .cbr-notif-savestate,
.cbr-dark .cbr-notif-savestate { color: rgba(255,255,255,0.55); }
body.cbr-dark .cbr-notif-status.is-active,
.cbr-dark .cbr-notif-status.is-active {
	background: rgba(16, 185, 129, 0.16);
	color: #6ee7b7;
}
body.cbr-dark .cbr-notif-status.is-warning,
.cbr-dark .cbr-notif-status.is-warning {
	background: rgba(245, 158, 11, 0.18);
	color: #fcd34d;
}

/* ── Mobile : empilement vertical des lignes ─────────────────────────── */

@media (max-width: 540px) {
	.cbr-notif-row {
		flex-direction: column;
		align-items: stretch;
	}
	.cbr-notif-row-right {
		text-align: left;
		padding-left: 28px;
	}
	.cbr-notif-actions {
		flex-direction: column;
	}
}

/* ============================================================================
 * Sprint 4 P2 + 5 (2026-05-25) — Bloc « Mes demandes de dispo »
 * dans la modale 🔔 Mes notifications.
 * ============================================================================ */
.cbr-mydispo {
	margin: 0 0 18px;
	padding: 12px 14px;
	background: #FFFAEC;
	border: 1px solid #F0DDA6;
	border-radius: 8px;
}
.cbr-mydispo-title {
	margin: 0 0 8px 0;
	font-size: 14px;
	font-weight: 600;
	color: #6e4b00;
}
.cbr-mydispo-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.cbr-mydispo-loading {
	color: #888;
	font-size: 13px;
}
.cbr-mydispo-card {
	background: #fff;
	border: 1px solid #E2D6A8;
	border-radius: 6px;
	padding: 10px 12px;
	transition: opacity 0.4s;
}
.cbr-mydispo-card.is-done { opacity: 0.55; }

/* Carte mise en évidence après tap sur la notification push.
   - is-highlight : anneau permanent (jusqu'à action ou fermeture modale)
   - is-highlight-pulse : pulse court (~2 s) pour attirer l'œil au scroll */
.cbr-mydispo-card.is-highlight {
	border-color: #1d7a32;
	box-shadow: 0 0 0 3px rgba(29, 122, 50, 0.18);
}
.cbr-mydispo-card.is-highlight-pulse {
	animation: cbr-mydispo-pulse 1.2s ease-in-out 0s 2;
}
@keyframes cbr-mydispo-pulse {
	0%   { box-shadow: 0 0 0 0   rgba(29, 122, 50, 0.55); }
	60%  { box-shadow: 0 0 0 10px rgba(29, 122, 50, 0); }
	100% { box-shadow: 0 0 0 3px  rgba(29, 122, 50, 0.18); }
}

/* Petit avis affiché si la carte ciblée n'existe plus (déjà répondue, etc.) */
.cbr-mydispo-notice {
	font-size: 12.5px;
	color: #5C5A52;
	background: #F4EFE0;
	border: 1px dashed #C9BC8A;
	border-radius: 6px;
	padding: 8px 10px;
}
.cbr-mydispo-head {
	font-size: 14px;
	margin-bottom: 4px;
}
.cbr-mydispo-meta {
	font-size: 12.5px;
	color: #5C5A52;
	margin-bottom: 8px;
}
.cbr-mydispo-badge {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 6px;
	border-radius: 999px;
	background: #1F4D3F;
	color: #FBFAF6;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.02em;
}
.cbr-mydispo-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}
.cbr-mydispo-btn {
	flex: 1 1 auto;
	min-width: 110px;
	padding: 8px 12px;
	border-radius: 6px;
	border: 1px solid transparent;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	transition: filter 0.12s, background 0.12s;
}
.cbr-mydispo-yes {
	background: #1d7a32;
	color: #fff;
	border-color: #1d7a32;
}
.cbr-mydispo-yes:hover:not(:disabled)  { filter: brightness(1.05); }
.cbr-mydispo-no {
	background: #fff;
	color: #b3261e;
	border-color: #e8b7b3;
}
.cbr-mydispo-no:hover:not(:disabled)   { background: #FBEEEC; }
.cbr-mydispo-btn:disabled { opacity: 0.6; cursor: progress; }

.cbr-mydispo-feedback {
	margin-top: 6px;
	font-size: 12px;
	min-height: 16px;
}
.cbr-mydispo-feedback.is-pending { color: #5C5A52; }
.cbr-mydispo-feedback.is-ok      { color: #1d7a32; font-weight: 600; }
.cbr-mydispo-feedback.is-err     { color: #b3261e; font-weight: 600; }

/* Mode sombre */
body.cbr-dark .cbr-mydispo,
.cbr-dark .cbr-mydispo {
	background: #2A2415;
	border-color: #5a4923;
	color: #EBC983;
}
body.cbr-dark .cbr-mydispo-title,
.cbr-dark .cbr-mydispo-title { color: #EBC983; }
body.cbr-dark .cbr-mydispo-card,
.cbr-dark .cbr-mydispo-card {
	background: #1F1E18;
	border-color: #4a3f24;
}
body.cbr-dark .cbr-mydispo-card.is-highlight,
.cbr-dark .cbr-mydispo-card.is-highlight {
	border-color: #4FB36A;
	box-shadow: 0 0 0 3px rgba(79, 179, 106, 0.25);
}
body.cbr-dark .cbr-mydispo-notice,
.cbr-dark .cbr-mydispo-notice {
	background: #2A2415;
	color: #B9B6A9;
	border-color: #5a4923;
}
body.cbr-dark .cbr-mydispo-meta,
.cbr-dark .cbr-mydispo-meta { color: #B9B6A9; }
body.cbr-dark .cbr-mydispo-no,
.cbr-dark .cbr-mydispo-no {
	background: #1F1E18;
	color: #F2BAB2;
	border-color: #5D2B26;
}
