/* Cookie Popup Styles */
.cookie-popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 10000;
	display: none;
	backdrop-filter: blur(3px);
}

.cookie-popup-overlay.show {
	display: flex;
	align-items: center;
	justify-content: center;
	animation: fadeIn 0.3s ease-out;
}

.cookie-popup {
	background: white;
	max-width: 600px;
	width: 90%;
	max-height: 90vh;
	border-radius: 16px;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
	overflow: hidden;
	animation: slideUp 0.3s ease-out;
}

.cookie-popup-header {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: white;
	padding: 24px;
	text-align: center;
}

.cookie-popup-header h3 {
	margin: 0 0 8px 0;
	font-size: 22px;
	font-weight: 600;
}

.cookie-popup-header p {
	margin: 0;
	opacity: 0.9;
	font-size: 14px;
}

.cookie-popup-content {
	padding: 24px;
	max-height: 50vh;
	overflow-y: auto;
}

.cookie-popup-content p {
	margin: 0 0 16px 0;
	line-height: 1.6;
	color: #444;
	font-size: 14px;
}

.cookie-popup-content p:last-of-type {
	margin-bottom: 0;
}

.cookie-popup-content a {
	color: #667eea;
	text-decoration: none;
	font-weight: 500;
}

.cookie-popup-content a:hover {
	text-decoration: underline;
}

.cookie-categories {
	margin: 20px 0;
}

.cookie-category {
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	margin-bottom: 12px;
	overflow: hidden;
}

.cookie-category-header {
	background: #f8f9fa;
	padding: 16px;
	cursor: pointer;
	display: flex;
	justify-content: space-between;
	align-items: center;
	transition: background-color 0.2s;
}

.cookie-category-header:hover {
	background: #e9ecef;
}

.cookie-category-title {
	font-weight: 600;
	color: #333;
	display: flex;
	align-items: center;
	gap: 8px;
}

.cookie-toggle {
	position: relative;
	width: 44px;
	height: 24px;
	background: #ccc;
	border-radius: 12px;
	cursor: pointer;
	transition: background-color 0.3s;
}

.cookie-toggle.enabled {
	background: #4CAF50;
}

.cookie-toggle.disabled {
	background: #ccc;
	cursor: not-allowed;
}

.cookie-toggle::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 20px;
	height: 20px;
	background: white;
	border-radius: 50%;
	transition: transform 0.3s;
}

.cookie-toggle.enabled::after {
	transform: translateX(20px);
}

.cookie-category-content {
	padding: 16px;
	display: none;
	border-top: 1px solid #e0e0e0;
	background: white;
}

.cookie-category-content.show {
	display: block;
	animation: slideDown 0.2s ease-out;
}

.cookie-category-content p {
	margin: 0;
	font-size: 13px;
	color: #666;
	line-height: 1.5;
}

.expand-icon {
	transition: transform 0.2s;
	margin-left: 8px;
}

.expand-icon.rotated {
	transform: rotate(180deg);
}

.cookie-popup-actions {
	padding: 20px 24px;
	background: #f8f9fa;
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	justify-content: center;
}

.cookie-btn {
	padding: 12px 24px;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	transition: all 0.3s;
	min-width: 120px;
}

.cookie-btn-accept {
	background: #4CAF50;
	color: white;
}

.cookie-btn-accept:hover {
	background: #45a049;
	transform: translateY(-1px);
}

.cookie-btn-decline {
	background: #f44336;
	color: white;
}

.cookie-btn-decline:hover {
	background: #da190b;
	transform: translateY(-1px);
}

.cookie-btn-settings {
	background: transparent;
	color: #667eea;
	border: 2px solid #667eea;
}

.cookie-btn-settings:hover {
	background: #667eea;
	color: white;
	transform: translateY(-1px);
}

.consent-info {
	background: #e3f2fd;
	padding: 16px;
	border-radius: 8px;
	margin: 20px 0;
	border-left: 4px solid #2196F3;
}

.consent-info p {
	margin: 0;
	font-size: 13px;
	color: #1565c0;
}

/* Animations */
@keyframes fadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes slideUp {
	from { 
		opacity: 0;
		transform: translateY(20px) scale(0.95);
	}
	to { 
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes slideDown {
	from {
		opacity: 0;
		max-height: 0;
	}
	to {
		opacity: 1;
		max-height: 200px;
	}
}

/* Responsive */
@media (max-width: 768px) {
	.cookie-popup {
		width: 95%;
		margin: 10px;
	}

	.cookie-popup-actions {
		flex-direction: column;
	}
	.cookie-btn {
		width: 100%;
	}
}



/* SOLUZIONE DEFINITIVA per Cookie Popup Mobile - RCLS */


@media (max-width: 768px) {
	.cookie-popup-overlay.show {
		/* FIX: Posiziona dall'alto, non centrato */
		align-items: flex-start;
		justify-content: center;
		padding: 0;
		/* Permette scroll dell'intero overlay */
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.cookie-popup {
		/* FIX: Layout completamente ridisegnato */
		width: 100vw;
		max-width: none;
		max-height: 100vh;
		margin: 0;
		border-radius: 0;
		/* Flex layout per controllare sezioni */
		display: flex;
		flex-direction: column;
		/* Altezza minima per assicurare che i pulsanti siano sempre visibili */
		min-height: 100vh;
	}

	.cookie-popup-header {
		/* FIX: Header compatto e fisso */
		flex-shrink: 0;
		padding: 15px;
		background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	}

	.cookie-popup-header h3 {
		font-size: 18px;
		margin: 0 0 4px 0;
	}

	.cookie-popup-header p {
		font-size: 12px;
		margin: 0;
	}

	.cookie-popup-content {
		/* FIX: Contenuto scrollabile tra header e pulsanti */
		flex: 1;
		padding: 15px;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		/* Calcola l'altezza disponibile togliendo header e pulsanti */
		min-height: 0;
	}

	.cookie-popup-content p {
		font-size: 13px;
		line-height: 1.4;
		margin-bottom: 12px;
	}

	/* FIX: Categorie cookie più compatte */
	.cookie-categories {
		margin: 15px 0;
	}

	.cookie-category {
		margin-bottom: 8px;
	}

	.cookie-category-header {
		padding: 10px;
		font-size: 13px;
	}

	.cookie-category-content {
		padding: 10px;
		max-height: 150px;
		overflow-y: auto;
	}

	.cookie-category-content p {
		font-size: 11px;
		line-height: 1.3;
		margin: 0;
	}

	.consent-info {
		padding: 10px;
		margin: 10px 0;
	}

	.consent-info p {
		font-size: 11px;
		margin: 0;
	}

	/* FIX: Sezione titolare più compatta */
	.cookie-popup-content p[style*="font-size: 12px"] {
		font-size: 10px !important;
		line-height: 1.2 !important;
		margin-top: 15px !important;
	}

	.cookie-popup-actions {
		/* FIX: Pulsanti sempre visibili in fondo */
		flex-shrink: 0;
		padding: 15px;
		background: #f8f9fa;
		border-top: 2px solid #e0e0e0;
		display: flex;
		flex-direction: column;
		gap: 8px;
		/* Importante: posizione fissa per sicurezza */
		position: sticky;
		bottom: 0;
		z-index: 10001;
	}
	
	.cookie-btn {
		width: 100% !important;
		padding: 10px 15px;
		margin: 0;
		font-size: 13px;
		font-weight: 600;
		border-radius: 6px;
		box-sizing: border-box;
	}

	/* Ordine pulsanti ottimizzato per mobile */
	.cookie-btn-accept {
		order: 1;
		background: #4CAF50 !important;
	}

	.cookie-btn-settings {
		order: 2;
	}

	.cookie-btn-decline {
		order: 3;
	}
}

/* FIX per schermi molto piccoli (iPhone SE, vecchi Android) */
@media (max-width: 400px), (max-height: 600px) {
	.cookie-popup-content {
		padding: 10px;
	}

	.cookie-category-header {
		padding: 8px;
		font-size: 12px;
	}

	.cookie-category-content {
		padding: 8px;
		max-height: 100px;
	}

	.cookie-category-content p {
		font-size: 10px;
	}

	.cookie-popup-actions {
		padding: 10px;
		gap: 6px;
	}

	.cookie-btn {
		padding: 8px 12px;
		font-size: 12px;
	}
}

/* FIX per landscape su mobile */
@media (max-width: 768px) and (orientation: landscape) {
	.cookie-popup {
		/* In landscape usa solo l'80% dell'altezza */
		max-height: 80vh;
		min-height: 80vh;
		margin: 10vh auto 0;
	}
}

/* SOLUZIONE DI EMERGENZA ASSOLUTA */
@media (max-width: 768px) {
	/* Se tutto fallisce, forza i pulsanti sempre visibili */
	.cookie-popup-actions {
		position: fixed !important;
		bottom: 0 !important;
		left: 0 !important;
		right: 0 !important;
		z-index: 10002 !important;
		background: #f8f9fa !important;
		box-shadow: 0 -5px 20px rgba(0,0,0,0.2) !important;
		border-radius: 0 !important;
	}

	/* Aggiungi padding-bottom al contenuto per evitare sovrapposizioni */
	.cookie-popup-content {
		padding-bottom: 80px !important;
	}
}

/* Scrollbar personalizzata per mobile */
.cookie-popup-content::-webkit-scrollbar {
	width: 3px;
}

.cookie-popup-content::-webkit-scrollbar-track {
	background: rgba(0,0,0,0.1);
}

.cookie-popup-content::-webkit-scrollbar-thumb {
	background: rgba(0,0,0,0.3);
	border-radius: 3px;
}