/* ==========================================================================
   Studio Visuali — Cookie Consent Banner
   Supports: RTL (Hebrew) + LTR (English) | Mobile-first | 3 banner types
   ========================================================================== */

/* ---- CSS Custom Properties (overridden by JS) ---- */
:root {
	--vcc-bg: #ffffff;
	--vcc-text: #1a1a1a;
	--vcc-text-secondary: #555555;
	--vcc-btn-accept-bg: #1e4da1;
	--vcc-btn-accept-text: #ffffff;
	--vcc-btn-reject-bg: #f0f0f0;
	--vcc-btn-reject-text: #333333;
	--vcc-btn-settings-bg: transparent;
	--vcc-btn-settings-text: #1e4da1;
	--vcc-toggle-on: #1e4da1;
	--vcc-toggle-off: #cccccc;
	--vcc-overlay: rgba(0, 0, 0, 0.5);
	--vcc-radius: 12px;
	--vcc-shadow-subtle: 0 4px 24px rgba(0, 0, 0, 0.12);
	--vcc-shadow-strong: 0 8px 40px rgba(0, 0, 0, 0.28);
	--vcc-shadow: var(--vcc-shadow-subtle);
	--vcc-font-heading: inherit;
	--vcc-font-body: inherit;
	--vcc-font-size-primary: 15px;
	--vcc-font-size-secondary: 13px;
	--vcc-max-width: 520px;
	--vcc-logo-height: 32px;
}

/* ---- Reset for banner elements ---- */
#visuali-cc-wrap,
#visuali-cc-wrap * {
	box-sizing: border-box;
}

/* ---- Overlay ---- */
.visuali-cc-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: var(--vcc-overlay);
	z-index: 99998;
}

/* Show overlay only in modal mode */
#visuali-cc-wrap.vcc-modal .visuali-cc-overlay {
	display: block;
}

/* ---- Banner Wrapper ---- */
#visuali-cc-wrap {
	z-index: 99999;
}

/* ---- Base Banner ---- */
.visuali-cc-banner {
	background: var(--vcc-bg);
	color: var(--vcc-text);
	font-family: var(--vcc-font-body), -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: var(--vcc-font-size-primary);
	line-height: 1.6;
	border-radius: var(--vcc-radius);
	box-shadow: var(--vcc-shadow);
	padding: 24px;
	z-index: 99999;
	position: fixed;
	max-height: 90vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

/* ---- RTL support ---- */
#visuali-cc-wrap[dir="rtl"] .visuali-cc-banner {
	direction: rtl;
	text-align: right;
}
#visuali-cc-wrap[dir="ltr"] .visuali-cc-banner {
	direction: ltr;
	text-align: left;
}

/* ============ MODAL (default) ============ */
#visuali-cc-wrap.vcc-modal .visuali-cc-banner {
	width: 92vw;
	max-width: var(--vcc-max-width);
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	border-radius: var(--vcc-radius);
}

/* ============ BOTTOM BAR ============ */
#visuali-cc-wrap.vcc-bottom-bar .visuali-cc-banner {
	width: 100%;
	max-width: 100%;
	left: 0;
	right: 0;
	bottom: 0;
	border-radius: var(--vcc-radius) var(--vcc-radius) 0 0;
	padding: 20px 24px;
	padding-bottom: calc(20px + env(safe-area-inset-bottom));
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
}

#visuali-cc-wrap.vcc-bottom-bar.vcc-pos-top .visuali-cc-banner {
	top: 0;
	bottom: auto;
	border-radius: 0 0 var(--vcc-radius) var(--vcc-radius);
}

#visuali-cc-wrap.vcc-bottom-bar .visuali-cc-logo-wrap,
#visuali-cc-wrap.vcc-bottom-bar .visuali-cc-title {
	flex: 0 0 auto;
}

#visuali-cc-wrap.vcc-bottom-bar .visuali-cc-desc-wrap {
	flex: 1 1 300px;
}

#visuali-cc-wrap.vcc-bottom-bar .visuali-cc-actions {
	flex: 0 0 auto;
}

/* ============ CORNER WIDGET ============ */
#visuali-cc-wrap.vcc-corner .visuali-cc-banner {
	width: 340px;
	max-width: calc(100vw - 32px);
	bottom: 16px;
	right: 16px;
	border-radius: var(--vcc-radius);
}

#visuali-cc-wrap.vcc-corner.vcc-pos-bottom-left .visuali-cc-banner {
	right: auto;
	left: 16px;
}

/* ---- Logo ---- */
.visuali-cc-logo-wrap {
	margin-bottom: 14px;
}
.visuali-cc-logo-wrap img {
	height: var(--vcc-logo-height);
	width: auto;
	display: block;
}

/* ---- Title ---- */
.visuali-cc-title {
	font-family: var(--vcc-font-heading), var(--vcc-font-body), -apple-system, sans-serif;
	font-size: calc(var(--vcc-font-size-primary) + 3px);
	font-weight: 700;
	margin: 0 0 10px;
	line-height: 1.3;
}

/* ---- Description ---- */
.visuali-cc-desc {
	color: var(--vcc-text-secondary);
	font-size: var(--vcc-font-size-secondary);
	margin: 0 0 6px;
}

.visuali-cc-voluntary {
	color: var(--vcc-text-secondary);
	font-size: calc(var(--vcc-font-size-secondary) - 1px);
	font-style: italic;
	margin: 0 0 16px;
}

/* ---- Privacy link ---- */
.visuali-cc-privacy {
	margin: 12px 0 0;
	font-size: var(--vcc-font-size-secondary);
}
.visuali-cc-privacy a {
	color: var(--vcc-btn-settings-text);
	text-decoration: underline;
}
.visuali-cc-privacy a:hover {
	opacity: 0.8;
}

/* ---- Actions / Buttons ---- */
.visuali-cc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}

.visuali-cc-btn {
	display: inline-block;
	border: none;
	cursor: pointer;
	font-family: inherit;
	font-size: var(--vcc-font-size-secondary);
	font-weight: 600;
	padding: 10px 20px;
	min-height: 44px;
	border-radius: calc(var(--vcc-radius) * 0.6);
	transition: opacity 0.18s, transform 0.12s;
	outline-offset: 3px;
	white-space: nowrap;
}
.visuali-cc-btn:focus-visible {
	outline: 2px solid var(--vcc-btn-accept-bg);
}
.visuali-cc-btn:hover {
	opacity: 0.88;
}
.visuali-cc-btn:active {
	transform: scale(0.97);
}

.visuali-cc-btn-accept {
	background: var(--vcc-btn-accept-bg);
	color: var(--vcc-btn-accept-text);
}

.visuali-cc-btn-reject {
	background: var(--vcc-btn-reject-bg);
	color: var(--vcc-btn-reject-text);
}

.visuali-cc-btn-settings {
	background: var(--vcc-btn-settings-bg);
	color: var(--vcc-btn-settings-text);
	text-decoration: underline;
	padding-inline-start: 4px;
	padding-inline-end: 4px;
}

/* ---- Customize Panel ---- */
.visuali-cc-customize {
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	margin-top: 18px;
	padding-top: 18px;
}

/* ---- Category row ---- */
.visuali-cc-cat {
	margin-bottom: 16px;
}

.visuali-cc-cat-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-bottom: 4px;
}

.visuali-cc-cat-label {
	font-weight: 600;
	font-size: var(--vcc-font-size-secondary);
}

.visuali-cc-cat-desc {
	font-size: calc(var(--vcc-font-size-secondary) - 1px);
	color: var(--vcc-text-secondary);
	margin: 0;
}

/* ---- Toggle Switch ---- */
.visuali-cc-toggle {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
	flex-shrink: 0;
	cursor: pointer;
}

.visuali-cc-toggle-input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	margin: 0;
	cursor: pointer;
	z-index: 1;
}

.visuali-cc-toggle-track {
	display: block;
	width: 44px;
	height: 24px;
	background: var(--vcc-toggle-off);
	border-radius: 12px;
	transition: background 0.2s;
	position: relative;
}

.visuali-cc-toggle-thumb {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.visuali-cc-toggle-input:checked + .visuali-cc-toggle-track {
	background: var(--vcc-toggle-on);
}

.visuali-cc-toggle-input:checked + .visuali-cc-toggle-track .visuali-cc-toggle-thumb {
	transform: translateX(20px);
}

.visuali-cc-toggle-input:focus-visible + .visuali-cc-toggle-track {
	outline: 2px solid var(--vcc-toggle-on);
	outline-offset: 2px;
}

/* Locked toggle (necessary) */
.visuali-cc-toggle-locked .visuali-cc-toggle-track {
	background: var(--vcc-toggle-on);
	opacity: 0.6;
	cursor: not-allowed;
}

/* RTL toggle flip */
[dir="rtl"] .visuali-cc-toggle-input:checked + .visuali-cc-toggle-track .visuali-cc-toggle-thumb {
	transform: translateX(-20px);
}
[dir="rtl"] .visuali-cc-toggle-thumb {
	left: auto;
	right: 3px;
}

/* ---- Manage Button (floating) ---- */
.visuali-cc-manage-btn {
	position: fixed;
	bottom: 16px;
	left: 16px;
	z-index: 99990;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--vcc-btn-accept-bg);
	color: var(--vcc-btn-accept-text);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
	transition: transform 0.18s, opacity 0.18s;
	padding-bottom: env(safe-area-inset-bottom);
}

[dir="rtl"] ~ .visuali-cc-manage-btn,
.visuali-cc-manage-btn.vcc-rtl {
	left: auto;
	right: 16px;
}

.visuali-cc-manage-btn:hover {
	opacity: 0.88;
	transform: scale(1.08);
}

.visuali-cc-manage-btn:focus-visible {
	outline: 2px solid var(--vcc-btn-accept-bg);
	outline-offset: 3px;
}

/* ---- Animation ---- */
@keyframes vcc-slide-up {
	from { opacity: 0; transform: translateY(24px); }
	to   { opacity: 1; transform: translateY(0); }
}
@keyframes vcc-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

#visuali-cc-wrap.vcc-modal .visuali-cc-banner {
	animation: vcc-fade-in 0.22s ease;
}
#visuali-cc-wrap.vcc-bottom-bar .visuali-cc-banner,
#visuali-cc-wrap.vcc-corner .visuali-cc-banner {
	animation: vcc-slide-up 0.22s ease;
}

/* ============ RESPONSIVE ============ */

/* Mobile (< 640px) */
@media (max-width: 639px) {
	#visuali-cc-wrap.vcc-modal .visuali-cc-banner {
		width: 100%;
		max-width: 100%;
		top: auto;
		left: 0;
		right: 0;
		bottom: 0;
		transform: none;
		border-radius: var(--vcc-radius) var(--vcc-radius) 0 0;
		padding-bottom: calc(20px + env(safe-area-inset-bottom));
		max-height: 85vh;
	}

	#visuali-cc-wrap.vcc-corner .visuali-cc-banner {
		width: calc(100% - 32px);
		right: 16px;
		left: 16px;
	}

	.visuali-cc-actions {
		flex-direction: column;
	}

	.visuali-cc-btn {
		width: 100%;
		text-align: center;
	}

	#visuali-cc-wrap.vcc-bottom-bar .visuali-cc-banner {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* Tablet (640–1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
	#visuali-cc-wrap.vcc-modal .visuali-cc-banner {
		width: 90vw;
	}
}

/* Ensure no overflow on small viewports */
@media (max-width: 400px) {
	.visuali-cc-banner {
		padding: 18px 16px;
	}
	.visuali-cc-title {
		font-size: calc(var(--vcc-font-size-primary) + 1px);
	}
}
