/**
 * TS Data Fetcher - Public Styles
 * Bootstrap 5.3.3 Compatible
 *
 * @since      1.0.0
 * @package    TS_Data_Fetcher
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --ts-primary: #008080;
    --ts-primary-hover: #008080;
    --ts-text-primary: #111827;
    --ts-text-secondary: #6b7280;
    --ts-text-muted: #9ca3af;
    --ts-border: #e5e7eb;
    --ts-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    --ts-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.bg-ts-primary{ 
    background: var(--ts-primary) !important;
    color: white !important;
}

/* ============================================
   CONTAINER
   ============================================ */
.ts-data-fetcher {
    margin: 2rem 0;
}

/* ============================================
   LOADING STATES
   ============================================ */
.ts-loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    gap: 1rem;
}

/* Skeleton Loading */
.ts-skeleton-wrapper {
    padding: 1.5rem 0;
}

.ts-skeleton-card {
    background: #ffffff;
    border: 1px solid var(--ts-border);
    border-radius: 0.75rem;
    padding: 1rem;
    overflow: hidden;
}

.ts-skeleton-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.ts-skeleton-title {
    width: 80%;
    height: 1.5rem;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 0.25rem;
    margin-bottom: 0.75rem;
}

.ts-skeleton-text {
    width: 100%;
    height: 1rem;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   ERROR & NO DATA
   ============================================ */
.ts-error-message {
    margin: 2rem 0;
}

.ts-no-data {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--ts-text-secondary);
    font-size: 1.1rem;
    background: #f9fafb;
    border-radius: 0.75rem;
}

/* ============================================
   VERTICAL CARD
   ============================================ */
.ts-card {
    background: #fff;
    border-radius: 0.75rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: var(--ts-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--ts-border);
}

.ts-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--ts-shadow-hover);
}

/* Image */
.ts-card-media {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
    background: #f3f4f6;
}

.ts-card-media a {
    display: block;
    width: 100%;
    height: 100%;
}

.ts-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.ts-card:hover .ts-card-media img {
    transform: scale(1.05);
}

/* Content */
.ts-card-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Meta */
.ts-card-meta {
    font-size: 0.8125rem;
    color: var(--ts-text-muted);
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.ts-card-meta span {
    display: inline-flex;
    align-items: center;
}

/* Title */
.ts-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

.ts-card-title a {
    text-decoration: none;
    color: var(--ts-text-primary);
    transition: color 0.2s ease;
}

.ts-card-title a:hover {
    color: var(--ts-primary);
}

/* Excerpt */
.ts-card-excerpt {
    font-size: 0.875rem;
    color: var(--ts-text-secondary);
    line-height: 1.6;
    flex-grow: 1;
    margin: 0;
}

/* CTA */
/* .ts-card-action {
    margin-top: 1rem;
}
.ts-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ts-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s ease, color 0.2s ease;
}
.ts-link:hover {
    color: var(--ts-primary-hover);
    transform: translateX(3px);
} */
/* CTA Link (default) */
.ts-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ts-primary) !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s ease, color 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.ts-link:hover {
    color: var(--ts-primary-hover);
    transform: translateX(3px);
}

/* CTA Button Type */
.ts-cta-button {
    background: var(--ts-primary);
    color: white;
    border: none;
    border-radius: 0.375rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.ts-cta-button:hover {
    background: var(--ts-primary-hover);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.ts-cta-button:active {
    transform: translateY(0);
}

.ts-cta-button:focus {
    outline: 2px solid var(--ts-primary);
    outline-offset: 2px;
}

/* ============================================
   HORIZONTAL CARD (Bootstrap Classes)
   ============================================ */
.ts-card-horizontal {
    box-shadow: var(--ts-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-height: 200px;
}

.ts-card-horizontal:hover {
    box-shadow: var(--ts-shadow-hover);
}

.ts-card-horizontal:hover .ts-card-horizontal img {
    transform: scale(1.05);
}

.ts-card-horizontal img {
    height: 255px;
    width: 180px;
    object-fit: cover;
}

.ts-card-horizontal.has-meta img {
    height: 100%;
}

.ts-card-horizontal .card-body {
    display: flex;
    flex-direction: column;
}

.ts-card-horizontal .card-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.ts-card-horizontal .card-title a {
    color: var(--ts-text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.ts-card-horizontal .card-title a:hover {
    color: var(--ts-primary);
}

/* ============================================
   VIDEO CARD (Bootstrap Classes)
   ============================================ */
.ts-card-video .position-relative {
    cursor: pointer;
    overflow: hidden;
}

.ts-card-video .position-relative img {
    transition: transform 0.3s ease;
    height: 450px;
    object-fit: cover;
}

.ts-card-video .position-relative:hover img {
    transform: scale(1.1);
}

.ts-card-video .position-relative:hover .bg-dark {
    background-color: rgba(37, 99, 235, 0.9) !important;
}

.ts-card-video .card-body {
    display: flex;
    flex-direction: column;
}

.ts-card-video .card-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.ts-card-video .card-title a {
    color: var(--ts-text-primary);
    text-decoration: none;
}

.ts-card-video .card-title a:hover {
    color: var(--ts-primary);
}

/* ============================================
   LOAD MORE
   ============================================ */
.ts-load-more-wrapper {
    margin-top: 2rem;
}

/* ============================================
   CAROUSEL LAYOUT (SWIPER)
   ============================================ */

/* Swiper container */
.ts-swiper {
    width: 100%;
    padding: 2rem 0;
    position: relative;
}

/* Swiper slide */
.ts-swiper .swiper-slide {
    height: auto;
    display: flex;
}

/* Ensure cards fill slide height */
.ts-swiper .swiper-slide .ts-card {
    width: 100%;
    height: 100%;
}

/* ============================================
   NAVIGATION ARROWS (DESKTOP ONLY)
   ============================================ */
.ts-swiper .swiper-button-next,
.ts-swiper .swiper-button-prev {
    color: var(--ts-primary);
    background: rgba(255, 255, 255, 0.95);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.ts-swiper .swiper-button-next:after,
.ts-swiper .swiper-button-prev:after {
    font-size: 20px;
    font-weight: bold;
}

.ts-swiper .swiper-button-next:hover,
.ts-swiper .swiper-button-prev:hover {
    background: var(--ts-primary);
    color: white;
    transform: scale(1.1);
}

/* Hide arrows on mobile, show on desktop */
@media (max-width: 991px) {
    .ts-swiper .swiper-button-next,
    .ts-swiper .swiper-button-prev {
        display: none; /* HIDE ON MOBILE */
    }
}

/* ============================================
   PAGINATION BULLETS (MOBILE ONLY)
   ============================================ */
.ts-swiper .swiper-pagination {
    bottom: 0;
    position: relative;
    margin-top: 1.5rem;
}

.ts-swiper .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: var(--ts-text-muted);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.ts-swiper .swiper-pagination-bullet-active {
    background: var(--ts-primary);
    opacity: 1;
    transform: scale(1.2);
}

/* Hide pagination on desktop, show on mobile */
/* @media (min-width: 992px) {
    .ts-swiper .swiper-pagination {
        display: none;
    }
} */

/* ============================================
   COVERFLOW EFFECT STYLING
   ============================================ */
.ts-swiper[data-effect="coverflow"] {
    padding: 3rem 0; /* Extra padding for 3D effect */
}

.ts-swiper[data-effect="coverflow"] .swiper-slide {
    transform-style: preserve-3d;
}

/* ============================================
   CAROUSEL LOADING STATE
   ============================================ */
.ts-swiper.swiper-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ============================================
   PAGE LAYOUT FILTERS
   ============================================ */

/* Filter Wrapper */
.ts-filters-wrapper {
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

/* Smooth transitions for dynamic layout changes */
.ts-filters-wrapper .col-md-6,
.ts-filters-wrapper .col-md-12 {
    transition: all 0.3s ease;
}

/* Alert styling for category messages */
.ts-filters-wrapper .alert {
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 13px;
}

.ts-filters-wrapper .alert-warning {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.ts-filters-wrapper .alert i {
    margin-right: 5px;
}

/* Search Container */
.ts-search-container {
    width: 100%;
}

.ts-search-box {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-radius: 0.375rem;
    overflow: hidden;
}

.ts-search-box .input-group-text {
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
}

.ts-search-box .form-control {
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
}

/* .ts-search-box .form-control:focus {
    border-color: var(--ts-primary);
    box-shadow: none;
} */

/* Clear Button */
.ts-search-clear-btn {
    border: 1px solid #dee2e6;
    border-left: none;
    padding: 0.5rem 0.75rem;
    background: white;
    color: #6c757d;
    transition: all 0.2s ease;
}

.ts-search-clear-btn:hover {
    background: #f8f9fa;
    color: #dc3545;
}

/* Search Button */
.ts-search-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
}

/* Category Container */
.ts-category-container {
    width: 100%;
}

.ts-category-select {
    min-width: 200px;
}

.ts-category-apply-btn {
    white-space: nowrap;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
}

.ts-category-reset-btn {
    white-space: nowrap;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

/* Category overlay on images */
.ts-card-media {
    position: relative;
    overflow: hidden;
}

.ts-card-media .position-absolute {
    z-index: 10;
}

.ts-card-media .badge {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.ts-card-media .badge:hover {
    transform: scale(1.05);
}

/* Ensure image doesn't overlap overlay */
.ts-card-media img,
.ts-card-media video {
    display: block;
    width: 100%;
    height: auto;
}

/* Custom meta styling */
.card-text small span strong {
    color: #495057;
    margin-right: 0.25rem;
}

/* Responsive */
@media (max-width: 767px) {
    .ts-filters-wrapper {
        padding: 1rem;
    }
    
    .ts-search-box .form-control {
        font-size: 0.875rem;
    }
    
    .ts-category-container .d-flex {
        flex-direction: column;
    }
    
    .ts-category-container .d-flex > * {
        width: 100%;
    }
    
    .ts-search-btn,
    .ts-category-apply-btn,
    .ts-category-reset-btn {
        padding: 0.5rem 1rem;
    }
}

/* ============================================
   RESPONSIVE (Mobile)
   ============================================ */
@media (max-width: 768px) {
    .ts-card-horizontal .row {
        flex-direction: column;
    }

    .ts-card-horizontal img {
        height: 200px;
        max-height: 200px;
    }

    .ts-card-content {
        padding: 1rem;
    }

    .ts-card-title {
        font-size: 1rem;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes ts-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ts-card {
    animation: ts-fade-in 0.4s ease forwards;
}

.ts-card:nth-child(1) { animation-delay: 0.05s; }
.ts-card:nth-child(2) { animation-delay: 0.1s; }
.ts-card:nth-child(3) { animation-delay: 0.15s; }
.ts-card:nth-child(4) { animation-delay: 0.2s; }
.ts-card:nth-child(5) { animation-delay: 0.25s; }
.ts-card:nth-child(6) { animation-delay: 0.3s; }

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible */
.ts-card:focus-visible,
.ts-card a:focus-visible {
    outline: 2px solid var(--ts-primary);
    outline-offset: 2px;
}

/* ===================================
   BUTTON LOADING STATES
   =================================== */

/* Disabled buttons styling */
.ts-search-btn:disabled,
.ts-category-apply-btn:disabled,
.ts-category-reset-btn:disabled,
.ts-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
}

/* Spinner in buttons */
.spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
    border-width: 0.15em;
}

/* Button text with spinner */
button .spinner-border {
    vertical-align: middle;
}