/**
 * CPT Slider Cards Styles
 * Inspired by product-gallery-row with improved responsiveness
 */

/* Wrapper Container */
.cpt-slider-wrapper {
    margin: 2rem 0;
    padding: 0 1rem;
    width: 100%;
    overflow: hidden;
}

/* Slider Row - Horizontal Scrollable */
.cpt-slider-row {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    padding: 0.5rem 0 1.5rem;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    touch-action: pan-x;
}

/* Hide scrollbar but keep functionality */
.cpt-slider-row::-webkit-scrollbar {
    height: 8px;
}
.cpt-slider-row::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
.cpt-slider-row::-webkit-scrollbar-thumb {
    background: #c5cdd5;
    border-radius: 4px;
}
.cpt-slider-row::-webkit-scrollbar-thumb:hover {
    background: #0b0c54;
}

/* Card Container */
.cpt-slider-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 14px;
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cpt-slider-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

/* Card Link - Remove default link styling */
.cpt-card-link {
    display: block;
    text-decoration: none !important;
    color: inherit;
    height: 100%;
}

.cpt-card-link:hover,
.cpt-card-link:focus,
.cpt-card-link:active,
.cpt-card-link:visited {
    text-decoration: none !important;
    color: inherit;
}

/* Additional specificity to override theme link styles */
.cpt-slider-card a.cpt-card-link,
.cpt-slider-card a.cpt-card-link:hover,
.cpt-slider-card a.cpt-card-link:focus,
.cpt-slider-card a.cpt-card-link:active,
.cpt-slider-card a.cpt-card-link:visited {
    text-decoration: none !important;
}

/* Thumbnail Container */
.cpt-card-thumbnail {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: linear-gradient(135deg, #c5cdd5 0%, #dce4eb 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpt-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cpt-slider-card:hover .cpt-card-thumbnail img {
    transform: scale(1.05);
}

/* No Image Placeholder */
.cpt-card-no-image {
    background: linear-gradient(135deg, #c5cdd5 0%, #dce4eb 100%);
}

.cpt-placeholder-icon {
    font-size: 4rem !important;
    opacity: 0.5;
    color: #374151;
}

/* Material Icons Styling */
.cpt-slider-card .material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 18px;
    vertical-align: middle;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
}

.cpt-placeholder-icon.material-icons {
    font-size: 4rem !important;
}

/* Card Content */
.cpt-card-content {
    padding: 1.25rem;
    text-align: center !important;
    direction: inherit;
}

.cpt-slider-wrapper .cpt-card-content {
    text-align: center !important;
}

[dir="rtl"] .cpt-slider-wrapper .cpt-card-content {
    text-align: center !important;
}

.cpt-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0b0c54 !important;
    margin: 0 0 0.75rem;
    line-height: 1.3;
    text-align: center !important;
    text-decoration: none !important;
    display: block;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

.cpt-card-link:hover .cpt-card-title,
.cpt-card-link:focus .cpt-card-title {
    text-decoration: none !important;
    color: #0b0c54;
}

/* Extra specificity to override any theme link styles */
a.cpt-card-link .cpt-card-title,
a.cpt-card-link:hover .cpt-card-title,
a.cpt-card-link:focus .cpt-card-title,
a.cpt-card-link:active .cpt-card-title,
a.cpt-card-link:visited .cpt-card-title {
    text-decoration: none !important;
    color: #0b0c54 !important;
}

/* Override Astra theme heading styles for titles inside cards */
.cpt-slider-card h3.cpt-card-title,
.cpt-slider-card a h3.cpt-card-title,
.entry-content .cpt-slider-card h3.cpt-card-title {
    text-align: center !important;
    text-decoration: none !important;
    color: #0b0c54 !important;
    display: block !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

.cpt-card-excerpt {
    font-size: 0.95rem;
    color: #374151;
    line-height: 1.6;
    margin: 0 0 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card Meta Information */
.cpt-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
    justify-content: center;
}

.cpt-meta-item {
    font-size: 0.85rem;
    color: #6b7280;
    padding: 0.25rem 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.cpt-meta-item .material-icons {
    font-size: 16px !important;
    vertical-align: middle;
}

/* Empty State */
.cpt-slider-empty {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
    font-size: 1.1rem;
    direction: rtl;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .cpt-slider-wrapper {
        padding: 0 0.5rem;
        margin: 1.5rem 0;
    }
    
    .cpt-slider-row {
        gap: 0.75rem;
        padding: 0.25rem 0 1rem;
    }
    
    .cpt-slider-card {
        width: 240px;
        min-width: 240px;
        max-width: 240px;
    }
    
    .cpt-card-thumbnail {
        height: 150px;
    }
    
    .cpt-card-content {
        padding: 1rem;
    }
    
    .cpt-card-title {
        font-size: 1.05rem;
    }
    
    .cpt-card-excerpt {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }
}

@media (max-width: 480px) {
    .cpt-slider-card {
        width: 200px;
        min-width: 200px;
        max-width: 200px;
    }
    
    .cpt-card-thumbnail {
        height: 130px;
    }
    
    .cpt-card-content {
        padding: 0.875rem;
    }
    
    .cpt-card-title {
        font-size: 1rem;
    }
    
    .cpt-card-excerpt {
        font-size: 0.85rem;
    }
    
    .cpt-meta-item {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }
}

/* RTL Support */
[dir="rtl"] .cpt-slider-row {
    direction: rtl;
}

[dir="rtl"] .cpt-card-content {
    text-align: center !important;
}

/* Smooth scroll on desktop */
@media (hover: hover) {
    .cpt-slider-row {
        scroll-padding: 1rem;
    }
    
    .cpt-slider-row:hover {
        cursor: grab;
    }
    
    .cpt-slider-row:active {
        cursor: grabbing;
    }
}
