/**
 * TecAlliance Filter System CSS
 * Sidebar-based filter system with toggle button
 */

/* Filter Toggle Button - Hidden on desktop, visible on mobile */
.tecalliance-filter-toggle {
    display: none;
}

@media (max-width: 1024px) {
    .tecalliance-filter-toggle {
        display: inline-flex;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 500;
        background: #E94141;
        color: white;
        border: none;
        padding: 10px 14px;
        border-radius: 6px;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(233,65,65,0.25);
        transition: all 0.3s ease;
        align-items: center;
        gap: 6px;
        min-width: auto;
        justify-content: center;
        width: auto;
        height: auto;
    }
}

.tecalliance-filter-toggle:hover {
    background: #c93636;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(233,65,65,0.3);
}

.tecalliance-filter-toggle.active {
    background: #E94141;
    box-shadow: 0 4px 20px rgba(233,65,65,0.3);
}

.tecalliance-filter-toggle.active:hover {
    background: #c93636;
}

.tecalliance-filter-toggle i {
    font-size: 16px;
    display: inline-block;
    width: 16px;
    height: 16px;
}

/* Fallback icon if Font Awesome is not loaded */
.tecalliance-filter-toggle i::before {
    content: '☰';
    display: inline-block;
    font-size: 16px;
    line-height: 1;
}

.tecalliance-filter-toggle-text {
    font-size: 14px;
}

.tecalliance-filter-count {
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    border: 2px solid white;
}

/* Sidebar Container - Always visible on desktop */
.tecalliance-filter-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.05);
    backdrop-filter: blur(10px);
}

/* Mobile: Slide-in sidebar */
@media (max-width: 1024px) {
    .tecalliance-filter-container {
        position: fixed;
        top: 0;
        right: 0; /* anchor to right edge */
        width: 100%;
        max-width: 400px;
        height: 100vh;
        z-index: 999;
        transition: transform 0.3s ease; /* smoother and safer than right */
        border-radius: 0;
        transform: translateX(100%); /* move fully off-canvas */
        pointer-events: none; /* do not block clicks when hidden */
    }

    .tecalliance-filter-container.tecalliance-sidebar-open {
        transform: translateX(0); /* slide in */
        pointer-events: auto; /* enable interactions when visible */
    }

    /* Body overlay when sidebar is open on mobile */
    body.tecalliance-sidebar-active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 998;
    }
}

/* Filter Header */
.tecalliance-filter-header {
    background: linear-gradient(135deg, #E94141, #b53030);
    color: white;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.tecalliance-filter-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.tecalliance-filter-title i {
    color: white;
}

.tecalliance-clear-filters-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.tecalliance-clear-filters-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

/* Filter Content */
.tecalliance-filter-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(233, 65, 65, 0.3) transparent;
}

.tecalliance-filter-content::-webkit-scrollbar {
    width: 4px;
}

.tecalliance-filter-content::-webkit-scrollbar-track {
    background: transparent;
}

.tecalliance-filter-content::-webkit-scrollbar-thumb {
    background: rgba(233, 65, 65, 0.2);
    border-radius: 2px;
    transition: background 0.2s ease;
}

.tecalliance-filter-content::-webkit-scrollbar-thumb:hover {
    background: rgba(233, 65, 65, 0.4);
}

/* Minimal collapse behavior (no Bootstrap dependency) */
.collapse {
    display: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.collapse.show {
    display: block;
    max-height: 1000px;
}

.tecalliance-filter-accordion {
    border: none;
}

.tecalliance-filter-card {
    border: none;
    border-bottom: 1px solid #f0f0f0;
    background: transparent;
}

.tecalliance-filter-card:hover {
    background: #f8f9fa;
}

.tecalliance-filter-card:last-child {
    border-bottom: none;
}

.tecalliance-filter-card-header {
    background: #f8fafc;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border-left: 4px solid transparent;
}

.tecalliance-filter-card-header:hover {
    background: #e9ecef;
}

.tecalliance-filter-card-header.collapsed {
    background: #fff;
}

.tecalliance-filter-card-header.has-active-filters {
    background: #e0f2fe;
    border-left-color: #E94141;
}

.tecalliance-filter-label {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tecalliance-filter-label:hover {
    color: #1f2937;
}


.tecalliance-filter-icon {
    transition: transform 0.3s ease;
    color: #666;
}

.tecalliance-filter-card-header[aria-expanded="true"] .tecalliance-filter-icon {
    transform: rotate(180deg);
}

.tecalliance-filter-card-body {
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

.tecalliance-filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #E94141 #f0f0f0;
    padding-right: 4px;
    margin-right: -4px;
}

.tecalliance-filter-options::-webkit-scrollbar {
    width: 4px;
}

.tecalliance-filter-options::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 2px;
}

.tecalliance-filter-options::-webkit-scrollbar-thumb {
    background: rgba(233, 65, 65, 0.3);
    border-radius: 2px;
    transition: background 0.2s ease;
}

.tecalliance-filter-options::-webkit-scrollbar-thumb:hover {
    background: rgba(233, 65, 65, 0.6);
}

.tecalliance-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin: 0;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.tecalliance-filter-option:hover {
    background: #f1f5f9;
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    color: #000;
}

.tecalliance-filter-option.active {
    background: #fff5f5;
    border-color: #E94141;
    box-shadow: 0 2px 4px rgba(233,65,65,0.15);
}

.tecalliance-filter-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #E94141;
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
}

.tecalliance-filter-text {
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
}

.tecalliance-filter-option input:checked + .tecalliance-filter-text {
    color: #8a2626;
    font-weight: 600;
}

.tecalliance-filter-option.active .tecalliance-filter-text {
    color: #8a2626;
    font-weight: 600;
}

/* Loading and Error States */
.tecalliance-loading-placeholder {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-style: italic;
    padding: 15px 0;
    justify-content: center;
}

.tecalliance-error-placeholder {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d32f2f;
    font-style: italic;
    padding: 15px 0;
    justify-content: center;
}

.tecalliance-no-options {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #999;
    font-style: italic;
    padding: 15px 0;
    justify-content: center;
}

/* Filter Actions */
.tecalliance-filter-actions {
    background: #f8f9fa;
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.tecalliance-apply-filters-btn {
    background: #E94141;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    order: 1;
}

.tecalliance-apply-filters-btn:hover {
    background: #c93636;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233,65,65,0.3);
}

.tecalliance-reset-filters-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    order: 2;
}

.tecalliance-reset-filters-btn:hover {
    background: #545b62;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108,117,125,0.3);
}

/* Results Summary */
.tecalliance-results-count {
    background: #fff5f5;
    border-left: 4px solid #E94141;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

.tecalliance-results-summary {
    margin: 0;
    color: #8a2626;
    font-weight: 600;
    font-size: 14px;
}

/* Filter Error Display */
.tecalliance-filter-error {
    background: #fff3f3;
    border-left: 4px solid #d32f2f;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tecalliance-filter-toggle {
        bottom: 20px;
        right: 15px;
        padding: 8px 12px;
        font-size: 11px;
        min-width: auto;
    }
    
    .tecalliance-filter-header {
        padding: 15px 20px;
    }
    
    .tecalliance-filter-title {
        font-size: 18px;
    }
    
    .tecalliance-filter-card-header {
        padding: 12px 20px;
    }
    
    .tecalliance-filter-card-body {
        padding: 15px 20px;
    }
    
    .tecalliance-filter-options {
        max-height: 200px;
    }
    
    .tecalliance-filter-actions {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    .tecalliance-apply-filters-btn,
    .tecalliance-reset-filters-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
}

@media (max-width: 576px) {
    .tecalliance-filter-toggle {
        bottom: 20px;
        right: 10px;
        padding: 8px 10px;
        font-size: 11px;
        min-width: auto;
        width: 44px;
        height: 44px;
    }
    
    .tecalliance-filter-toggle-text {
        display: none;
    }
    
    .tecalliance-filter-toggle i {
        font-size: 18px;
        width: 18px;
        height: 18px;
    }
    
    .tecalliance-filter-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .tecalliance-filter-title {
        font-size: 16px;
    }
    
    .tecalliance-clear-filters-btn {
        align-self: flex-end;
    }
    
    .tecalliance-filter-option {
        padding: 10px 15px;
    }
    
    .tecalliance-filter-text {
        font-size: 13px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .tecalliance-filter-container {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .tecalliance-filter-card-header {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .tecalliance-filter-card-body {
        background: #2d3748;
        border-top-color: #4a5568;
    }
    
    .tecalliance-filter-text {
        color: #9fa1a3;
    }
    
    .tecalliance-filter-actions {
        background: #4a5568;
        border-top-color: #4a5568;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .tecalliance-filter-container {
        border: 2px solid #000;
    }
    
    .tecalliance-filter-card {
        border: 1px solid #000;
    }
    
    .tecalliance-filter-checkbox {
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .tecalliance-filter-container,
    .tecalliance-filter-toggle,
    .tecalliance-filter-card *,
    .tecalliance-filter-option *,
    .tecalliance-apply-filters-btn,
    .tecalliance-reset-filters-btn {
        animation: none !important;
        transition: none !important;
    }
}

/* Print Styles */
@media print {
    .tecalliance-filter-container,
    .tecalliance-filter-toggle {
        display: none;
    }
}

/* Focus Styles for Accessibility */
.tecalliance-filter-checkbox:focus,
.tecalliance-apply-filters-btn:focus,
.tecalliance-reset-filters-btn:focus,
.tecalliance-clear-filters-btn:focus,
.tecalliance-filter-toggle:focus {
    outline: 2px solid #E94141;
    outline-offset: 2px;
}

.tecalliance-filter-card-header:focus {
    outline: 2px solid #E94141;
    outline-offset: -2px;
}

/* Loading Animation */
@keyframes filterPulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.tecalliance-loading-placeholder i {
    animation: filterPulse 1.5s ease-in-out infinite;
}

/* Success Animation */
@keyframes filterSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.tecalliance-filter-option input:checked {
    animation: filterSuccess 0.3s ease;
}

/* Filter Results Animation */
@keyframes filterResultsSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tecalliance-results-count {
    animation: filterResultsSlide 0.5s ease;
}

/* Sidebar Animation */
@keyframes sidebarSlideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.tecalliance-filter-container.tecalliance-sidebar-open {
    animation: sidebarSlideIn 0.3s ease;
}

/* Mobile Overlay Animation */
@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

body.tecalliance-sidebar-active::before {
    animation: overlayFadeIn 0.3s ease;
}
