/* Quote Slider Block Styles */

.wp-block-pinkrebel-quote-slider {
	position: relative;
	width: 100%;
	overflow: visible; /* Ensure content isn't clipped */
}

/* Ensure the block doesn't inherit problematic styles */
.wp-block-pinkrebel-quote-slider * {
	box-sizing: border-box;
}

.quote-slider {
	position: relative;
	width: 100%;
	overflow: visible; /* Ensure content isn't clipped */
	min-height: 0; /* Allow natural height calculation */
}

.quote-slider .splide__track {
	position: relative;
	overflow: hidden;
}

.quote-slider .splide__list {
	display: flex;
	align-items: stretch;
	margin: 0;
	padding: 0;
	list-style: none;
}

.quote-slider .splide__slide {
	flex-shrink: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Empty State */
.empty-state {
	text-align: center;
	padding: 3rem 2rem;
	background: #f9fafb;
	border: 2px dashed #d1d5db;
	border-radius: 12px;
	color: #6b7280;
}

.empty-state h3 {
	margin: 0 0 0.5rem 0;
	font-size: 1.25rem;
	color: #374151;
}

.empty-state p {
	margin: 0;
	font-size: 0.875rem;
}

/* Quote Item Styles */
.quote-item {
	border-radius: 12px;
	padding: 0rem;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	position: relative;
	transition: all 0.3s ease;
	box-sizing: border-box; /* Ensure padding is included in height calculation */
	min-height: 250px; /* Set a minimum height to prevent very short cards */
	overflow: visible; /* Ensure content isn't clipped */
}

/* Editor specific - selected quote */
.wp-block-editor .quote-item.selected {
	border-color: #0073aa;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.wp-block-editor .quote-item .quote-edit-indicator {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	width: 24px;
	height: 24px;
	background: #0073aa;
	color: white;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.wp-block-editor .quote-item:hover .quote-edit-indicator,
.wp-block-editor .quote-item.selected .quote-edit-indicator {
	opacity: 1;
}

.quote-icon {
	width: 48px;
	height: 48px;
	object-fit: contain;
	display: block;
}

/* Quote Content */
.quote-content {
	flex: 1;
	margin-bottom: 2rem;
}

.quote-text {
	font-size: var(--wp--preset--font-size--xx-large);
    line-height: 1.6;
    color: var(--wp--preset--color--secondary);
    font-weight: 600;
    margin: 0;
    padding: 0;
    border: none;
}

/* Quote Author */
.quote-author {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-top: auto;
}

.quote-avatar-container {
	flex-shrink: 0;
	position: relative;
}

.quote-avatar {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid #e5e7eb;
}

.quote-author-details {
	flex: 1;
	text-align: left;
}

.quote-author-name {
	font-size: 1rem;
	font-weight: 600;
	color: #111827;
	margin: 0 0 0.25rem 0;
	line-height: 1.4;
	margin-bottom: 0px;
}

.quote-author-job {
	margin-bottom: 0px !important;
}

.quote-author-job {
	font-size: 0.875rem;
	color: #6b7280;
	margin: 0;
	line-height: 1.4;
}

/* Navigation Arrows */
.quote-slider .splide__arrows {
	position: relative;
	display: flex;
	justify-content: flex-end;
	gap: 12px;
	margin-top: -53px;
	z-index: 2;
}

.quote-slider .splide__arrow {
	position: static;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	background: unset;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	opacity: 1;
	transform: none;
}

.quote-slider .splide__arrow:hover {
	background: #ffffff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.quote-slider .splide__arrow:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.quote-slider .splide__arrow svg {
	width: 24px;
	height: 18px;
	fill: #544842;
	transition: fill 0.3s ease;
}

.quote-slider .splide__arrow:hover svg {
	fill: #2d1810;
}

/* Grid Layout (when not enough slides for slider) */
.quote-slider.is-grid {
	visibility: visible !important; /* Override Splide's default visibility: hidden */
}

.quote-slider.is-grid .splide__list {
	display: grid !important;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: var(--wp--preset--spacing--50, 2rem);
	transform: none !important; /* Override any Splide transforms */
	align-items: stretch; /* Ensure grid items stretch to fill row height */
	grid-auto-rows: 1fr; /* Ensure all rows have equal height */
	padding: 0; /* Remove any default padding */
	margin: 0; /* Remove any default margin */
}

.quote-slider.is-grid .splide__slide {
	width: auto !important;
	transform: none !important; /* Override any Splide transforms */
	flex-shrink: 1;
	display: flex; /* Make slide a flex container */
	align-items: stretch; /* Stretch children to full height */
}

/* Fallback: Ensure content is visible even without proper classes */
.quote-slider:not(.is-slider):not(.splide--initialized) {
	visibility: visible !important; /* Override Splide's default visibility: hidden */
}

.quote-slider:not(.is-slider):not(.splide--initialized) .splide__list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 2rem;
	align-items: stretch; /* Ensure grid items stretch to fill row height */
	grid-auto-rows: 1fr; /* Ensure all rows have equal height */
	padding: 0; /* Remove any default padding */
	margin: 0; /* Remove any default margin */
}

.quote-slider:not(.is-slider):not(.splide--initialized) .splide__slide {
	width: auto !important;
	transform: none !important;
	display: flex; /* Make slide a flex container */
	align-items: stretch; /* Stretch children to full height */
}

/* Editor Specific Styles */
.wp-block-editor .quote-slider {
	margin-bottom: 2rem;
}

/* Sidebar Controls */
.quote-management-controls {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.add-quote-sidebar-button {
	width: 100%;
	justify-content: center;
}

.quote-edit-panel {
	border-top: 1px solid #e0e0e0;
	padding-top: 1rem;
	margin-top: 1rem;
}

.quote-edit-panel h4 {
	margin: 0 0 1rem 0;
	font-size: 14px;
	font-weight: 600;
	color: #1e1e1e;
}

.media-upload-control {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.media-upload-button {
	min-height: 60px;
	border: 2px dashed #d1d5db;
	border-radius: 6px;
	background: #f9fafb;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	color: #6b7280;
	transition: all 0.3s ease;
	padding: 0.75rem;
}

.media-upload-button:hover {
	border-color: #9ca3af;
	background: #f3f4f6;
}

.media-upload-button img {
	max-width: 40px;
	max-height: 40px;
	object-fit: cover;
}

.quote-actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 1rem;
	flex-wrap: wrap;
}

.quote-actions .components-button {
	flex: 1;
	min-width: 0;
	font-size: 12px;
	padding: 6px 8px;
	height: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
	.quote-item {
		padding: 0rem;
	}

	.quote-slider .splide__arrows {
		margin-top: 0px;
	}
	
	.quote-author {
		flex-direction: column;
		text-align: center;
		gap: 0.75rem;
	}
	
	.quote-author-details {
		text-align: center;
	}
	
	.quote-slider .splide__arrow {
		width: 40px;
		height: 40px;
	}
	
	.quote-slider .splide__arrow svg {
		width: 20px;
		height: 15px;
	}

	.quote-text  {
		font-size: var(--wp--preset--font-size--large);
	}
}

@media (max-width: 480px) {
	.quote-item {
		padding: 0rem;
	}
	
	.quote-slider.is-grid .splide__list {
		grid-template-columns: 1fr;
	}
	
	.quote-slider .splide__arrow {
		width: 35px;
		height: 35px;
	}
	
	.quote-slider .splide__arrow svg {
		width: 18px;
		height: 14px;
	}
}

/* Focus styles for accessibility */
.quote-slider .splide__arrow:focus {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}

.components-button:focus {
	outline: 2px solid #3b82f6;
	outline-offset: 2px;
}
