/**
 * France Boissons - Video Player avec Transcription RGAA
 *
 * Styles harmonisés avec le thème France Boissons
 * Conforme RGAA 4.1 et WCAG 2.1 AAA
 *
 * @package FranceBoissons
 */

/* ==========================================================================
   Lecteur vidéo
   ========================================================================== */

.fb-video-player {
	margin: 2rem 0;
	width: 100%;
	font-family: var(--font-primary, "Lato", sans-serif);
}

.fb-video-player__wrapper {
	position: relative;
	width: 100%;
	background: #000;
	overflow: hidden;
	/* Forcer le ratio 16/9 par défaut */
	aspect-ratio: 16 / 9;
}

.fb-video-player__video {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: cover;
}

/* Mode ambient: vidéo d'ambiance sans contrôles */
.fb-video-player--ambient {
	/* Supprimer les marges, ombres et bordures pour les vidéos d'ambiance */
	margin: 0 !important;
	box-shadow: none !important;
	border-radius: 0 !important;
}

.fb-video-player--ambient .fb-video-player__wrapper {
	/* Le padding-bottom est défini inline pour respecter le ratio réel de la vidéo */
	aspect-ratio: unset;
	border-radius: 0 !important;
	box-shadow: none !important;
	overflow: visible; /* Permettre à la vidéo d'utiliser ses dimensions réelles */
}

.fb-video-player--ambient .fb-video-player__video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: contain; /* Utiliser contain au lieu de cover pour respecter les dimensions */
	border-radius: 0 !important;
	box-shadow: none !important;
}

.fb-video-player__fallback {
	padding: 2rem;
	text-align: center;
	color: #fff;
	background: #1d2327;
}

.fb-video-player__fallback a {
	color: #f3971e;
	text-decoration: underline;
	font-weight: 600;
}

.fb-video-player__fallback a:hover,
.fb-video-player__fallback a:focus {
	color: #ed9e26;
}

/* Bouton play pour le poster */
.fb-video-play-button {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	z-index: 10;
	transition: opacity 0.3s ease, transform 0.2s ease;
	outline: none;
}

.fb-video-play-button:hover {
	transform: translate(-50%, -50%) scale(1.1);
}

.fb-video-play-button:focus-visible {
	outline: 3px solid #f3971e;
	outline-offset: 5px;
	border-radius: 50%;
}

.fb-video-play-button svg {
	display: block;
	filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

/* ==========================================================================
   Actions (Bouton transcription)
   ========================================================================== */

.fb-video-player__actions {
	margin-top: 1rem;
	display: flex;
	gap: 1rem;
	justify-content: flex-start;
	align-items: center;
}

.fb-video-transcript-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1.25rem;
	background: #000;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-family: var(--font-primary, "Lato", sans-serif);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.5;
	cursor: pointer;
	transition: all 0.2s ease;
	text-decoration: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.fb-video-transcript-btn:hover {
	background: #262626;
	color: #fff;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	transform: translateY(-1px);
}

.fb-video-transcript-btn:focus-visible {
	outline: 3px solid #f3971e;
	outline-offset: 3px;
	box-shadow: 0 0 0 3px rgba(243, 151, 30, 0.15);
}

.fb-video-transcript-btn .fb-icon,
.fb-video-transcript-btn svg {
	flex-shrink: 0;
	color: #fff;
}

.fb-video-transcript-btn .fb-icon path,
.fb-video-transcript-btn svg path {
	fill: currentColor;
}

.fb-video-transcript-btn span {
	color: #fff;
}

.fb-video-transcript-btn[aria-expanded="true"] {
	background: #262626;
	color: #fff;
}

.fb-video-transcript-btn[aria-expanded="true"] span {
	color: #fff;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
	.fb-video-transcript-btn {
		transition: none;
	}
}

/* ==========================================================================
   Modal de transcription - Style submenu France Boissons
   ========================================================================== */

.fb-transcript-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.fb-transcript-modal[hidden] {
	display: none;
}

/* Backdrop */
.fb-transcript-modal__backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.75);
	animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fb-transcript-modal__backdrop {
		animation: none;
	}
}

/* Container */
.fb-transcript-modal__container {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 900px;
	max-height: 85vh;
	display: flex;
	flex-direction: column;
	animation: slideUp 0.3s ease;
}

/* Tailles adaptatives selon les écrans */
@media (min-width: 1400px) {
	.fb-transcript-modal__container {
		max-width: 1000px;
		max-height: 80vh;
	}
}

@media (max-width: 1024px) {
	.fb-transcript-modal__container {
		max-width: 90vw;
		max-height: 85vh;
	}
}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translateY(30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.fb-transcript-modal__container {
		animation: none;
	}
}

/* Content - Style submenu blanc */
.fb-transcript-modal__content {
	background: #fff;
	border-radius: 0 0 12px 12px;
	box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.12);
	display: flex;
	flex-direction: column;
	max-height: 85vh;
	font-family: var(--font-primary, "Lato", sans-serif);
}

@media (min-width: 1400px) {
	.fb-transcript-modal__content {
		max-height: 80vh;
	}
}

/* Header */
.fb-transcript-modal__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.5rem;
	border-bottom: 1px solid #e5e5e5;
	flex-shrink: 0;
	background: #fff;
}

.fb-transcript-modal__title {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 700;
	color: #262626;
	line-height: 1.3;
	font-family: var(--font-primary, "Lato", sans-serif);
}

.fb-transcript-modal__close {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	background: transparent;
	border: 2px solid transparent;
	border-radius: 4px;
	color: #50575e;
	cursor: pointer;
	transition: all 0.2s ease;
}

.fb-transcript-modal__close:hover {
	background: #f0f0f1;
	color: #262626;
}

.fb-transcript-modal__close:focus-visible {
	outline: 3px solid #f3971e;
	outline-offset: 0;
	border-color: #f3971e;
}

/* Body - Texte noir sur fond blanc */
.fb-transcript-modal__body {
	flex: 1;
	overflow-y: auto;
	padding: 1.5rem;
	background: #fff;
	color: #262626;
	line-height: 1.7;
	max-height: calc(85vh - 180px);
	font-size: 15px;
}

@media (min-width: 1400px) {
	.fb-transcript-modal__body {
		max-height: calc(80vh - 180px);
		padding: 2rem;
		font-size: 16px;
	}
}

@media (max-width: 1024px) {
	.fb-transcript-modal__body {
		max-height: calc(85vh - 160px);
		padding: 1.25rem;
	}
}

.fb-transcript-modal__body:focus {
	outline: 2px solid #f3971e;
	outline-offset: -2px;
}

/* Scrollbar personnalisé */
.fb-transcript-modal__body::-webkit-scrollbar {
	width: 8px;
}

.fb-transcript-modal__body::-webkit-scrollbar-track {
	background: #f0f0f1;
	border-radius: 4px;
}

.fb-transcript-modal__body::-webkit-scrollbar-thumb {
	background: #f3971e;
	border-radius: 4px;
}

.fb-transcript-modal__body::-webkit-scrollbar-thumb:hover {
	background: #ed9e26;
}

/* Contenu de la transcription */
.fb-transcript-content {
	font-size: inherit;
	color: #262626;
}

.fb-transcript-content h1,
.fb-transcript-content h2,
.fb-transcript-content h3,
.fb-transcript-content h4,
.fb-transcript-content h5,
.fb-transcript-content h6 {
	margin-top: 1.5rem;
	margin-bottom: 0.75rem;
	font-weight: 700;
	color: #262626;
	font-family: var(--font-primary, "Lato", sans-serif);
}

.fb-transcript-content h1 {
	font-size: 1.75rem;
}

.fb-transcript-content h2 {
	font-size: 1.5rem;
}

.fb-transcript-content h3 {
	font-size: 1.25rem;
}

.fb-transcript-content p {
	margin: 0 0 1rem 0;
	color: #262626;
}

.fb-transcript-content ul,
.fb-transcript-content ol {
	margin: 0 0 1rem 1.5rem;
	padding: 0;
}

.fb-transcript-content li {
	margin-bottom: 0.5rem;
	color: #262626;
}

.fb-transcript-content strong,
.fb-transcript-content b {
	font-weight: 700;
	color: #262626;
}

.fb-transcript-content a {
	color: #f3971e;
	text-decoration: underline;
	font-weight: 600;
}

.fb-transcript-content a:hover,
.fb-transcript-content a:focus {
	color: #ed9e26;
}

/* Footer */
.fb-transcript-modal__footer {
	padding: 1rem 1.5rem;
	border-top: 1px solid #e5e5e5;
	background: #fff!important;
	display: flex;
	justify-content: flex-end;
	flex-shrink: 0;
}

.fb-transcript-modal__close-btn {
	padding: 0.75rem 1.5rem;
	background: #000;
	color: #fff!important;
	border: none;
	border-radius: 4px;
	font-family: var(--font-primary, "Lato", sans-serif);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.fb-transcript-modal__close-btn:hover {
	background: #262626;
	color: #fff;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	transform: translateY(-1px);
}

.fb-transcript-modal__close-btn:focus-visible {
	outline: 3px solid #f3971e;
	outline-offset: 3px;
	box-shadow: 0 0 0 3px rgba(243, 151, 30, 0.15);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
	.fb-transcript-modal {
		padding: 0.5rem;
	}

	.fb-transcript-modal__container {
		max-width: 100%;
		max-height: 92vh;
	}

	.fb-transcript-modal__content {
		max-height: 92vh;
		border-radius: 8px;
	}

	.fb-transcript-modal__header {
		padding: 1rem;
	}

	.fb-transcript-modal__title {
		font-size: 1.25rem;
	}

	.fb-transcript-modal__close {
		width: 36px;
		height: 36px;
	}

	.fb-transcript-modal__body {
		padding: 1rem;
		max-height: calc(92vh - 140px);
		font-size: 15px;
	}

	.fb-transcript-modal__footer {
		padding: 0.75rem 1rem;
	}

	.fb-video-player__actions {
		flex-direction: column;
		align-items: stretch;
	}

	.fb-video-transcript-btn {
		width: 100%;
		justify-content: center;
	}
}

@media (max-width: 480px) {
	.fb-transcript-modal {
		padding: 0;
	}

	.fb-transcript-modal__container {
		max-height: 100vh;
		border-radius: 0;
	}

	.fb-transcript-modal__content {
		max-height: 100vh;
		border-radius: 0;
	}

	.fb-transcript-modal__header {
		padding: 0.875rem;
	}

	.fb-transcript-modal__title {
		font-size: 1.125rem;
	}

	.fb-transcript-modal__body {
		padding: 0.875rem;
		max-height: calc(100vh - 120px);
		font-size: 14px;
	}

	.fb-transcript-modal__footer {
		padding: 0.75rem;
	}
}

/* ==========================================================================
   Dark mode support pour les boutons (pas pour la modal)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
	.fb-video-transcript-btn {
		background: #1a1a1a;
		color: #c85f0f;
		border-color: #c85f0f;
	}

	.fb-video-transcript-btn:hover {
		background: #c85f0f;
		border-color: #c85f0f;
		color: #fff;
	}

	.fb-video-transcript-btn:focus-visible {
		outline-color: #c85f0f;
		box-shadow: 0 0 0 3px rgba(200, 95, 15, 0.15);
	}

	.fb-video-transcript-btn[aria-expanded="true"] {
		background: #c85f0f;
		color: #fff;
	}

	.fb-transcript-modal__close-btn {
		background: #1a1a1a;
		color: #c85f0f;
		border-color: #c85f0f;
	}

	.fb-transcript-modal__close-btn:hover {
		background: #c85f0f;
		border-color: #c85f0f;
		color: #fff;
	}
}

/* ==========================================================================
   Erreur
   ========================================================================== */

.fb-video-player-error {
	padding: 1rem;
	background: #fcf0ed;
	border-left: 4px solid #d63638;
	color: #761b05;
	border-radius: 4px;
	margin: 1rem 0;
	font-family: var(--font-primary, "Lato", sans-serif);
	font-size: 15px;
	font-weight: 600;
}
