/**
 * Categorías Slider Widget Styles
 *
 * @package AMW_Widgets
 * @since 1.0.0
 */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Host+Grotesk:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

/* Widget Container */
.categorias-slider-widget {
    width: 100%;
    position: relative;
    overflow: visible;
}

/* Categories Wrapper - respects container max-width */
.categorias-wrapper {
    max-width: 1650px;
    margin: 0 auto;
    padding: 25px 0 4rem 0;
    position: relative;
    overflow: visible;
}

/* Swiper Container */
.swiper {
    width: 100%;
    height: auto;
    overflow: visible;
}

.swiper-wrapper {
    align-items: center;
}

/* Categories Container (now swiper-wrapper) */
.categorias-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 15px; /* This will be overridden by Elementor settings */
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 0;
    margin: 0;
}

/* Ensure Swiper respects CSS gap values */
.swiper-wrapper.categorias-container {
    gap: inherit; /* Use gap from parent or Elementor settings */
    overflow: visible !important;
}

/* Swiper Slides */
.swiper-slide {
    width: auto !important;
    flex-shrink: 0;
    height: auto;
    padding: 8px 3px;
    margin: -8px -3px;
}

/* Individual Category Tab */
.categoria-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: fit-content;
    height: 85px;
    padding: 20px 30px;
    border: 2px solid #004388;
    border-radius: 50px;
    background-color: transparent;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    box-sizing: border-box;
    flex-shrink: 0;
    will-change: transform, box-shadow;
}

/* Tab Text */
.categoria-text {
    font-family: 'Host Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 400;
    color: #004388;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
    display: block;
}

/* Hover Effects */
.categoria-tab:hover {
    background-color: #f8f9fa;
    border-color: #002a5c;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 67, 136, 0.15);
    z-index: 2;
    position: relative;
}

.categoria-tab:hover .categoria-text {
    color: #002a5c;
}

/* Active State */
.categoria-tab.active {
    background-color: #004388;
    border-color: #004388;
}

.categoria-tab.active .categoria-text {
    color: #ffffff;
}

/* Slider Controls - Hidden by default */
.slider-controls {
    display: flex;
    position: absolute;
    bottom: -10px;
    right: 0;
    gap: 12px;
    pointer-events: none;
    z-index: 2;
    padding-right: 2rem;
    margin-top: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Show controls when Swiper is initialized */
.categorias-slider-widget.swiper-initialized .slider-controls {
    opacity: 1;
    visibility: visible;
}

/* Ensure controls stay hidden in Elementor editor */
.elementor-editor-preview .slider-controls {
    opacity: 0;
    visibility: hidden;
}

/* Add subtle separation line */
.slider-controls::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -20px;
    right: -20px;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(0, 67, 136, 0.1), transparent);
    pointer-events: none;
}

.slider-prev,
.slider-next,
.swiper-button-prev-custom,
.swiper-button-next-custom {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: #000000;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    flex-shrink: 0;
}

.slider-prev:hover:not(:disabled),
.slider-next:hover:not(:disabled),
.swiper-button-prev-custom:hover:not(.swiper-button-disabled),
.swiper-button-next-custom:hover:not(.swiper-button-disabled) {
    background-color: #004388;
    transform: scale(1.05);
}

.slider-prev:disabled,
.slider-next:disabled,
.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.swiper-button-disabled:hover {
    background-color: #000000 !important;
    transform: none !important;
}

.slider-prev {
    position: relative;
}

.slider-next {
    position: relative;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .categorias-container {
        gap: 12px;
    }
    
    .swiper {
        --swiper-theme-color: #004388;
    }
    
    .categoria-tab {
        height: 85px;
        padding: 20px 25px;
    }
    
    .categoria-text {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .categorias-wrapper {
        padding: 15px 0 3.5rem 0;
    }
    
    .categorias-container {
        gap: 10px;
        padding-left: 1.5rem;
        padding-top: 10px;
        padding-bottom: 10px;
        margin: -10px 0;
    }
    
    .swiper {
        --swiper-theme-color: #004388;
        overflow: visible !important;
        padding: 12px 0;
        margin: -12px 0;
    }
    
    .slider-controls {
        bottom: -15px;
        gap: 10px;
        margin-top: 25px;
        padding-right: 1.5rem;
    }
    
    .categoria-tab {
        height: 85px;
        padding: 20px 20px;
        border-radius: 50px;
    }
    
    .categoria-text {
        font-size: 15px;
    }
    
}

@media (max-width: 480px) {
    .categorias-wrapper {
        padding: 12px 0 3rem 0;
    }
    
    .categorias-container {
        gap: 8px;
        padding-left: 1rem;
        padding-top: 8px;
        padding-bottom: 8px;
        margin: -8px 0;
    }
    
    .swiper {
        --swiper-theme-color: #004388;
        overflow: visible !important;
        padding: 10px 0;
        margin: -10px 0;
    }
    
    .slider-controls {
        bottom: -20px;
        gap: 8px;
        margin-top: 30px;
        padding-right: 1rem;
    }
    
    .categoria-tab {
        height: 85px;
        padding: 20px 18px;
        border-radius: 50px;
    }
    
    .categoria-text {
        font-size: 14px;
    }
    
    
    .slider-prev,
    .slider-next,
    .swiper-button-prev-custom,
    .swiper-button-next-custom {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

/* Smooth Scrolling */
.categorias-container {
    scroll-behavior: smooth;
}

/* Focus States for Accessibility */
.categoria-tab:focus {
    outline: 3px solid #004388;
    outline-offset: 2px;
}

.slider-prev:focus,
.slider-next:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .slider-controls {
        display: none;
    }
    
    .categorias-container {
        overflow: visible;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .categoria-tab {
        border-width: 3px;
    }
    
    .categoria-tab:hover {
        box-shadow: none;
        border-color: #000000;
    }
}

/* Ensure parent elements don't clip hover effects */
.elementor-widget-categorias-slider {
    overflow: visible !important;
}

/* Force overflow visible only on necessary containers */
.categorias-slider-widget,
.categorias-wrapper {
    overflow: visible !important;
}

/* Force overflow visible on all Swiper elements for hover effects */
.categorias-slider-widget .swiper,
.categorias-slider-widget .swiper-wrapper,
.categorias-slider-widget .swiper-wrapper.categorias-container {
    overflow: visible !important;
}

.swiper {
    width: 100%;
    height: auto;
    overflow: visible !important;
    padding: 15px 0;
    margin: -15px 0;
}

.swiper-wrapper {
    align-items: center;
    overflow: visible !important;
}

.categorias-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 15px;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 8px 0 8px 2rem;
    margin: -8px 0;
}

/* Elementor Editor Preview Styles */
.elementor-editor-preview .categorias-container.editor-preview-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 15px;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 0 0 0 2rem;
    margin: 0;
    overflow-x: auto;
    overflow-y: visible;
}

.elementor-editor-preview .categoria-tab {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Hide Swiper-specific styles in editor preview */
.elementor-editor-preview .swiper,
.elementor-editor-preview .swiper-wrapper {
    display: none;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .categoria-tab,
    .slider-prev,
    .slider-next {
        transition: none;
    }
    
    .categoria-tab:hover {
        transform: none;
    }
    
    .slider-prev:hover,
    .slider-next:hover {
        transform: none;
    }
}

/* Category Icon Styles */
.categoria-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    flex-shrink: 0;
}

.categoria-icon-svg {
    color: #004388;
    transition: color 0.3s ease;
}

.categoria-tab:hover .categoria-icon-svg {
    color: #002a5c;
}

.categoria-tab.active .categoria-icon-svg {
    color: #ffffff;
}
