/**
 * TNC Price Filter Widget - Frontend Styles
 * 
 * CSS cho structure và layout của widget.
 * Màu sắc sẽ được override bởi inline styles từ settings.
 * 
 * @package TNC_Price_Filter
 * @version 1.2
 */

/* ==========================================================================
   Widget Container
   ========================================================================== */

.tnc-widget-price-filter {
    background: #fff;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);

}

/* Widget Title - Màu sẽ override bởi inline styles */
.widget-title,
.widgettitle {
    padding: 15px;
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
}

.tnc-widget-price-filter .tnc-price-filter-list {
    padding: 5px;
}

/* ==========================================================================
   Reset Button
   ========================================================================== */

.tnc-filter-reset {
    margin-bottom: 15px;
    text-align: center;
    padding: 0 15px;
    padding-top: 15px;
}

.tnc-reset-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: #f44336;
    color: white !important;
    border-radius: 5px;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.tnc-reset-button:hover {
    background: #d32f2f;
    transform: scale(1.05);
    color: white !important;
}

.tnc-reset-button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Price Filter List
   ========================================================================== */

.tnc-price-filter-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tnc-price-filter-list li {
    margin-bottom: 8px;
}

.tnc-price-filter-list li:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Filter Links - Màu sẽ override bởi inline styles
   ========================================================================== */

#shop-sidebar .tnc-filter-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
width: 120%;
 margin-left: -30px; 
}

.tnc-filter-link:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tnc-price-filter-list li.selected .tnc-filter-link {
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.tnc-price-filter-list li.selected .tnc-filter-link:hover {
    transform: translateX(5px);
}

/* ==========================================================================
   Filter Link Elements
   ========================================================================== */

.tnc-selected-icon {
    margin-right: 5px;
    font-weight: bold;
    font-size: 14px;
}

.tnc-price-label {
    flex: 1;
    text-align: left;
}

.tnc-product-count {
    background: rgba(255, 255, 255, 0.3);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 8px;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

.tnc-filter-link:hover .tnc-product-count {
    background: rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   Style: Compact (Thu gọn)
   ========================================================================== */

.tnc-widget-style-compact .tnc-filter-link {
    padding: 8px 12px;
    font-size: 13px;
}

.tnc-widget-style-compact .tnc-price-filter-list li {
    margin-bottom: 5px;
}

.tnc-widget-style-compact .widget-title,
.tnc-widget-style-compact .widgettitle {
    font-size: 14px;
    padding: 12px 15px;
}

.tnc-widget-style-compact .tnc-product-count {
    padding: 2px 6px;
    font-size: 11px;
    min-width: 25px;
}

.tnc-widget-style-compact .tnc-reset-button {
    padding: 6px 12px;
    font-size: 12px;
}

/* ==========================================================================
   Style: Minimal (Tối giản) - Màu override bởi inline
   ========================================================================== */

.tnc-widget-style-minimal .tnc-filter-link {
    background: transparent;
    border-bottom: 1px solid #eee;
    border-radius: 0;
    padding: 10px 0;
}

.tnc-widget-style-minimal .tnc-filter-link:hover {
    background: transparent;
    transform: none;
}

.tnc-widget-style-minimal .tnc-price-filter-list li.selected .tnc-filter-link {
    background: transparent;
    box-shadow: none;
}

.tnc-widget-style-minimal .tnc-price-filter-list li.selected .tnc-filter-link:hover {
    /* Màu override bởi inline styles */
}

.tnc-widget-style-minimal .widget-title,
.tnc-widget-style-minimal .widgettitle {
    background: transparent;
    /* Màu và border override bởi inline styles */
}

.tnc-widget-style-minimal .tnc-product-count {
    background: #f0f0f0;
    color: #333;
}

.tnc-widget-style-minimal .tnc-filter-link:hover .tnc-product-count {
    /* Màu override bởi inline styles */
}

.tnc-widget-style-minimal .tnc-price-filter-list li.selected .tnc-filter-link .tnc-product-count {
    /* Màu override bởi inline styles */
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.tnc-filter-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.tnc-filter-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(0, 169, 224, 0.3);
    border-top-color: #00A9E0;
    border-radius: 50%;
    animation: tnc-spin 0.8s linear infinite;
}

@keyframes tnc-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.tnc-filter-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .tnc-widget-price-filter {
        border-radius: 5px;
    }
    
    .widget-title,
    .widgettitle {
        font-size: 14px;
        padding: 12px;
    }
    
    .tnc-filter-link {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .tnc-product-count {
        font-size: 11px;
        padding: 2px 6px;
    }
    
    .tnc-reset-button {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .tnc-filter-reset {
        padding-top: 12px;
    }
}

@media (max-width: 480px) {
    .tnc-filter-link {
        padding: 8px 10px;
    }
    
    .tnc-price-label {
        font-size: 12px;
    }
    
    .tnc-product-count {
        font-size: 10px;
    }
}

/* ==========================================================================
   Dark Mode Support (Optional)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .tnc-widget-price-filter {
        background: #1e1e1e;
    }
    
    .tnc-filter-link {
        background: #2d2d2d;
        color: #e0e0e0 !important;
    }
    
    .tnc-filter-link:hover {
        background: #4CAF50;
    }
    
    .tnc-widget-style-minimal .tnc-filter-link {
        border-bottom-color: #444;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .tnc-widget-price-filter {
        display: none;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.tnc-filter-link:focus {
    outline: 2px solid #00A9E0;
    outline-offset: 2px;
}

.tnc-reset-button:focus {
    outline: 2px solid #f44336;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .tnc-filter-link {
        border: 2px solid currentColor;
    }
    
    .tnc-price-filter-list li.selected .tnc-filter-link {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .tnc-filter-link,
    .tnc-reset-button {
        transition: none;
    }
    
    .tnc-filter-link:hover {
        transform: none;
    }
}

/* ==========================================================================
   Custom Scrollbar (cho sidebar dài)
   ========================================================================== */

.tnc-widget-price-filter::-webkit-scrollbar {
    width: 6px;
}

.tnc-widget-price-filter::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.tnc-widget-price-filter::-webkit-scrollbar-thumb {
    background: #00A9E0;
    border-radius: 3px;
}

.tnc-widget-price-filter::-webkit-scrollbar-thumb:hover {
    background: #0088b3;
}

/* ==========================================================================
   RTL Support
   ========================================================================== */

[dir="rtl"] .tnc-selected-icon {
    margin-right: 0;
    margin-left: 5px;
}

[dir="rtl"] .tnc-product-count {
    margin-left: 0;
    margin-right: 8px;
}

[dir="rtl"] .tnc-filter-link:hover {
    transform: translateX(-5px);
}

[dir="rtl"] .tnc-widget-style-minimal .tnc-filter-link:hover {
    transform: none;
}

/* ==========================================================================
   Animation Classes (cho AJAX)
   ========================================================================== */

.tnc-filter-fade-in {
    animation: tnc-fadeIn 0.3s ease-in;
}

.tnc-filter-fade-out {
    animation: tnc-fadeOut 0.3s ease-out;
}

@keyframes tnc-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tnc-fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ==========================================================================
   Debug Mode (thêm class .tnc-debug vào widget để test)
   ========================================================================== */

.tnc-debug .tnc-filter-link {
    border: 1px dashed red;
}

.tnc-debug .widget-title {
    border: 1px dashed blue;
}

.tnc-debug .tnc-price-filter-list {
    border: 1px dashed green;
}

/* ==========================================================================
   Custom Classes (để user tự define)
   ========================================================================== */

/* Ví dụ: Thêm icon */
.tnc-filter-with-icon .tnc-price-label::before {
    content: '💰 ';
    margin-right: 5px;
}

/* Ví dụ: Border style */
.tnc-filter-bordered .tnc-filter-link {
    border: 2px solid #00A9E0;
}

/* Ví dụ: Gradient background */
.tnc-filter-gradient .widget-title {
    background: linear-gradient(135deg, #00A9E0 0%, #0088b3 100%);
}

/* Ví dụ: Shadow effect */
.tnc-filter-shadow .tnc-widget-price-filter {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   End of File
   ========================================================================== */