/* =================================================================
   ФБ — Cookie-пилюля
   Дизайн-система V12: золото #c9a44e, красный #e8183a.
   ================================================================= */

.fb-cookie {
	position: fixed;
	left: 14px;
	bottom: 14px;
	background: rgba(20, 20, 24, .96);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border: 1px solid rgba(201, 164, 78, .35);
	color: #fff;
	box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
	z-index: 999990;
	font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	overflow: hidden;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	transform: translateY(140%);
	opacity: 0;
	visibility: hidden;
	transition:
		transform .55s cubic-bezier(.34, 1.56, .64, 1),
		opacity .35s ease,
		visibility .35s ease,
		width .42s cubic-bezier(.22, .9, .22, 1),
		border-radius .42s cubic-bezier(.22, .9, .22, 1),
		padding .42s cubic-bezier(.22, .9, .22, 1);
	will-change: transform, width, border-radius;
	box-sizing: border-box;
}

.fb-cookie *,
.fb-cookie *::before,
.fb-cookie *::after {
	box-sizing: border-box;
}

.fb-cookie.is-visible {
	transform: translateY(0);
	opacity: 1;
	visibility: visible;
}

/* === Свёрнутое состояние: пилюля === */
.fb-cookie[data-state="collapsed"] {
	width: 240px;
	max-width: calc(100% - 80px);
	border-radius: 999px;
	padding: 6px 6px 6px 14px;
	display: flex;
	align-items: center;
	gap: 10px;
}

/* === Развёрнутое состояние: карточка === */
.fb-cookie[data-state="expanded"] {
	width: calc(100% - 28px);
	max-width: 480px;
	border-radius: 18px;
	padding: 16px 16px 14px;
	cursor: default;
	display: block;
}

@media (min-width: 768px) {
	.fb-cookie[data-state="expanded"] {
		max-width: 420px;
	}
}

/* === Иконка === */
.fb-cookie__ico {
	font-size: 17px;
	flex-shrink: 0;
	line-height: 1;
	display: inline-block;
	transition: transform .42s cubic-bezier(.34, 1.56, .64, 1);
}

.fb-cookie[data-state="expanded"] .fb-cookie__ico {
	transform: scale(1.25);
	display: inline-block;
	margin-bottom: 8px;
}

/* === Короткий текст пилюли === */
.fb-cookie__short {
	font-size: 12.5px;
	font-weight: 600;
	flex: 1;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: opacity .25s ease;
	color: #fff;
}

.fb-cookie[data-state="expanded"] .fb-cookie__short {
	opacity: 0;
	pointer-events: none;
	position: absolute;
	visibility: hidden;
}

/* === Заголовок карточки === */
.fb-cookie__title {
	font-family: 'Cormorant Garamond', Georgia, serif;
	font-size: 18px;
	font-weight: 600;
	color: #fff;
	margin: 0 0 8px;
	display: none;
}

.fb-cookie[data-state="expanded"] .fb-cookie__title {
	display: block;
	animation: fbCookieFadeUp .45s .15s both ease;
}

/* === Описание === */
.fb-cookie__desc {
	font-size: 13px;
	line-height: 1.5;
	color: rgba(255, 255, 255, .78);
	margin: 0 0 10px;
	display: none;
}

.fb-cookie[data-state="expanded"] .fb-cookie__desc {
	display: block;
	animation: fbCookieFadeUp .45s .2s both ease;
}

.fb-cookie__desc p {
	margin: 0 0 6px;
}

.fb-cookie__desc p:last-child {
	margin-bottom: 0;
}

.fb-cookie__desc a {
	color: #e8c97a;
	text-decoration: underline;
}

/* === Ссылка на политику === */
.fb-cookie__link {
	color: #e8c97a !important;
	text-decoration: underline;
	font-size: 12.5px;
	font-weight: 500;
	display: none;
	margin: 0 0 14px;
	transition: color .2s ease;
}

.fb-cookie__link:hover {
	color: #fff !important;
}

.fb-cookie[data-state="expanded"] .fb-cookie__link {
	display: inline-block;
	animation: fbCookieFadeUp .45s .25s both ease;
}

/* === Кнопки === */
.fb-cookie__actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
	align-items: center;
}

.fb-cookie[data-state="expanded"] .fb-cookie__actions {
	width: 100%;
	margin-top: 4px;
	animation: fbCookieFadeUp .45s .3s both ease;
}

.fb-cookie__btn {
	border: none;
	font-weight: 700;
	cursor: pointer;
	font-family: inherit;
	transition: transform .2s ease, background .25s ease, box-shadow .25s ease;
	flex-shrink: 0;
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
	line-height: 1.2;
}

.fb-cookie__btn:active {
	transform: scale(.96);
}

/* Главная кнопка "Принять" */
.fb-cookie__btn--accept {
	background: linear-gradient(135deg, #e8183a, #ff4060);
	color: #fff;
	padding: 8px 14px;
	border-radius: 999px;
	font-size: 12px;
	box-shadow: 0 3px 10px rgba(232, 24, 58, .35);
}

.fb-cookie__btn--accept:hover {
	box-shadow: 0 5px 14px rgba(232, 24, 58, .45);
}

.fb-cookie[data-state="expanded"] .fb-cookie__btn--accept {
	flex: 1;
	padding: 11px 16px;
	font-size: 13px;
	border-radius: 12px;
}

/* Вторичная кнопка "Только необходимые" */
.fb-cookie__btn--essential {
	display: none;
	background: rgba(255, 255, 255, .08);
	color: rgba(255, 255, 255, .85);
	padding: 11px 14px;
	border-radius: 12px;
	font-size: 12px;
	border: 1px solid rgba(255, 255, 255, .12);
}

.fb-cookie__btn--essential:active {
	background: rgba(255, 255, 255, .14);
}

.fb-cookie[data-state="expanded"] .fb-cookie__btn--essential {
	display: inline-block;
}

/* === Крестик (свернуть обратно) === */
.fb-cookie__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .1);
	color: rgba(255, 255, 255, .7);
	border: none;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: none;
	font-family: Arial, sans-serif;
	padding: 0;
	transition: background .2s ease;
	z-index: 2;
}

.fb-cookie__close:hover,
.fb-cookie__close:active {
	background: rgba(255, 255, 255, .2);
}

.fb-cookie[data-state="expanded"] .fb-cookie__close {
	display: flex;
	align-items: center;
	justify-content: center;
	animation: fbCookieFadeIn .3s .35s both ease;
}

/* =================================================================
   АНИМАЦИИ ВНИМАНИЯ
   ================================================================= */

@keyframes fbCookieWiggle {
	0%, 100% { transform: translateX(0) rotate(0deg); }
	15%      { transform: translateX(-4px) rotate(-1.5deg); }
	30%      { transform: translateX(4px) rotate(1.5deg); }
	45%      { transform: translateX(-3px) rotate(-1deg); }
	60%      { transform: translateX(3px) rotate(1deg); }
	75%      { transform: translateX(-1px) rotate(-.3deg); }
}

.fb-cookie.is-wiggling[data-state="collapsed"] {
	animation: fbCookieWiggle .8s ease;
}

@keyframes fbCookieGoldPulse {
	0%, 100% {
		box-shadow: 0 10px 28px rgba(0, 0, 0, .45), 0 0 0 0 rgba(201, 164, 78, 0);
		border-color: rgba(201, 164, 78, .35);
	}
	50% {
		box-shadow: 0 10px 28px rgba(0, 0, 0, .45), 0 0 0 8px rgba(201, 164, 78, 0);
		border-color: rgba(232, 201, 122, .85);
	}
}

.fb-cookie.is-pulsing[data-state="collapsed"] {
	animation: fbCookieGoldPulse 1.6s ease-in-out;
}

@keyframes fbCookieFadeUp {
	0%   { opacity: 0; transform: translateY(6px); }
	100% { opacity: 1; transform: translateY(0); }
}

@keyframes fbCookieFadeIn {
	0%   { opacity: 0; }
	100% { opacity: 1; }
}

/* === Состояние "согласие получено" — баннер уезжает === */
.fb-cookie.is-accepted {
	transform: translateY(140%) scale(.92);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

/* === Узкие экраны === */
@media (max-width: 360px) {
	.fb-cookie[data-state="collapsed"] {
		width: 200px;
	}
	.fb-cookie__short { font-size: 11.5px; }
}

/* === Уважение к prefers-reduced-motion === */
@media (prefers-reduced-motion: reduce) {
	.fb-cookie,
	.fb-cookie__ico,
	.fb-cookie__title,
	.fb-cookie__desc,
	.fb-cookie__link,
	.fb-cookie__actions,
	.fb-cookie__close {
		animation: none !important;
		transition-duration: .15s !important;
	}
	.fb-cookie.is-wiggling[data-state="collapsed"],
	.fb-cookie.is-pulsing[data-state="collapsed"] {
		animation: none !important;
	}
}

/* === Учитываем чат-виджеты (Jivo, Bitrix, BUSINESSCAT etc.) === */
/* Если кнопка чата в правом нижнем углу — наша пилюля слева, не пересекается. */
/* Но если чат в левом нижнем — поднимаем нашу пилюлю выше. */
.has-bottom-left-chat .fb-cookie {
	bottom: 80px;
}

/* =================================================================
   COMPAT: защита от стилей Flatsome (и других тем)
   Тема применяет к <button> и .button глобально: text-transform: uppercase,
   padding: 0 1em, min-height, letter-spacing, border-radius: 0 и т.п.
   Этот блок имеет специфичность 1,1,0 (через id), что перебивает
   классовые селекторы темы без !important.
   ================================================================= */

/* Крестик закрытия — фиксируем круглую форму 28×28 */
#fbCookiePill .fb-cookie__close {
	width: 28px;
	height: 28px;
	min-width: 28px;
	min-height: 28px;
	max-width: 28px;
	max-height: 28px;
	padding: 0;
	margin: 0;
	border: none;
	line-height: 1;
	font-size: 20px;
	letter-spacing: 0;
	text-transform: none;
	border-radius: 50%;
	box-sizing: border-box;
	flex-shrink: 0;
}

/* Кнопки действий — снимаем min-* темы, оставляем свои размеры */
#fbCookiePill .fb-cookie__btn {
	min-width: 0;
	min-height: 0;
	box-sizing: border-box;
	border: none;
	margin: 0;
}

#fbCookiePill[data-state="expanded"] .fb-cookie__btn--accept {
	min-height: 0;
	padding: 11px 16px;
	border-radius: 12px;
}

#fbCookiePill[data-state="expanded"] .fb-cookie__btn--essential {
	min-height: 0;
	padding: 11px 14px;
	border-radius: 12px;
}

/* Если хочется убрать UPPERCASE с кнопок — раскомментируй:
#fbCookiePill .fb-cookie__btn {
	text-transform: none;
	letter-spacing: 0;
}
*/
