/* ==========================================================================
   Stories Vídeos — estilos do frontend (bubble + player)
   ========================================================================== */

/* --------------------------------------------------------------------------
   BUBBLE
   -------------------------------------------------------------------------- */
.stories-bubble {
	position: fixed;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	align-items: center;
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
	/* Reset defensivo contra bordas/fundos herdados do tema. */
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	outline: none !important;
	padding: 0 !important;
	margin: 0 !important;
}

.stories-bubble:focus,
.stories-bubble:focus-visible {
	outline: none !important;
}

.stories-bubble-inner {
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
}

.stories-bubble[hidden] {
	display: none;
}

.stories-bubble.pos-bottom-right { right: var( --sv-margin-side, 20px ); bottom: var( --sv-margin-bottom, 20px ); }
.stories-bubble.pos-bottom-left  { left: var( --sv-margin-side, 20px ); bottom: var( --sv-margin-bottom, 20px ); }
.stories-bubble.pos-center-right { right: var( --sv-margin-side, 20px ); top: 50%; transform: translateY( -50% ); }
.stories-bubble.pos-center-left  { left: var( --sv-margin-side, 20px ); top: 50%; transform: translateY( -50% ); }

.stories-bubble-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.stories-bubble-border {
	width: var( --sv-size, 92px );
	height: var( --sv-size, 92px );
	border-radius: 50%;
	padding: var( --sv-border-w, 3px );
	background: var( --sv-border-color, #ffffff );
	box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.25 );
	box-sizing: border-box;
}

.stories-bubble-media {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	overflow: hidden;
	background: #000;
	border: 2px solid #fff;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
}

.stories-bubble-media video,
.stories-bubble-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.stories-bubble-play {
	color: #fff;
	font-size: 24px;
}

.stories-bubble-close,
.stories-bubble .stories-bubble-close,
button.stories-bubble-close {
	all: unset !important;
	position: absolute !important;
	top: -6px !important;
	right: -6px !important;
	width: 22px !important;
	height: 22px !important;
	min-width: 22px !important;
	min-height: 22px !important;
	max-width: 22px !important;
	max-height: 22px !important;
	background: #fff !important;
	color: #333 !important;
	border: none !important;
	border-radius: 50% !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	padding: 0 !important;
	margin: 0 !important;
	line-height: 1 !important;
	font-size: 16px !important;
	box-sizing: border-box !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	z-index: 2 !important;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.3 ) !important;
}

.stories-bubble.pos-bottom-left .stories-bubble-close,
.stories-bubble.pos-center-left .stories-bubble-close {
	right: auto !important;
	left: -6px !important;
}

/* Animações do bubble */
.stories-bubble.anim-pulse .stories-bubble-border { animation: stories-pulse 2s ease-in-out infinite; }
.stories-bubble.anim-bounce .stories-bubble-border { animation: stories-bounce 2s ease-in-out infinite; }

@keyframes stories-pulse {
	0%   { box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.25 ), 0 0 0 0 rgba( 139, 92, 246, 0.5 ); }
	70%  { box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.25 ), 0 0 0 14px rgba( 139, 92, 246, 0 ); }
	100% { box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.25 ), 0 0 0 0 rgba( 139, 92, 246, 0 ); }
}

@keyframes stories-bounce {
	0%, 100% { transform: translateY( 0 ); }
	50%      { transform: translateY( -8px ); }
}

.stories-bubble-enter { animation: stories-fade-in 0.4s ease; }

@keyframes stories-fade-in {
	from { opacity: 0; transform: scale( 0.8 ); }
	to   { opacity: 1; transform: scale( 1 ); }
}

/* --------------------------------------------------------------------------
   PLAYER
   -------------------------------------------------------------------------- */

/* Esconde widgets flutuantes de terceiros enquanto o player está aberto. */
body.stories-player-open .woot-widget-bubble,
body.stories-player-open .woot--bubble-holder,
body.stories-player-open .woot-widget-holder {
	display: none !important;
}

.stories-player {
	position: fixed;
	inset: 0;
	z-index: 1000000;
	/* Altura real da viewport visível (respeita a barra de endereço no mobile). */
	height: 100vh;
	height: 100dvh;
	background: var( --sv-player-bg, rgba( 0, 0, 0, 0.95 ) );
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.stories-player[hidden] { display: none; }
.stories-player.is-open { opacity: 1; }

.stories-player-stage {
	position: relative;
	width: 100%;
	max-width: 420px;
	height: 100%;
	max-height: 100vh;
	max-height: 100dvh;
	aspect-ratio: 9 / 16;
	background: #000;
	overflow: hidden;
	border-radius: 0;
}

@media ( min-width: 768px ) {
	.stories-player-stage {
		height: 90vh;
		max-height: 90vh;
		border-radius: 14px;
		box-shadow: 0 12px 48px rgba( 0, 0, 0, 0.5 );
	}
}

.stories-video-wrap {
	position: absolute;
	inset: 0;
}

.stories-video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #000;
}

/* Barras de progresso */
.stories-progress {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	gap: 4px;
	padding: 10px 10px 0;
	z-index: 5;
}

.stories-progress-bar {
	flex: 1;
	height: 3px;
	border-radius: 3px;
	background: rgba( 255, 255, 255, 0.35 );
	overflow: hidden;
}

.stories-progress-fill {
	display: block;
	height: 100%;
	width: 0;
	background: #fff;
}

.stories-progress-bar.is-done .stories-progress-fill { width: 100%; }

/* Topbar */
.stories-topbar {
	position: absolute;
	top: 16px;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 12px;
	z-index: 6;
}

.stories-branding {
	display: flex;
	align-items: center;
	gap: 8px;
	color: #fff;
}

.stories-branding-logo { height: 26px; width: auto; border-radius: 4px; }
.stories-branding-text { font-size: 13px; font-weight: 600; text-shadow: 0 1px 3px rgba( 0, 0, 0, 0.5 ); }

.stories-controls { display: flex; align-items: center; gap: 10px; }

/* Reset forte contra temas (ex.: Flatsome) que estilizam todo <button>. */
.stories-player .stories-btn {
	all: unset !important;
	width: 46px !important;
	height: 46px !important;
	min-width: 46px !important;
	min-height: 46px !important;
	max-width: 46px !important;
	max-height: 46px !important;
	border: none !important;
	border-radius: 50% !important;
	background: rgba( 0, 0, 0, 0.38 ) !important;
	color: #fff !important;
	cursor: pointer !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 0 !important;
	margin: 0 !important;
	font-size: 0 !important;
	line-height: 1 !important;
	box-sizing: border-box !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

/* Sem "display" aqui: a visibilidade é controlada por style inline (JS toggle). */
.stories-player .stories-btn svg {
	width: 26px !important;
	height: 26px !important;
	min-width: 26px !important;
	min-height: 26px !important;
	fill: #fff !important;
	flex-shrink: 0 !important;
}

.stories-player .stories-btn.stories-close svg {
	width: 24px !important;
	height: 24px !important;
	min-width: 24px !important;
	min-height: 24px !important;
}

/* Navegação */
.stories-nav {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 35%;
	border: none;
	background: transparent;
	cursor: pointer;
	z-index: 4;
}

.stories-nav-prev { left: 0; }
.stories-nav-next { right: 0; }

.stories-tap-pause {
	position: absolute;
	top: 15%;
	bottom: 15%;
	left: 35%;
	right: 35%;
	border: none;
	background: transparent;
	cursor: pointer;
	z-index: 3;
}

/* Ações laterais */
.stories-actions {
	position: absolute;
	right: 12px;
	bottom: 120px;
	display: flex;
	flex-direction: column;
	gap: 26px;
	z-index: 6;
}

.stories-action {
	position: relative;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: none;
	background: rgba( 0, 0, 0, 0.4 );
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.3 );
	transition: transform 0.15s ease;
}

.stories-action:active { transform: scale( 1.12 ); }

.stories-action-icon {
	font-size: 24px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.stories-action-icon svg {
	width: 26px;
	height: 26px;
	fill: #fff;
	display: block;
}

.stories-action-count {
	position: absolute;
	bottom: -17px;
	left: 50%;
	transform: translateX( -50% );
	font-size: 11px;
	font-weight: 600;
	color: #fff;
	text-shadow: 0 1px 2px rgba( 0, 0, 0, 0.6 );
}

.stories-action-like.is-liked { background: rgba( 255, 45, 85, 0.18 ); }
.stories-action-like.is-liked .stories-action-icon { color: #ff2d55; }

.stories-action-whatsapp { background: #25d366; }
.stories-action-whatsapp:hover { background: #1ebe5b; }

/* Card de produto — fundo escuro translúcido, card inteiro é link */
.stories-product-card {
	position: absolute !important;
	bottom: 20px !important;
	left: 12px !important;
	right: 12px !important;
	background: rgba( 0, 0, 0, 0.65 ) !important;
	backdrop-filter: blur( 12px ) !important;
	-webkit-backdrop-filter: blur( 12px ) !important;
	border-radius: 16px !important;
	display: flex !important;
	align-items: center !important;
	padding: 10px !important;
	gap: 12px !important;
	z-index: 10 !important;
	border: none !important;
	box-shadow: none !important;
	text-decoration: none !important;
}

/* Mantém o toggle por atributo hidden (vence o display:flex !important). */
.stories-product-card[hidden] { display: none !important; }

.stories-product-card-image {
	width: 56px !important;
	height: 56px !important;
	min-width: 56px !important;
	border-radius: 10px !important;
	object-fit: cover !important;
	flex-shrink: 0 !important;
}

.stories-product-card-info {
	flex: 1 !important;
	min-width: 0 !important;
	overflow: hidden !important;
}

.stories-product-card-name {
	font-size: 14px !important;
	font-weight: 500 !important;
	margin: 0 !important;
	padding: 0 !important;
	color: #ffffff !important;
	line-height: 1.3 !important;
	display: -webkit-box !important;
	-webkit-line-clamp: 2 !important;
	-webkit-box-orient: vertical !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	text-align: left !important;
}

.stories-product-card-price {
	font-size: 15px !important;
	font-weight: 500 !important;
	margin: 0 !important;
	padding: 0 !important;
	color: #22c55e !important;
	text-align: left !important;
}

/* Badge de oferta + preço promocional riscado */
.stories-product-badge-oferta {
	position: absolute !important;
	top: -8px !important;
	left: 12px !important;
	background: #ef4444 !important;
	color: #ffffff !important;
	font-size: 10px !important;
	font-weight: 500 !important;
	padding: 3px 8px !important;
	border-radius: 6px !important;
	letter-spacing: 0.03em !important;
	line-height: 1 !important;
	z-index: 2 !important;
	margin: 0 !important;
	text-transform: uppercase !important;
}

.stories-product-badge-oferta[hidden] { display: none !important; }

.stories-product-price-wrapper {
	display: flex !important;
	align-items: center !important;
	gap: 8px !important;
	margin-top: 4px !important;
}

.stories-product-price-old {
	font-size: 12px !important;
	color: rgba( 255, 255, 255, 0.5 ) !important;
	text-decoration: line-through !important;
	margin: 0 !important;
	padding: 0 !important;
	font-weight: 400 !important;
}

.stories-product-price-old[hidden] { display: none !important; }

.stories-product-card-btn {
	all: unset !important;
	width: 40px !important;
	height: 40px !important;
	min-width: 40px !important;
	min-height: 40px !important;
	background: #8b5cf6 !important;
	color: #ffffff !important;
	border-radius: 50% !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex-shrink: 0 !important;
	cursor: pointer !important;
	transition: background-color 0.2s ease !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
}

.stories-product-card-btn:hover { background: #7c3aed !important; }

.stories-product-card-btn svg {
	width: 22px !important;
	height: 22px !important;
	fill: #ffffff !important;
}

/* Modal de comentários */
.stories-comments-modal {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: 70%;
	background: #fff;
	border-radius: 16px 16px 0 0;
	display: flex;
	flex-direction: column;
	z-index: 8;
	transform: translateY( 100% );
	transition: transform 0.25s ease;
}

.stories-comments-modal[hidden] { display: none; }
.stories-comments-modal.is-open { transform: translateY( 0 ); }

.stories-comments-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	border-bottom: 1px solid #eee;
	font-weight: 700;
	color: #111;
}

.stories-comments-close { border: none; background: none; font-size: 22px; cursor: pointer; color: #555; }

.stories-comments-list {
	flex: 1;
	overflow-y: auto;
	padding: 12px 16px;
	min-height: 80px;
}

.stories-comment-item { margin-bottom: 12px; color: #222; }
.stories-comment-item strong { display: block; font-size: 13px; }
.stories-comment-item span { font-size: 14px; }
.stories-comments-empty { color: #888; font-size: 14px; text-align: center; padding: 16px 0; }

.stories-comments-form { padding: 10px 16px 16px; border-top: 1px solid #eee; }
.stories-comments-form input {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid #ddd;
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 14px;
	margin-bottom: 8px;
}

.stories-comment-row { display: flex; gap: 8px; margin-bottom: 0; }
.stories-comment-row .stories-comment-text { margin-bottom: 0; }

.stories-comment-send {
	border: none;
	background: #8b5cf6;
	color: #fff;
	border-radius: 8px;
	padding: 8px 16px;
	font-weight: 700;
	cursor: pointer;
	flex-shrink: 0;
}

/* Mobile fullscreen + safe area */
@media ( max-width: 767px ) {
	.stories-player-stage {
		max-width: 100vw;
		width: 100vw;
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
		aspect-ratio: auto;
		padding-top: env( safe-area-inset-top );
		padding-bottom: env( safe-area-inset-bottom );
	}
}
