/**
 * NadoviTools Cookie Consent Modal Styles
 *
 * Glassmorphism modal with dark overlay, fade+scale animation, scroll lock,
 * custom toggle switches, and responsive layout.
 *
 * z-index: overlay 99998, modal 99999 — safely above WooCommerce overlays (~9999).
 * backdrop-filter: progressive enhancement with solid fallback for older browsers.
 *
 * @package NadoviTools\Core\Cookie_Consent
 */

/* ==========================================================================
   OVERLAY
   ========================================================================== */

.nadovi-cookie-overlay {
	position: fixed;
	inset: 0;
	background: rgba( 0, 0, 0, 0.6 );
	-webkit-backdrop-filter: blur( 2px );
	backdrop-filter: blur( 2px );
	z-index: 99998;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.nadovi-cookie-overlay.is-visible {
	opacity: 1;
	pointer-events: auto;
}

/* ==========================================================================
   MODAL — Solid fallback (older browsers without backdrop-filter)
   ========================================================================== */

.nadovi-cookie-modal {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% ) scale( 0.95 );
	background: rgba( 30, 30, 40, 0.92 ); /* Solid fallback */
	border: 1px solid rgba( 255, 255, 255, 0.18 );
	border-radius: 16px;
	box-shadow: 0 8px 32px rgba( 0, 0, 0, 0.4 );
	max-width: 520px;
	width: calc( 100% - 2rem );
	padding: 2rem;
	z-index: 99999;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.3s ease;
	/* Ensure modal is scrollable if content overflows on small screens */
	max-height: calc( 100vh - 2rem );
	overflow: hidden;
}

/* Glassmorphism enhancement for browsers that support backdrop-filter */
@supports ( backdrop-filter: blur( 16px ) ) {
	.nadovi-cookie-modal {
		background: rgba( 255, 255, 255, 0.12 );
		-webkit-backdrop-filter: blur( 16px );
		backdrop-filter: blur( 16px );
	}
}

.nadovi-cookie-modal.is-visible {
	opacity: 1;
	pointer-events: auto;
	transform: translate( -50%, -50% ) scale( 1 );
}

/* ==========================================================================
   MODAL TYPOGRAPHY
   ========================================================================== */

.nadovi-cookie-modal h2 {
	color: #ffffff;
	font-size: 1.3rem;
	font-weight: 700;
	margin: 0 0 1rem 0;
	line-height: 1.3;
}

.nadovi-cookie-modal p {
	color: rgba( 255, 255, 255, 0.85 );
	font-size: 0.9rem;
	line-height: 1.5;
	margin: 0 0 0.75rem 0;
}

/* ==========================================================================
   ACTION BUTTONS ROW
   ========================================================================== */

.nadovi-cookie-actions {
	display: flex;
	gap: 0.75rem;
	margin: 1.25rem 0 0 0;
	flex-wrap: wrap;
}

/* Base button styles */
.nadovi-cookie-btn {
	display: inline-block;
	border: none;
	border-radius: 8px;
	padding: 0.75rem 1.5rem;
	cursor: pointer;
	font-weight: 600;
	font-size: 0.9rem;
	line-height: 1.2;
	transition: opacity 0.2s ease, background 0.2s ease;
	text-align: center;
	flex: 1;
	min-width: 140px;
}

/* Primary: solid accent color */
.nadovi-cookie-btn-primary {
	background: #3b82f6;
	color: #ffffff;
}

.nadovi-cookie-btn-primary:hover,
.nadovi-cookie-btn-primary:focus {
	background: #2563eb;
	opacity: 1;
}

/* Secondary: transparent outline style */
.nadovi-cookie-btn-secondary {
	background: transparent;
	color: #ffffff;
	border: 1px solid rgba( 255, 255, 255, 0.6 );
}

.nadovi-cookie-btn-secondary:hover,
.nadovi-cookie-btn-secondary:focus {
	background: rgba( 255, 255, 255, 0.1 );
	border-color: rgba( 255, 255, 255, 0.9 );
}

/* ==========================================================================
   SETTINGS PANEL (collapsible)
   ========================================================================== */

.nadovi-cookie-settings {
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.2s ease;
	margin-top: 0;
}

.nadovi-cookie-settings.is-open {
	max-height: 500px;
	opacity: 1;
	margin-top: 1.25rem;
}

/* Allow scrolling when settings panel is open (may overflow on mobile) */
.nadovi-cookie-modal:has(.nadovi-cookie-settings.is-open) {
	overflow-y: auto;
}

/* "Beállítások mentése" button in settings panel */
.nadovi-cookie-settings .nadovi-cookie-btn-primary {
	width: 100%;
	margin-top: 1rem;
	flex: none;
}

/* ==========================================================================
   COOKIE CATEGORY ROWS
   ========================================================================== */

.nadovi-cookie-category {
	padding: 0.75rem 0;
	border-bottom: 1px solid rgba( 255, 255, 255, 0.1 );
}

.nadovi-cookie-category:last-of-type {
	border-bottom: none;
}

/* ==========================================================================
   TOGGLE SWITCH (CSS-only, pill-shaped slider)
   ========================================================================== */

.nadovi-cookie-toggle-label {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	cursor: pointer;
	margin: 0;
}

.nadovi-cookie-toggle-label input[type="checkbox"] {
	/* Hide native checkbox */
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

/* Toggle track */
.nadovi-toggle-slider {
	display: inline-block;
	position: relative;
	width: 44px;
	height: 24px;
	background: rgba( 255, 255, 255, 0.2 );
	border-radius: 12px;
	transition: background 0.2s ease;
	flex-shrink: 0;
}

/* Toggle thumb */
.nadovi-toggle-slider::after {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	background: #ffffff;
	border-radius: 50%;
	transition: transform 0.2s ease;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.3 );
}

/* Checked state: accent color + slider moves right */
.nadovi-cookie-toggle-label input[type="checkbox"]:checked + .nadovi-toggle-slider {
	background: #3b82f6;
}

.nadovi-cookie-toggle-label input[type="checkbox"]:checked + .nadovi-toggle-slider::after {
	transform: translateX( 20px );
}

/* Disabled (Szükséges): muted gray, always-on */
.nadovi-cookie-toggle-label input[type="checkbox"]:disabled + .nadovi-toggle-slider {
	background: rgba( 255, 255, 255, 0.35 );
	cursor: not-allowed;
}

.nadovi-cookie-toggle-label input[type="checkbox"]:disabled:checked + .nadovi-toggle-slider {
	background: rgba( 59, 130, 246, 0.5 );
}

.nadovi-cookie-toggle-label input[type="checkbox"]:disabled ~ .nadovi-toggle-label {
	opacity: 0.7;
}

/* Toggle label text */
.nadovi-toggle-label {
	color: #ffffff;
	font-size: 0.9rem;
	font-weight: 600;
}

/* Category description */
.nadovi-category-desc {
	color: rgba( 255, 255, 255, 0.65 ) !important;
	font-size: 0.8rem !important;
	margin: 0.35rem 0 0 calc( 44px + 0.75rem ) !important;
	line-height: 1.4 !important;
}

/* ==========================================================================
   PRIVACY LINK
   ========================================================================== */

.nadovi-cookie-privacy-link {
	display: block;
	margin-top: 1rem;
	color: rgba( 255, 255, 255, 0.55 );
	font-size: 0.78rem;
	text-align: center;
	text-decoration: underline;
	transition: color 0.2s ease;
}

.nadovi-cookie-privacy-link:hover,
.nadovi-cookie-privacy-link:focus {
	color: rgba( 255, 255, 255, 0.9 );
}

/* ==========================================================================
   FOOTER COOKIE SETTINGS TRIGGER
   Styled to match footer legal menu links
   ========================================================================== */

.nadovi-cookie-settings-trigger {
	display: inline-block;
	margin-left: 1rem;
	padding-left: 1rem;
	border-left: 1px solid rgba( 255, 255, 255, 0.2 );
	color: rgba( 255, 255, 255, 0.7 );
	font-size: 0.8rem;
	text-decoration: none;
	transition: color 0.2s ease;
	vertical-align: middle;
}

.nadovi-cookie-settings-trigger:hover,
.nadovi-cookie-settings-trigger:focus {
	color: #ffffff;
	text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE — Tablet and smaller
   ========================================================================== */

@media ( max-width: 768px ) {
	.nadovi-cookie-modal {
		width: calc( 100% - 2rem );
		max-width: none;
		padding: 1.5rem;
	}

	.nadovi-cookie-actions {
		flex-direction: column;
	}

	.nadovi-cookie-btn {
		flex: none;
		width: 100%;
	}
}

/* ==========================================================================
   RESPONSIVE — Mobile
   ========================================================================== */

@media ( max-width: 480px ) {
	.nadovi-cookie-modal {
		width: calc( 100% - 1rem );
		padding: 1.25rem;
	}

	.nadovi-cookie-modal h2 {
		font-size: 1.1rem;
	}

	.nadovi-cookie-modal p {
		font-size: 0.82rem;
	}

	.nadovi-toggle-label,
	.nadovi-cookie-btn {
		font-size: 0.85rem;
	}

	.nadovi-cookie-btn {
		padding: 0.65rem 1rem;
	}

	.nadovi-cookie-privacy-link {
		font-size: 0.72rem;
	}

	.nadovi-cookie-settings-trigger {
		display: block;
		margin-left: 0;
		padding-left: 0;
		border-left: none;
		margin-top: 0.5rem;
	}
}
