/**
 * Offerte iSpazio Pro - Frontend Styles
 *
 * Stili per la visualizzazione delle offerte sul frontend.
 *
 * @package OfferteIspazio
 * @version 1.0.0
 */

/* ==========================================================================
   Loader e Messaggi
   ========================================================================== */

.loader {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #007bff;
	border-radius: 50%;
	border-top-color: transparent;
	animation: spin 0.8s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

#offerte-ispazio-loader {
	background-color: #e7f1ff;
	padding: 15px;
	margin: 10px 0;
	border-left: 4px solid #007bff;
	font-size: 15px;
	color: #004085;
	border-radius: 4px;
}

.avviso-offerte-fallback {
	background-color: #fff3cd;
	border-left: 4px solid #ffc107;
	padding: 15px;
	margin: 10px 0 20px;
	border-radius: 4px;
}

.avviso-offerte-fallback p {
	margin: 0;
	color: #856404;
}

/* ==========================================================================
   Contenitore Prodotti
   ========================================================================== */

.offerte-ispazio-prodotti {
	/* display: grid; - RIMOSSO: il tema gestisce già il layout */
	/* grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); */
	/* gap: 20px; */
	margin: 20px 0;
}

.amazon_orizzontale-product-container {
	display: flex;
	flex-wrap: nowrap; /* ✅ Mantiene su una riga */
	gap: 15px;
	overflow-x: auto; /* ✅ Scroll orizzontale */
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch; /* Smooth scroll iOS */
	padding-bottom: 0; /* ✅ Rimosso padding */
	padding-top: 0 !important; /* ✅ Rimosso padding-top */
	height: auto !important; /* ✅ Altezza automatica */

	/* Nasconde scrollbar */
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE/Edge */
}

/* Nasconde scrollbar su Webkit (Chrome, Safari, Edge) */
.amazon_orizzontale-product-container::-webkit-scrollbar {
	display: none;
}

/* ==========================================================================
   Singolo Prodotto
   ========================================================================== */

.prodotto-filtro {
	transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Override margin-right per amazon_orizzontale */
.amazon_orizzontale-product-item {
	margin-right: 0 !important;
}

/* Animazione slide-down per template default */
@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-30px);
		max-height: 0;
	}
	to {
		opacity: 1;
		transform: translateY(0);
		max-height: 500px;
	}
}

.prodotto-filtro.slide-in-vertical {
	animation: slideDown 0.5s ease-out forwards;
}

/* Animazione slide-left per amazon_banner */
@keyframes slideLeft {
	from {
		opacity: 0;
		transform: translateX(-50px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

.prodotto-filtro.slide-in-horizontal {
	animation: slideLeft 0.4s ease-out forwards;
}

.prodotto-filtro.evidenza {
	border: 2px solid #ff5d00;
	border-radius: 8px;
	padding: 5px;
	background: #fff9f5;
}

/* ==========================================================================
   Filtri Categoria
   ========================================================================== */

.tabnav-wrapper {
	margin-bottom: 20px;
	background-color: #f8f9fa;
	border-radius: 8px;
	/* padding: 10px; */ /* ✅ Rimosso */
}

.tabnav-container {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.tabnav {
	display: flex;
	gap: 10px;
	list-style: none;
	margin: 0;
	padding: 0;
	flex-wrap: nowrap; /* ✅ Mantiene i filtri su una sola riga scorrevole */
}

.tabnav li {
	padding: 0;
	margin: 0;
}

.tabnav a {
	display: inline-block;
	padding: 8px 16px;
	background: #ffffff;
	border: 1px solid #dee2e6;
	border-radius: 20px;
	color: #495057;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s ease;
	white-space: nowrap;
}

.tabnav a:hover {
	background: #e9ecef;
	border-color: #adb5bd;
}

.tabnav a.attivo,
.tabnav a.current {
	background: #007bff;
	color: #ffffff;
	border-color: #007bff;
}

.tabnav-filtra-label {
	display: inline-block;
	padding: 8px 12px;
	font-weight: 600;
	color: #495057;
	font-size: 14px;
}

/* Stili tabnav */
.tabnav-light .tabnav a {
	background: #ffffff;
	border-color: #dee2e6;
	color: #495057;
}

.tabnav-dark .tabnav a {
	background: #343a40;
	border-color: #495057;
	color: #ffffff;
}

.tabnav-dark .tabnav a:hover {
	background: #495057;
}

.tabnav-dark .tabnav a.attivo {
	background: #007bff;
}

/* ==========================================================================
   Ordinamento Live
   ========================================================================== */

#autorefresh-note {
	background: #d4edda;
	border-left: 4px solid #28a745;
	padding: 12px 15px;
	margin-bottom: 15px;
	border-radius: 4px;
	color: #155724;
}

.ordinamento-live {
	display: flex;
	gap: 8px;
}

.ordinamento-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	background: #ffffff;
	border: 1px solid #dee2e6;
	border-radius: 4px;
	color: #495057;
	cursor: pointer;
	transition: all 0.2s ease;
}

.ordinamento-btn:hover {
	background: #e9ecef;
	border-color: #adb5bd;
}

.ordinamento-btn.attivo {
	background: #007bff;
	color: #ffffff;
	border-color: #007bff;
}

/* ==========================================================================
   Flush Cache Button
   ========================================================================== */

.flush-cache-button {
	background: #dc3545;
	color: #ffffff;
	border: none;
	padding: 10px 20px;
	border-radius: 4px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s ease;
}

.flush-cache-button:hover {
	background: #c82333;
}

/* ==========================================================================
   Dark Mode
   ========================================================================== */

@media (prefers-color-scheme: dark) {
	body.dark-mode .offerte-ispazio-prodotti {
		background-color: #1a1a1a;
	}

	body.dark-mode .prodotto-filtro.evidenza {
		background: #2a2a2a;
		border-color: #ff7a3d;
	}

	body.dark-mode .tabnav-wrapper {
		background-color: #2a2a2a;
	}

	body.dark-mode .tabnav a {
		background: #3a3a3a;
		border-color: #4a4a4a;
		color: #e0e0e0;
	}

	body.dark-mode .tabnav a:hover {
		background: #4a4a4a;
	}
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 768px) {
	.offerte-ispazio-prodotti {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 15px;
	}

	.tabnav {
		flex-wrap: nowrap;
		overflow-x: auto;
	}

	.tabnav a {
		font-size: 13px;
		padding: 6px 12px;
	}
}

@media screen and (max-width: 480px) {
	.offerte-ispazio-prodotti {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.tabnav a:focus,
.ordinamento-btn:focus,
.flush-cache-button:focus {
	outline: 2px solid #007bff;
	outline-offset: 2px;
}

/* Skip link per screen reader */
.skip-to-content {
	position: absolute;
	top: -40px;
	left: 0;
	background: #007bff;
	color: white;
	padding: 8px;
	text-decoration: none;
	z-index: 100;
}

.skip-to-content:focus {
	top: 0;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.nosaturate {
	filter: none !important;
}

.hide_on_mobile {
	display: block;
}

.hide_on_desktop {
	display: none;
}

@media screen and (max-width: 768px) {
	.hide_on_mobile {
		display: none;
	}

	.hide_on_desktop {
		display: block;
	}
}
