/* Detail Image Dots - Frontend Styles */

.wp-block-bencon-detail-image-dots {
	margin: 2rem 0;
}

.detail-image-dots-wrapper {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 40px;
	align-items: start;
}

.detail-image-container {
	position: relative;
	z-index: 4;
	display: flex;
	align-items: flex-start;
	align-self: start;
}

.detail-image-inner {
	position: relative;
	overflow: hidden;
	position: sticky;
	top: 20px;
}

.detail-image {
	display: block;
	width: 100%;
	height: auto;
	user-select: none;
	overflow: hidden;
}

.detail-dot {
	position: absolute;
	left: var(--dot-x);
	top: var(--dot-y);
	width: var(--dot-size);
	height: var(--dot-size);
	border-radius: 50%;
	background-color: transparent;
	border: 3px solid var(--dot-color);
	cursor: pointer;
	transform: translate(-50%, -50%);
	transition: all 0.3s ease;
	z-index: 5;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: bold;
	color: white;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
	background: var(--dot-color);
	animation: dotPulse 2s infinite;
}

.detail-dot:hover {
	transform: translate(-50%, -50%) scale(1.15);
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 0 6px var(--dot-color);
	animation: none;
}

.detail-dot:focus {
	outline: 2px solid #4c63d2;
	outline-offset: 2px;
}

.detail-dot[aria-pressed="true"] {
	transform: translate(-50%, -50%) scale(1.2);
	z-index: 10;
	background-color: var(--dot-color);
	box-shadow: 0 0 0 4px #000, 0 0 0 8px var(--dot-color);
}

.detail-dot:not([aria-pressed="true"]) {
	background-color: #103067ae;
	border-color: #fff;
}

.dot-number {
	display: block;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.detail-dot[aria-pressed="true"] .dot-number {
    color: #000;
}

@keyframes dotPulse {
	0%, 100% {
		transform: translate(-50%, -50%) scale(1);
		opacity: 1;
	}
	50% {
		transform: translate(-50%, -50%) scale(1.05);
		opacity: 0.8;
	}
}

.detail-descriptions {
	display: flex;
	flex-direction: column;
	gap: 0;
	border-radius: 6px;
	overflow: hidden;
	counter-reset: detail-counter;
	margin-right: 5rem;
}

.detail-description-item {
	border-bottom: 1px solid #1030672e;
	margin: 0;
	counter-increment: detail-counter;
	cursor: pointer;
}

.detail-description-item:last-child {
	border-bottom: none;
}

.detail-title {
	margin: 0;
	padding: 16px;
	font-size: 18px;
	font-weight: 700;
	color: #1a1a1a;
	letter-spacing: -0.5px;
	background: #f4f7f9;
	border-left: 4px solid #1030672e;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	user-select: none;
	transition: all 0.2s ease;
	cursor: pointer;
	gap: 8px;
}

.detail-title::before {
	content: counter(detail-counter) '. ';
	font-weight: 600;
	color: #1a1a1a;
	margin-right: 8px;
}

.detail-title::after {
	content: '\F282';
	font-family: 'bootstrap-icons';
	font-size: 14px;
	font-weight: 400;
	color: var(--color-primary);
	display: inliautolock;

	flex-shrink: 0;
	transition: transform 0.3s ease;
}

.detail-description-item[data-active="true"] .detail-title {
	background: #ff9800;
	border-left-color: #ff9800;
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.detail-description-item[data-active="true"] .detail-title::after {
	transform: rotate(90deg);
}

.detail-text {
	margin: 0;
	font-size: var(--font-size-base);
	line-height: 1.3;
	color: #555;
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	padding: 0 16px;
	transition: max-height 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1), padding 0.35s cubic-bezier(0.22, 1, 0.36, 1);
	background: #f8f8f8;
}
.detail-text h5 {
  font-size: 21px;
  font-weight: 600 !important;
  margin-top: 12px;
  margin-bottom: 8px;
}
.detail-text h5 strong {
    font-weight: 600 !important;
    font-size: 21px;
}
.detail-text p {
  font-size: var(--font-size-sm) !important;
}
.detail-description-item[data-active="true"] .detail-text {
	max-height: 500px;
	overflow-y: auto;
	scrollbar-width: thin;
	opacity: 1;
	padding: 16px;
}
.detail-text-list li strong {
    font-weight: 600 !important;
    font-size: 18px;
}

/* Stepper Navigation */
.detail-image-stepper {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid #e0e0e0;
}

.stepper-button {
	background: #f0f0f0;
	border: 1px solid #ddd;
	padding: 10px 16px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	transition: all 0.2s ease;
	color: #333;
}

.stepper-button:hover:not(:disabled) {
	background: #e0e0e0;
	border-color: #999;
}

.stepper-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.stepper-counter {
	font-size: 14px;
	font-weight: 600;
	color: #666;
}

.stepper-autoplay {
	font-size: 12px;
	color: #999;
	margin-top: 8px;
	text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
	.detail-image-dots-wrapper {
		display: block;
	}

	/* Immagine normale nella pagina */
	.detail-image-container {
		position: relative;
		z-index: 1;
		background: #fff;
	}

	.detail-image-inner {
		position: relative;
	}

	.detail-dot {
		font-size: 11px;
        width: 24px !important;
        height: 24px !important;
		animation: mobileDotPulse 2.5s ease-in-out infinite;
	}

	@keyframes mobileDotPulse {
		0%, 100% {
			box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6);
		}
		50% {
			box-shadow: 0 0 0 6px rgba(255, 255, 255, 0);
		}
	}

    .detail-dot[aria-pressed="true"] {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 3px #000, 0 0 0 8px var(--dot-color);
		animation: none;
    }

	/* Mobile Popup Fullscreen */
	.detail-descriptions {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 1000;
		background: #fff;
		display: flex;
		flex-direction: column;
		transform: translateY(100%);
		transition: transform 0.3s ease;
		margin: 0;
		padding: 0;
		border-radius: 0;
		overflow: hidden;
		z-index: 9999;
	}

	.detail-descriptions.drawer-open {
		transform: translateY(0);
	}

	.detail-descriptions::before {
		display: none;
	}

	/* Immagine clonata nel popup */
	.drawer-image-container {
		position: relative;
		flex-shrink: 0;
		height: fit-content;
		background: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		overflow: hidden;
		margin-bottom: 15px;
	}

	.drawer-image-container img {
		max-width: 100%;
		max-height: 100%;
		object-fit: contain;
	}

	.drawer-image-container .detail-dot {
		position: absolute;
	}

	/* Contenuto scrollabile */
	.drawer-content-scroll {
		flex: 1;
		overflow: hidden;
		padding: 0;
		padding-bottom: env(safe-area-inset-bottom);
		display: flex;
		flex-direction: column;
	}

	/* Nascondi tutti i tab tranne quello attivo */
	.detail-description-item {
		display: none;
		border: none;
	}

	.detail-description-item[data-active="true"] {
		display: flex;
		flex-direction: column;
		height: 100%;
		overflow: hidden;
	}

	/* Titolo con sfondo giallo - fisso */
	.detail-description-item[data-active="true"] .detail-title {
		background: #ff9800;
		color: #000;
		border-left: none;
		padding: 16px 20px;
		font-size: 18px;
		border-top-left-radius: 12px;
		border-top-right-radius: 12px;
		margin: 0px;
		flex-shrink: 0;
	}

	.detail-description-item[data-active="true"] .detail-title::before {
		content: var(--dot-number);
		color: #000;
	}

	.detail-description-item[data-active="true"] .detail-title::after {
		display: none;
	}

	.detail-text {
		max-height: none;
		overflow: visible;
		padding: 0 20px 20px;
	}

	.detail-description-item[data-active="true"] .detail-text {
		flex: 1;
		overflow-y: auto;
		opacity: 1;
		padding: 20px;
		scrollbar-width: thin;
	}

	/* Pulsante chiudi nel popup */
	.drawer-close-btn {
		position: absolute;
		top: 12px;
		right: 12px;
		width: 36px;
		height: 36px;
		border: none;
		background: rgba(255, 255, 255, 0.9);
		border-radius: 50%;
		font-size: 20px;
		cursor: pointer;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #333;
		z-index: 10;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	}

	/* Overlay nascosto per popup fullscreen */
	.drawer-overlay {
		display: none;
	}

	.drawer-overlay.active {
		opacity: 1;
		pointer-events: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.detail-dot,
	.detail-description-item {
		transition: none;
		animation: none;
	}

	.detail-dot:hover,
	.detail-dot:focus {
		transform: translate(-50%, -50%);
	}
    .detail-descriptions {
        margin-right: 0;
    }
}
