/**
 * eKolayKod Pagination & Filter Styles v2.9
 * Modern, kompakt, responsive ve her temaya uyumlu.
 * - Boş filtre grupları render edilmiyor
 * - Seçili filtreler üstte chip olarak gösteriliyor
 * - Wrapper template desteği (sol/sağ sidebar layout)
 *
 * @version 2.9.0
 * @author eKolayKod
 */

/* ==================== PAGINATION ==================== */
.ek-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 16px;
    margin-top: 20px;
    margin-bottom: 5px;
    box-sizing: border-box;
}

.row .ek-pagination,
.row > .ek-pagination {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
}

.ek-pagination-list {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ek-pagination-item {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ek-pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ek-pagination-link:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.ek-pagination-link.ek-pagination-current,
.ek-pagination-item.active .ek-pagination-link {
    color: #fff;
    background: #2563eb;
    border-color: #2563eb;
    font-weight: 600;
}

.ek-pagination-link.disabled,
.ek-pagination-item.disabled .ek-pagination-link {
    color: #9ca3af;
    background: #f9fafb;
    border-color: #e5e7eb;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.5;
}

.ek-pagination-prev::before { content: '‹'; margin-right: 4px; font-size: 16px; }
.ek-pagination-next::after { content: '›'; margin-left: 4px; font-size: 16px; }

.ek-pagination-ellipsis {
    color: #9ca3af;
    padding: 0 4px;
    font-size: 14px;
}

.ek-pagination-summary {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 12px 0;
    color: #6b7280;
    font-size: 13px;
}

.ek-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.5;
}

.ek-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: ek-spin 0.7s linear infinite;
}

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

/* ==================== FILTER WRAPPER ==================== */
.ek-filter-wrapper {
    width: 100%;
    padding: 0 16px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.row .ek-filter-wrapper { width: 100%; max-width: 100%; }

/* ==================== FILTER CONTAINER ==================== */
.ek-filter-container,
.ek-product-filters,
.product-filters {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px 20px;
    width: 100%;
    box-sizing: border-box;
}

.ek-filter-container.ek-filter-loading,
.ek-product-filters.ek-filter-loading {
    pointer-events: none;
    opacity: 0.6;
}

/* ==================== FILTER FORM ==================== */
.ek-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.ek-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

/* Başlıklar */
.ek-filter-title,
.ek-filter-group h4 {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 2px 0;
}

/* ==================== INPUT STILLER ==================== */
.ek-filter-select,
.ek-filter-input,
.ek-sort-select,
.ek-price-min,
.ek-price-max,
.ek-search-input {
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.ek-filter-select:focus,
.ek-filter-input:focus,
.ek-sort-select:focus,
.ek-search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Arama */
.ek-search-wrapper {
    position: relative;
}

.ek-search-wrapper .ek-search-input {
    padding-left: 36px;
}

.ek-search-wrapper::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
    background-size: contain;
    pointer-events: none;
}

/* Fiyat */
.ek-price-range,
.ek-price-inputs {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ek-price-range .ek-price-min,
.ek-price-range .ek-price-max,
.ek-price-inputs .ek-price-min,
.ek-price-inputs .ek-price-max {
    width: 80px;
    text-align: center;
}

.ek-price-separator {
    color: #9ca3af;
    font-size: 12px;
}

/* ==================== RADIO & CHECKBOX GRUPLAR ==================== */
.ek-filter-radio-group,
.ek-filter-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ==================== OPTION STİLLERİ (Marka, Kategori, Tag, Attribute) ==================== */
.ek-brand-option,
.ek-category-option,
.ek-tag-option,
.ek-attribute-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.ek-brand-option:hover,
.ek-category-option:hover,
.ek-tag-option:hover,
.ek-attribute-option:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* SEÇİLİ DURUM - has() ile */
.ek-brand-option:has(input:checked),
.ek-category-option:has(input:checked),
.ek-tag-option:has(input:checked),
.ek-attribute-option:has(input:checked) {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1d4ed8;
    font-weight: 500;
}

/* SEÇİLİ DURUM - Fallback (has() desteklemeyen browserlar için) */
.ek-brand-option.selected,
.ek-category-option.selected,
.ek-tag-option.selected,
.ek-attribute-option.selected,
.ek-brand-option input:checked + span,
.ek-category-option input:checked + span,
.ek-tag-option input:checked + span,
.ek-attribute-option input:checked + span {
    color: #1d4ed8;
}

.ek-brand-option input[type="radio"],
.ek-category-option input[type="checkbox"],
.ek-tag-option input[type="radio"],
.ek-attribute-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #2563eb;
    margin: 0;
    flex-shrink: 0;
}

.ek-brand-option span,
.ek-category-option span,
.ek-tag-option span,
.ek-attribute-option span {
    line-height: 1.2;
}

/* ==================== STOK CHECKBOX ==================== */
.ek-filter-stock,
.ek-stock-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ek-filter-stock:hover,
.ek-stock-label:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.ek-filter-stock:has(input:checked),
.ek-stock-label:has(input:checked) {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1d4ed8;
}

.ek-filter-stock input[type="checkbox"],
.ek-stock-checkbox {
    width: 14px;
    height: 14px;
    accent-color: #2563eb;
    margin: 0;
}

.ek-filter-checkbox-label,
.ek-stock-label span {
    font-size: 13px;
}

/* Genel filter checkbox */
.ek-filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ek-filter-checkbox:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.ek-filter-checkbox:has(input:checked) {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1d4ed8;
}

.ek-filter-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #2563eb;
    margin: 0;
}

/* ==================== BUTONLAR ==================== */
.ek-filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.ek-filter-apply,
.ek-filter-btn-primary {
    height: 38px;
    padding: 0 20px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #2563eb;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.ek-filter-apply:hover,
.ek-filter-btn-primary:hover {
    background: #1d4ed8;
}

.ek-filter-clear,
.ek-filter-btn-secondary {
    height: 38px;
    padding: 0 16px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.ek-filter-clear:hover,
.ek-filter-btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    text-decoration: none;
}

/* ==================== AKTİF FİLTRELER (Üstte Chip/Tag olarak) ==================== */
.ek-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
    align-items: center;
}

.ek-active-filters:empty {
    display: none;
}

.ek-active-filters-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

/* Filtre Chip Stili */
.ek-filter-chip,
.ek-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    color: #1d4ed8;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    transition: all 0.15s ease;
}

.ek-filter-chip:hover,
.ek-filter-tag:hover {
    background: #bfdbfe;
}

.ek-filter-chip-text {
    line-height: 1.2;
}

.ek-filter-chip-remove,
.ek-filter-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 16px;
    font-weight: 400;
    color: #1d4ed8;
    background: rgba(29, 78, 216, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    text-decoration: none;
    transition: all 0.15s ease;
}

.ek-filter-chip-remove:hover,
.ek-filter-tag-remove:hover {
    background: rgba(29, 78, 216, 0.25);
    color: #1e40af;
}

/* Tümünü Temizle Butonu */
.ek-filter-clear-all {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    margin-left: auto;
}

.ek-filter-clear-all:hover {
    background: #fee2e2;
    border-color: #f87171;
    text-decoration: none;
}

/* ==================== ÜRÜN ÖZETİ ==================== */
.ek-product-summary {
    display: inline-block;
    font-size: 14px;
    color: #6b7280;
    padding: 8px 0;
}

.ek-product-summary strong {
    color: #374151;
    font-weight: 600;
}

/* ==================== HATA & SONUÇ YOK ==================== */
.ek-filter-error,
.ek-pagination-error {
    padding: 12px 16px;
    text-align: center;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 13px;
}

.ek-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.ek-no-results-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.ek-no-results-text {
    font-size: 13px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .ek-pagination-link {
        min-width: 34px;
        height: 34px;
        font-size: 13px;
    }

    .ek-pagination-prev span,
    .ek-pagination-next span {
        display: none;
    }

    .ek-filter-container,
    .ek-product-filters {
        padding: 12px 14px;
    }

    .ek-filter-form {
        gap: 12px;
    }

    .ek-filter-group {
        min-width: 100%;
    }

    .ek-filter-actions {
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
    }

    .ek-filter-apply,
    .ek-filter-clear {
        flex: 1;
    }

    .ek-price-range .ek-price-min,
    .ek-price-range .ek-price-max {
        flex: 1;
        width: auto;
    }
}

@media (max-width: 480px) {
    .ek-pagination-list { gap: 4px; }
    .ek-pagination-link { min-width: 32px; height: 32px; font-size: 12px; }

    .ek-filter-container,
    .ek-product-filters {
        padding: 10px 12px;
        border-radius: 8px;
    }

    .ek-filter-select,
    .ek-filter-input,
    .ek-sort-select,
    .ek-search-input,
    .ek-filter-apply,
    .ek-filter-clear {
        height: 36px;
        font-size: 12px;
    }

    .ek-brand-option,
    .ek-category-option,
    .ek-tag-option,
    .ek-attribute-option {
        padding: 5px 8px;
        font-size: 12px;
    }
}

/* ==================== PRODUCT-FILTERS (Alternatif class) ==================== */
.product-filters form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
}

.product-filters .filter-brand,
.product-filters .filter-category,
.product-filters .filter-price,
.product-filters .filter-stock,
.product-filters .filter-sort,
.product-filters .filter-search,
.product-filters .filter-tag {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.product-filters h4,
.product-filters h5 {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.product-filters input[type="text"],
.product-filters input[type="number"],
.product-filters input[type="search"],
.product-filters select {
    height: 36px;
    padding: 0 10px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
}

.product-filters input:focus,
.product-filters select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.product-filters label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 13px;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.product-filters label:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.product-filters label:has(input:checked) {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1d4ed8;
}

.product-filters input[type="checkbox"],
.product-filters input[type="radio"] {
    width: 14px;
    height: 14px;
    accent-color: #2563eb;
    margin: 0;
}

.product-filters .filter-price .price-inputs {
    display: flex;
    gap: 4px;
    align-items: center;
}

.product-filters .filter-price input[type="number"] {
    width: 70px;
    text-align: center;
}

.product-filters .price-separator {
    color: #9ca3af;
    font-size: 12px;
}

.product-filters button[type="submit"],
.product-filters .btn-filter {
    height: 36px;
    padding: 0 18px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #2563eb;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.product-filters button[type="submit"]:hover {
    background: #1d4ed8;
}

.product-filters .filter-clear,
.product-filters .btn-clear,
.product-filters a[href*="clear"] {
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.product-filters .filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

@media (max-width: 768px) {
    .product-filters { padding: 12px; }
    .product-filters form { flex-direction: column; }
    .product-filters .filter-brand,
    .product-filters .filter-category,
    .product-filters .filter-price,
    .product-filters .filter-sort { width: 100%; min-width: unset; }
    .product-filters .filter-actions { width: 100%; margin-left: 0; }
    .product-filters button[type="submit"],
    .product-filters .filter-clear { flex: 1; }
}

/* ==================== PRINT ==================== */
@media print {
    .ek-filter-container,
    .ek-product-filters,
    .product-filters,
    .ek-pagination,
    .ek-active-filters {
        display: none !important;
    }
}
