
/**
 * Styles applied both in the editor and on the front end.
 */

.wp-block-testimonial-display-block-testimonial-display {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
	width: 100% !important;
	max-width: none !important;
	box-sizing: border-box;

	/* Heading */
	.tls-heading {
		margin-bottom: 24px;
		font-weight: 700;
		letter-spacing: -0.01em;
	}

	/* Text alignment variants */
	&.tls-align--left {
		text-align: left;
	}

	&.tls-align--center {
		text-align: center;
	}

	&.tls-align--right {
		text-align: right;
	}

	/* Container — grid */
	.tls-container--grid {
		width: 100%;
	}

	/* Container — carousel */
	.tls-container--carousel {
		display: flex;
		overflow-x: auto;
		scroll-behavior: smooth;
		-webkit-overflow-scrolling: touch;
		gap: 20px;
		padding: 4px;
		scroll-snap-type: x mandatory;
		width: 100%;

		/* Hide scrollbar completely */
		scrollbar-width: none;
		-ms-overflow-style: none;

		&::-webkit-scrollbar {
			display: none;
		}

		.tls-testimonial {
			flex: 0 0 auto;
			scroll-snap-align: start;
		}

		/* When auto-scroll is active, disable snap so the animation is smooth */
		&[data-tls-auto-scroll="true"] {
			scroll-snap-type: none;
			scroll-behavior: auto;

			.tls-testimonial {
				scroll-snap-align: none;
			}
		}
	}

	/* Carousel card widths based on card size */
	&.tls-size--small .tls-container--carousel .tls-testimonial {
		width: 240px;
		min-width: 240px;
	}

	&.tls-size--medium .tls-container--carousel .tls-testimonial {
		width: 320px;
		min-width: 320px;
	}

	&.tls-size--large .tls-container--carousel .tls-testimonial {
		width: 420px;
		min-width: 420px;
	}

	/* Testimonial item — card style */
	.tls-testimonial--card {
		background: #fff;
		border: 2px solid #e0e0e0;
		border-radius: 12px;
		padding: 24px;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
		transition: box-shadow 0.2s ease, transform 0.2s ease;

		&:hover {
			box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
			transform: translateY(-2px);
		}
	}

	/* Testimonial item — minimal style */
	.tls-testimonial--minimal {
		padding: 20px 0;
		border-bottom: 1px solid #eee;

		&:last-child {
			border-bottom: none;
		}
	}

	/* Stars */
	.tls-stars {
		display: inline-block;
		margin-bottom: 10px;
		font-size: 1.2em;
		line-height: 1;
	}

	.tls-star {
		margin-right: 2px;
	}

	/* Blockquote text */
	.tls-text {
		margin: 0 0 16px 0;
		padding: 0;
		border: none;
		font-size: 0.95em;
		line-height: 1.65;
		color: #333;
		font-style: italic;

		&::before {
			content: "\201C";
			font-size: 1.4em;
			font-weight: 700;
			color: #999;
			margin-right: 2px;
		}

		&::after {
			content: "\201D";
			font-size: 1.4em;
			font-weight: 700;
			color: #999;
			margin-left: 2px;
		}
	}

	/* Meta line */
	.tls-meta {
		display: flex;
		flex-direction: row;
		align-items: center;
		gap: 10px;
	}

	/* Center alignment — avatar stacks below name/subtitle, all centered */
	&.tls-align--center .tls-meta {
		flex-direction: column-reverse;
		align-items: center;
	}

	/* Right alignment — avatar moves to the right of the text */
	&.tls-align--right .tls-meta {
		flex-direction: row-reverse;
		justify-content: flex-start;
	}

	.tls-avatar {
		width: 44px;
		height: 44px;
		border-radius: 50%;
		object-fit: cover;
		flex-shrink: 0;
	}

	.tls-meta-text {
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	.tls-name {
		font-weight: 600;
		font-size: 0.9em;
		color: #222;
	}

	.tls-location {
		font-size: 0.8em;
		font-weight: 300;
		font-style: italic;
		color: #888;
		letter-spacing: 0.01em;
		line-height: 1.4;
	}

	/* Card size variants — content auto-adjusts to fit */
	&.tls-size--small {
		.tls-testimonial--card {
			padding: 12px 14px;
		}

		.tls-testimonial--minimal {
			padding: 10px 0;
		}

		.tls-heading {
			font-size: 1.1em;
			margin-bottom: 14px;
		}

		.tls-text {
			font-size: 0.8em;
			line-height: 1.5;
			margin-bottom: 10px;

			&::before,
			&::after {
				font-size: 1.1em;
			}
		}

		.tls-name {
			font-size: 0.75em;
		}

		.tls-stars {
			font-size: 0.9em;
			margin-bottom: 6px;
		}

		.tls-location {
			font-size: 0.6em;
		}

		.tls-avatar {
			width: 32px;
			height: 32px;
		}

		.tls-meta {
			gap: 6px;
		}

		.tls-meta-text {
			gap: 1px;
		}
	}

	&.tls-size--medium {
		.tls-testimonial--card {
			padding: 20px 22px;
		}

		.tls-testimonial--minimal {
			padding: 16px 0;
		}

		.tls-heading {
			font-size: 1.35em;
			margin-bottom: 20px;
		}

		.tls-text {
			font-size: 0.9em;
			line-height: 1.6;
			margin-bottom: 14px;
		}

		.tls-name {
			font-size: 0.85em;
		}

		.tls-stars {
			font-size: 1.1em;
			margin-bottom: 8px;
		}

		.tls-avatar {
			width: 44px;
			height: 44px;
		}

		.tls-location {
			font-size: 0.75em;
		}
	}

	&.tls-size--large {
		.tls-testimonial--card {
			padding: 30px 32px;
		}

		.tls-testimonial--minimal {
			padding: 24px 0;
		}

		.tls-heading {
			font-size: 1.6em;
			margin-bottom: 28px;
		}

		.tls-text {
			font-size: 1.05em;
			line-height: 1.75;
			margin-bottom: 18px;

			&::before,
			&::after {
				font-size: 1.5em;
			}
		}

		.tls-name {
			font-size: 1em;
		}

		.tls-stars {
			font-size: 1.35em;
			margin-bottom: 12px;
		}

		.tls-avatar {
			width: 54px;
			height: 54px;
		}

		.tls-location {
			font-size: 0.85em;
		}

		.tls-meta {
			gap: 12px;
		}

		.tls-meta-text {
			gap: 3px;
		}
	}

	/* Empty state */
	.tls-empty {
		padding: 40px 20px;
		text-align: center;
		color: #888;
		font-style: italic;
		background: #fafafa;
		border-radius: 8px;
		border: 2px dashed #ddd;
	}

	/* Carousel navigation buttons */
	.tls-carousel-nav {
		display: flex;
		justify-content: center;
		gap: 12px;
		margin-top: 16px;
	}

	.tls-carousel-btn {
		width: 44px;
		height: 44px;
		border-radius: 50%;
		border: 2px solid #ddd;
		background: #fff;
		font-size: 1.6em;
		line-height: 1;
		cursor: pointer;
		display: flex;
		align-items: center;
		justify-content: center;
		transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
		color: #444;
		padding: 0;

		&:hover {
			background: #f5f5f5;
			border-color: #bbb;
			box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
		}

		&:focus {
			outline: 2px solid #007cba;
			outline-offset: 2px;
		}
	}

	/* Responsive grid — adapt columns on smaller screens */
	@media (max-width: 900px) {
		.tls-container--grid {
			grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
		}
	}

	@media (max-width: 600px) {
		.tls-container--grid {
			grid-template-columns: 1fr !important;
		}

		&.tls-size--small .tls-container--carousel .tls-testimonial,
		&.tls-size--medium .tls-container--carousel .tls-testimonial,
		&.tls-size--large .tls-container--carousel .tls-testimonial {
			width: 260px;
			min-width: 260px;
		}
	}
}
