/**
 * Taxonomy Filter with AJAX Live Search - Enhanced Responsive Styles
 * Version: 1.1.0
 */

/* Container Styles */
.taxonomy-filter-container {
    padding: 15px;
    margin-bottom: 30px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

/* Header Section */
.taxonomy-filter-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 110px;
}

/* Inline terms styles */
.taxonomy-terms-inline {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 60px;
    margin-bottom: 0px;
}

.taxonomy-terms-inline .term-item {
    padding: 0 15px 0px 0px;
    color: #000;
    cursor: pointer;
    font-size: 18px;
	font-weight: 500;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
	position: relative;
}

.taxonomy-terms-inline .term-item::after{
	content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: -5px;
  left: 0;
  background-color: #00A4C2;
  opacity: .8;
  -webkit-transform: scaleX(0);
  -ms-transform: scaleX(0);
  transform: scaleX(0);
  -webkit-transform-origin: bottom right;
  -ms-transform-origin: bottom right;
  transform-origin: bottom right;
  -webkit-transition: -webkit-transform .3s;
  transition: -webkit-transform .3s;
  -o-transition: transform .3s;
  transition: transform .3s;
  transition: transform .3s,-webkit-transform .3s;
}
.taxonomy-terms-inline .term-item:hover::after, .term-item.active::after{
	-webkit-transform-origin: bottom left;
  -ms-transform-origin: bottom left;
  transform-origin: bottom left;
  -webkit-transform: scaleX(1);
  -ms-transform: scaleX(1);
  transform: scaleX(1);
}

.taxonomy-search-box {
    width: 100%;
	position: relative;
}

.taxonomy-search-box .taxonomy-search-input {
    width: 100%;
    padding: 10px 30px;
    border: 2px solid #CCEDF3;
    border-radius: 100px;
    height: 54px;
    -webkit-appearance: none;
    appearance: none;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

.taxonomy-search-box .taxonomy-search-input:focus {
  border-color: #CCEDF3;
}

.taxonomy-search-box .ekit_search-button {
  background-color: transparent;
  border: 0;
  padding: 0;
  color: #fff;
  position: absolute;
  right: 0;
  cursor: pointer;
  top: 55%;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  height: 100%;
  width: 70px;
  border-radius: 0 50px 50px 0;
}

.taxonomy-search-box .ekit_search-button:hover, .taxonomy-search-box .ekit_search-button:focus {
  background: transparent;
}

.taxonomy-search-box .ekit_search-button svg {
  width: 22px;
}

.taxonomy-search-box .taxonomy-search-input::placeholder {
  color: #ccc;
  opacity: 1;
  font-weight: 500;
  font-size: 17px;
}

.read-more-container .read-more-link svg {
  width: 1em;
  font-size: 28px;
  margin-left: 10px;
  margin-top: 2px;
  -webkit-transition: .3s ease-in-out;
  -o-transition: .3s ease-in-out;
  transition: all .3s ease-in-out;
  height: 0.9em;
}

/* Results Section */
.taxonomy-filter-results {
    position: relative;
    min-height: 200px;
}

.taxonomy-filter-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    z-index: 10;
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
	display: none;
}

@-webkit-keyframes spin {
    0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

@keyframes spin {
    0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

/* 
 * Grid Layout for Posts - Mobile First
 * Fallback for browsers that don't support grid
 */
.taxonomy-posts-container {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -10px;
}

@supports (display: grid) {
    .taxonomy-posts-container {
        display: grid;
        grid-template-columns: repeat(1, 1fr);
        gap: 20px;
        margin: 0;
    }
}

/* Post Item Styles */
.taxonomy-filter-post {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 calc(100% - 20px);
    flex: 0 0 calc(100% - 20px);
    margin: 10px;
    overflow: hidden;
    -webkit-transition: -webkit-transform 0.2s ease, -webkit-box-shadow 0.2s ease;
    transition: -webkit-transform 0.2s ease, -webkit-box-shadow 0.2s ease;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    transition: transform 0.2s ease, box-shadow 0.2s ease, -webkit-transform 0.2s ease, -webkit-box-shadow 0.2s ease;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

@supports (display: grid) {
    .taxonomy-filter-post {
        -webkit-box-flex: 1;
        -ms-flex: auto;
        flex: auto;
        margin: 0;
    }
}


.post-thumbnail-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 200px;
}

.post-thumbnail {
    width: 100%;
    height: 100%;
    position: relative;
}

.post-thumbnail-wrapper .post-thumbnail img {
    width: 100%;
    -o-object-fit: cover;
    object-fit: cover;
    font-family: 'object-fit: cover;'; /* IE polyfill */
	height: 220px !important;
 	 object-position: center center;
	border-radius: 28px;
}

.no-image-placeholder {
    background-color: #f5f5f5;
    width: 100%;
    height: 100%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.no-image-placeholder:after {
    content: "No Image";
    color: #999;
}

.category-label {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: #ffffff;
    padding: 4px 8px;
    font-size: 16px;
	font-weight: 600;
	text-transform: uppercase;
    z-index: 2;
}

.taxonomy-filter-post h3 {
	margin: 25px 0px;
  	font-size: 20px;
  	font-weight: 500;
  	color: #000;
}

.taxonomy-filter-post h3 a {
    text-decoration: none;
    color: #000;
	font-weight: 500;
}

.taxonomy-filter-post h3 a:hover {
    color: #000 !important;
}

.read-more-container {
    margin: 0 0px 15px;
    margin-top: auto;
}

.read-more-link {
    display: inline-flex;
	-webkit-box-align: center;
  	-ms-flex-align: center;
  	align-items: center;
	position: relative;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    -webkit-transition: background-color 0.2s ease;
    transition: background-color 0.2s ease;
}

.read-more-container .read-more-link:hover svg {
  margin-left: 15px;
}

.read-more-link:hover {
    background-color: #005d8c;
}

.no-results {
    padding: 30px;
    text-align: center;
    font-size: 16px;
    color: #666;
    background-color: #f9f9f9;
    border-radius: 4px;
    width: 100%;
}

@supports (display: grid) {
    .no-results {
        grid-column: 1 / -1;
    }
}

/* Pagination Styles */
.taxonomy-pagination {
    margin-top: 30px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.taxonomy-pagination-inner {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 15px;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.pagination-number,
.pagination-prev,
.pagination-next {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
    text-align: center;
    border-radius: 4px;
    background-color: #f5f5f5;
    color: #333;
    text-decoration: none;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

.taxonomy-pagination-inner .pagination-number {
  		min-width: 45px;
		height: 45px;
		border-radius: 100px;
		border: 2px solid #CCEDF3;
}	

.pagination-number:hover,
.pagination-prev:hover,
.pagination-next:hover {
    background-color: #e0e0e0;
}

.pagination-number.active {
    background-color: #0073aa;
    color: white;
    font-weight: 600;
}

.pagination-prev.disabled,
.pagination-next.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-dots {
    padding: 0 5px;
    color: #666;
}

.taxonomy-pagination-inner .pagination-prev:hover, .taxonomy-pagination-inner .pagination-next:hover {
  background: transparent !important;
}

/* Small Tablets (portrait) */
@media (min-width: 576px) {
    .taxonomy-posts-container {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
    }
    
    .taxonomy-filter-post {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 calc(50% - 20px);
        flex: 0 0 calc(50% - 20px);
    }
    
    @supports (display: grid) {
        .taxonomy-posts-container {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
        }
        
        .taxonomy-filter-post {
            -webkit-box-flex: 1;
            -ms-flex: auto;
            flex: auto;
        }
    }
    
    .pagination-number,
    .pagination-prev,
    .pagination-next {
        min-width: 34px;
        height: 34px;
        font-size: 14px;
    }
}

/* Tablets and small desktops */
@media (min-width: 768px) {
    .taxonomy-filter-header {
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        -ms-flex-direction: row;
        flex-direction: row;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
    }
    
    .taxonomy-terms-filter {
        -webkit-box-flex: 2;
        -ms-flex: 2;
        flex: 2;
    }
    
    .taxonomy-search-box {
        -webkit-box-flex: 1;
        -ms-flex: 1;
        flex: 1;
		position: relative;
        max-width: 345px;
    }
    
    .pagination-number,
    .pagination-prev,
    .pagination-next {
        min-width: 36px;
        height: 36px;
    }
	.taxonomy-pagination-inner .pagination-number {
  		min-width: 45px;
		height: 45px;
		border-radius: 100px;
		border: 2px solid #CCEDF3;
}	
	
}

/* Elementor Editor Preview Loading Styles */
.elementor-editor-preview-loading {
    background-color: #fff;
    padding: 30px;
    text-align: center;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.elementor-loader-wrapper {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.elementor-loader {
    height: 50px;
    width: 50px;
    position: relative;
    transform: translateY(-50%);
    top: 50%;
    margin: 0 auto;
}

.elementor-loading-title {
    color: #666;
    text-align: center;
    font-size: 14px;
    font-weight: normal;
    margin-top: 15px;
}

.elementor-loader-box {
    background-color: #0073aa;
    width: 25%;
    height: 25%;
    position: absolute;
    animation: elementor-animation-loader 1.5s linear infinite;
}

.elementor-loader-box:nth-of-type(1) {
    top: 0;
    left: 0;
    animation-delay: 0s;
}

.elementor-loader-box:nth-of-type(2) {
    top: 0;
    right: 0;
    animation-delay: -.375s;
}

.elementor-loader-box:nth-of-type(3) {
    bottom: 0;
    right: 0;
    animation-delay: -.75s;
}

.elementor-loader-box:nth-of-type(4) {
    bottom: 0;
    left: 0;
    animation-delay: -1.125s;
}

@keyframes elementor-animation-loader {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(.5);
    }
    50% {
        transform: scale(1);
    }
    100% {
        transform: scale(1);
    }
}

/* Error message styling */
.taxonomy-preview-error {
    padding: 20px;
    text-align: center;
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.taxonomy-preview-error p {
    margin-bottom: 15px;
    color: #666;
}

.taxonomy-preview-retry-btn {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.taxonomy-preview-retry-btn:hover {
    background-color: #005d8c;
}

/* Desktops */
@media (min-width: 992px) {
    .taxonomy-filter-post {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 calc(33.333% - 20px);
        flex: 0 0 calc(33.333% - 20px);
    }
    
    @supports (display: grid) {
        .taxonomy-posts-container {
            grid-template-columns: repeat(3, 1fr);
        }
    }
}

/* Large Desktops */
@media (min-width: 1200px) {
    @supports (display: grid) {
        .taxonomy-posts-container {
            grid-template-columns: repeat(4, 1fr);
        }
    }
}

/* Print styles */
@media print {
    .taxonomy-filter-header,
    .taxonomy-pagination,
    .read-more-link {
        display: none !important;
    }
    
    .taxonomy-filter-post {
        page-break-inside: avoid;
        break-inside: avoid;
        -webkit-box-shadow: none !important;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* Horizontal scrolling for taxonomy terms on mobile */
@media (max-width: 767px) {
	.taxonomy-filter-post h3{
		margin: 15px 0px 20px;
  		font-size: 18px;
	}
	
	.post-thumbnail-wrapper .post-thumbnail img{
		height: 180px !important;
	}
	
	.taxonomy-filter-header{margin-bottom: 60px;}

	.taxonomy-terms-inline .term-item{font-size: 16px;}

    .taxonomy-terms-inline {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        scrollbar-width: none; /* Hide scrollbar in Firefox */
        -ms-overflow-style: none; /* Hide scrollbar in IE/Edge */
        padding-bottom: 10px; /* Add space for scrollbar */
        margin-bottom: 5px;
        position: relative;
        gap: 8px;
    }
    
    /* Hide scrollbar in Chrome/Safari */
    .taxonomy-terms-inline::-webkit-scrollbar {
        display: none;
    }
    
    /* Ensure terms don't wrap */
    .term-item {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    
    /* Add subtle indicators that there's more content to scroll */
    .taxonomy-terms-filter {
        position: relative;
		margin-bottom: 20px;
    }
    
    .taxonomy-terms-filter::after {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        height: 100%;
        width: 30px;
        pointer-events: none;
        z-index: 1;
    }
    
    /* Make each term more touch-friendly */
    .term-item {
        padding: 10px 15px;
        min-width: auto;
    }
}
