/* Template Filter Styles */

/* Filter Section Wrapper */
.filter-section-wrapper {
    margin-bottom: 2rem;
}

/* Filter Section - Sticky like Stats Banner */
.filter-section {
    position: sticky;
    top: 0;
    z-index: 999;
    background: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    margin-bottom: 1rem;
    transition: box-shadow 0.3s ease;
}

/* Enhanced shadow when scrolling */
.filter-section.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: 999px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    color: #666;
}

.filter-tab .tab-icon {
    font-size: 1.25rem;
}

.filter-tab:hover {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

.filter-tab.active {
    font-weight: 700;
    color: #0d6efd;
}

.filter-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    background: #0d6efd;
    border-radius: 2px 2px 0 0;
}

/* Search Box */
.search-wrapper {
    position: relative;
    min-width: 250px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 999px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    pointer-events: none;
    color: #999;
}

/* Desktop Search - Visible on desktop */
.desktop-search {
    display: flex;
}

/* Mobile Search Toggle - Hidden on desktop */
.mobile-search-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: #f8f9fa;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
}

.mobile-search-toggle i {
    font-size: 1.25rem;
    color: #666;
}

.mobile-search-toggle:hover {
    background: #e9ecef;
    transform: scale(1.05);
}

.mobile-search-toggle.active {
    background: #0d6efd;
}

.mobile-search-toggle.active i {
    color: white;
}

/* Mobile Search Dropdown - Hidden by default */
.mobile-search-dropdown {
    display: none;
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    animation: slideDown 0.3s ease;
}

.mobile-search-dropdown.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Favorite Button on Card */
.template-card {
    position: relative;
}

/* Template Stats Row */
.template-stats {
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.usage-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.usage-count i {
    color: #6c757d;
}

/* Inline Favorite Button */
.btn-favorite-inline {
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.btn-favorite-inline i {
    font-size: 1.2rem;
    color: #999;
    transition: all 0.2s ease;
}

.btn-favorite-inline:hover i {
    color: #e63946;
    transform: scale(1.15);
}

.btn-favorite-inline.active i {
    color: #e63946;
}

.btn-favorite-inline:active {
    transform: scale(0.9);
}

/* Template Badges */
.template-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 10;
    display: flex;
    gap: 0.5rem;
    flex-direction: column;
    align-items: flex-start;
}

.template-badges .badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.badge-trending {
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
    color: white;
}

.badge-popular {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    color: white;
}

.badge-new {
    background: linear-gradient(135deg, #06ffa5, #00d4ff);
    color: #000;
}

/* Empty State */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state i {
    display: block;
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: #666;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #999;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9999;
    font-weight: 500;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-notification.success {
    border-left: 4px solid #28a745;
}

.toast-notification.error {
    border-left: 4px solid #dc3545;
}

.toast-notification.info {
    border-left: 4px solid #0d6efd;
}

.toast-notification i {
    font-size: 1.5rem;
}

.toast-notification.success i {
    color: #28a745;
}

.toast-notification.error i {
    color: #dc3545;
}

.toast-notification.info i {
    color: #0d6efd;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .filter-section {
        position: sticky;
        top: 0;
        padding: 0.75rem 0;
    }
    
    .filter-bar {
        flex-direction: row;
        flex-wrap: nowrap;
        padding: 0 0.75rem;
        gap: 0.5rem;
    }
    
    .filter-tabs {
        flex: 1;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        flex-wrap: nowrap;
        gap: 0.25rem;
    }
    
    .filter-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .filter-tab {
        flex-shrink: 0;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        min-width: auto;
    }
    
    /* Icon only on mobile */
    .filter-tab .tab-text {
        display: none;
    }
    
    .filter-tab .tab-icon {
        font-size: 1.5rem;
    }
    
    .filter-tab.active::after {
        width: 80%;
    }
    
    /* Hide desktop search on mobile */
    .desktop-search {
        display: none;
    }
    
    /* Show mobile search toggle */
    .mobile-search-toggle {
        display: flex;
        flex-shrink: 0;
    }
    
    .mobile-search-dropdown .search-wrapper {
        width: 100%;
        min-width: unset;
    }
    
    .toast-notification {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .template-badges {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .template-badges .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .filter-bar {
        flex-wrap: wrap;
    }
    
    .search-wrapper {
        min-width: 200px;
    }
}
