/* Tooto Loop Grid & Carousel Styles */

/* Grid Layout */
.tooto-loop-grid__items {
	display: grid;
	gap: 24px;
}

.tooto-loop-grid__item {
	min-width: 0;
}

.tooto-loop-grid__empty {
	padding: 12px;
	border: 1px dashed #ccc;
	color: #666;
}

/* Loop Carousel (Splide Integration) */
.tooto-loop-carousel .splide__track {
    overflow: hidden;
}

.tooto-loop-carousel .splide__list {
    display: flex !important;
    grid-template-columns: none !important;
    flex-wrap: nowrap !important;
    padding: 0 !important;
    margin: 0 !important;
}

.tooto-loop-carousel .splide__slide {
    flex-shrink: 0;
    list-style: none !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: var(--tooto-carousel-gap, 20px) !important; 
    height: auto;
    display: block;
}

/* Fix Elementor Grid items inside carousel */
.tooto-loop-carousel .elementor-loop-item {
    width: 100%; /* Splide controls width of the slide wrapper */
}

/* Navigation: Top Right (Header) */
.tooto-loop-carousel.tooto-nav-top-right {
    position: relative;
}

.tooto-loop-carousel.tooto-nav-top-right .splide__arrows {
    position: absolute;
    top: -110px; /* Approximate header height offset */
    right: 0;
    display: flex;
    gap: 16px;
    z-index: 5;
	width: 150px;
}

/* Default Navigation */
.tooto-loop-carousel:not(.tooto-nav-top-right) .splide__arrow--prev {
    left: -20px;
}

.tooto-loop-carousel:not(.tooto-nav-top-right) .splide__arrow--next {
    right: -20px;
}

.tooto-loop-carousel .splide__arrow {
    background: rgba(193, 39, 45, 0.8);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    opacity: 1;
    color: #fff;
}

.tooto-loop-carousel .splide__arrow:hover {
    background: rgba(193, 39, 45, 0.9);;
}

.tooto-loop-carousel .splide__arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

.tooto-loop-carousel .splide__arrow svg {
    fill: currentColor;
    width: 20px;
    height: 24px;
    transform: none; /* Prevent Splide from rotating the icon */
}

.tooto-loop-carousel .splide__arrow--prev svg {
    transform: none !important; /* Force reset for prev arrow specifically */
}

.elementor-element-edit-mode .tooto-loop-carousel .splide__track .elementor-loop-container{
	display: grid !important;
	grid-template-columns: repeat(4, 1fr) !important;
}

/* Custom Pagination */
.tooto-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	margin-top: 48px;
	gap: 10px;
	width: 100%;
	grid-column: 1 / -1;
}

.tooto-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 10px;
	border-radius: 4px;
	text-decoration: none;
	color: #333;
	font-weight: 500;
	transition: all 0.3s;
	line-height: 1;
}

.tooto-pagination .page-numbers.current {
	background-color: #d12b2b;
	color: #fff;
}

.tooto-pagination .page-numbers.dots {
	background: transparent;
	color: inherit;
	cursor: default;
}

.tooto-pagination-jump {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-left: 20px;
	font-size: 14px;
	color: #666;
	white-space: nowrap;
}

.tooto-pagination-select-wrapper {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.tooto-pagination-select {
	padding: 4px 24px 4px 8px;
	border: 1px solid #D8D8D8 !important;
	border-radius: 4px;
	background: #fff;
	color: inherit;
	cursor: pointer;
	font-size: inherit;
	outline: none;
	min-width: 60px;
	height: initial;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
}

.tooto-select-arrow {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
	display: inline-flex;
	align-items: center;
	color: inherit;
}

.tooto-select-arrow svg {
	display: block;
	width: 10px;
	height: auto;
}

.tooto-pagination .page-numbers svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* Hide standard Elementor pagination if custom is enabled */
.elementor-widget-tooto-loop-grid:has(.tooto-pagination) .elementor-pagination {
	display: none !important;
}

/* Mobile Responsive Styles for Custom Pagination */
@media (max-width: 767px) {
	.tooto-pagination {
		gap: 6px;
		margin-top: 30px;
	}
	
	.tooto-pagination .page-numbers {
		min-width: 28px;
		height: 28px;
		padding: 0 4px;
		font-size: 14px;
	}

	.tooto-pagination-jump {
		margin-left: 0;
		width: 100%;
		justify-content: center;
		margin-top: 10px;
	}
    
    /* Mobile Load More Behavior */
    .tooto-loop-carousel[data-mobile-behavior="load_more"] .splide__track {
        overflow: visible;
    }

    .tooto-loop-carousel[data-mobile-behavior="load_more"] .splide__list {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--tooto-carousel-gap, 20px) !important;
    }

    .tooto-loop-carousel[data-mobile-behavior="load_more"] .splide__slide {
        width: auto !important;
        margin: 0 !important;
    }

    .tooto-loop-carousel[data-mobile-behavior="load_more"] .splide__arrows {
        display: none !important;
    }
}

/* Mobile Load More Button */
.tooto-mobile-load-more-container {
    text-align: center;
    margin-top: 20px;
    clear: both;
}

.tooto-mobile-load-more-btn {
    display: inline-block;
    padding: 10px 30px;
    background-color: transparent;
    color: #C1272D;
    border: 1px solid #C1272D;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    border-radius: 4px;
}

.tooto-mobile-load-more-btn:hover {
    background-color: #C1272D;
    color: #fff;
}

/* Loading Overlay */
.tooto-loading-overlay {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(255,255,255,0.6);
	z-index: 9999;
}

.tooto-loading-spinner {
	width: 48px;
	height: 48px;
	border: 3px solid #e5e7eb;
	border-top-color: #C1272D;
	border-radius: 50%;
	animation: tooto-spin 0.8s linear infinite;
}

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

html.tooto-no-scroll,
body.tooto-no-scroll {
	overflow: hidden !important;
	touch-action: none;
	overscroll-behavior: none;
}
