/* ═══════════════════════════════════════════════
   Kian Search Filter - Styles
   ═══════════════════════════════════════════════ */

.ksf-wrap {
    margin: 24px 0 32px;
    font-family: 'Cairo', 'Noto Kufi Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
    direction: rtl;
}

.ksf-container {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

/* ═══ Tabs ═══ */
.ksf-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.ksf-tab {
    flex: 1;
    padding: 14px 12px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.ksf-tab:hover {
    background: #fff;
    color: #0891B2;
}

.ksf-tab.active {
    background: #fff;
    color: #0891B2;
    border-bottom-color: #0891B2;
}

.ksf-tab-ic {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ═══ Body ═══ */
.ksf-body {
    padding: 20px;
}

.ksf-pane {
    display: none;
}

.ksf-pane.active {
    display: block;
}

/* ═══ Quick Search Tab ═══ */
.ksf-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 6px;
    transition: all 0.2s;
    margin-bottom: 12px;
    position: relative;
}

.ksf-search-box:focus-within {
    border-color: #0891B2;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.08);
}

.ksf-search-ic {
    width: 20px;
    height: 20px;
    color: #64748b;
    flex-shrink: 0;
    margin-right: 8px;
}

.ksf-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 6px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    color: #0F172A;
    min-width: 0;
}

.ksf-input::placeholder {
    color: #94a3b8;
}

.ksf-btn {
    background: #0891B2;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    white-space: nowrap;
}

.ksf-btn:hover {
    background: #0E7490;
    transform: translateY(-1px);
}

.ksf-btn:active {
    transform: translateY(0);
}

.ksf-btn-full {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 15px;
}

/* ═══ Suggestions (Fuzzy Live Results) ═══ */
.ksf-suggestions {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.ksf-suggestions.show {
    display: block;
}

.ksf-sug-group {
    padding: 8px 0;
}

.ksf-sug-group + .ksf-sug-group {
    border-top: 1px solid #f1f5f9;
}

.ksf-sug-label {
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ksf-sug-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.ksf-sug-item:hover {
    background: #f0f9ff;
}

.ksf-sug-item-ic {
    width: 32px;
    height: 32px;
    background: #f0f9ff;
    color: #0891B2;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ksf-sug-item-text {
    flex: 1;
    font-size: 14px;
    color: #0F172A;
}

.ksf-sug-item-meta {
    font-size: 11px;
    color: #94a3b8;
}

.ksf-sug-empty {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.ksf-sug-empty-ic {
    width: 48px;
    height: 48px;
    margin: 0 auto 8px;
    color: #cbd5e1;
}

/* ═══ Chips (Quick Selections) ═══ */
.ksf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.ksf-chips-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    margin-left: 4px;
}

.ksf-chip {
    padding: 7px 14px;
    background: #f0f9ff;
    color: #0891B2;
    border: 1px solid #bae6fd;
    border-radius: 20px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.ksf-chip:hover {
    background: #0891B2;
    color: #fff;
    border-color: #0891B2;
}

/* ═══ Advanced Tab ═══ */
.ksf-adv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.ksf-adv-grid .ksf-btn-full {
    grid-column: 1 / -1;
    margin-top: 6px;
}

.ksf-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ksf-field label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.ksf-select-wrap {
    position: relative;
}

.ksf-select {
    width: 100%;
    padding: 11px 36px 11px 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    color: #0F172A;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.15s;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px;
}

.ksf-select:focus {
    outline: none;
    border-color: #0891B2;
    background-color: #fff;
}

.ksf-select:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* ═══ Location Tab ═══ */
.ksf-loc-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #eff6ff;
    color: #1e40af;
    border-radius: 10px;
    font-size: 12px;
    margin-bottom: 14px;
}

.ksf-countries {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 14px;
}

.ksf-country-tab {
    padding: 12px 8px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ksf-country-tab:hover {
    border-color: #0891B2;
    background: #f0f9ff;
}

.ksf-country-tab.active {
    background: #0891B2;
    border-color: #0891B2;
    color: #fff;
}

.ksf-country-flag {
    font-size: 24px;
    line-height: 1;
}

.ksf-country-name {
    font-size: 12px;
    font-weight: 700;
    color: inherit;
}

.ksf-country-count {
    font-size: 10px;
    opacity: 0.75;
    font-weight: 600;
}

.ksf-country-tab.active .ksf-country-count {
    color: #fff;
}

/* City filter box */
.ksf-city-filter-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 6px 12px;
    margin-bottom: 12px;
}

.ksf-city-filter-box:focus-within {
    border-color: #0891B2;
    background: #fff;
}

.ksf-search-ic-sm {
    width: 16px;
    height: 16px;
    color: #64748b;
    flex-shrink: 0;
}

.ksf-city-filter {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.ksf-cities-container {
    max-height: 280px;
    overflow-y: auto;
    padding: 2px;
}

.ksf-cities-group {
    display: none;
}

.ksf-cities-group.active {
    display: block;
}

.ksf-cities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}

.ksf-city-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: #0F172A;
    text-align: right;
    transition: all 0.15s;
}

.ksf-city-btn:hover {
    border-color: #0891B2;
    background: #f0f9ff;
    color: #0891B2;
    transform: translateY(-1px);
}

.ksf-city-btn svg {
    color: #94a3b8;
    transition: color 0.15s;
}

.ksf-city-btn:hover svg {
    color: #0891B2;
}

.ksf-city-btn.hidden {
    display: none;
}

/* ═══ Results ═══ */
.ksf-results {
    margin-top: 20px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
}

.ksf-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 12px;
}

.ksf-results-header h3 {
    margin: 0;
    font-size: 15px;
    color: #0F172A;
}

.ksf-close-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.15s;
}

.ksf-close-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

.ksf-results-list {
    display: grid;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.ksf-result-item {
    display: block;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s;
}

.ksf-result-item:hover {
    border-color: #0891B2;
    background: #f0f9ff;
    transform: translateX(-2px);
}

.ksf-result-title {
    font-size: 14px;
    font-weight: 700;
    color: #0891B2;
    margin-bottom: 4px;
}

.ksf-result-excerpt {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}

.ksf-no-results {
    padding: 32px 16px;
    text-align: center;
    color: #94a3b8;
}

.ksf-no-results-ic {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    color: #cbd5e1;
}

.ksf-no-results-title {
    font-size: 14px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 4px;
}

.ksf-loading {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 13px;
}

.ksf-loading-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid #e2e8f0;
    border-top-color: #0891B2;
    border-radius: 50%;
    animation: ksfSpin 0.8s linear infinite;
    margin: 0 auto 8px;
}

@keyframes ksfSpin {
    to { transform: rotate(360deg); }
}

/* ═══ Mobile Responsive ═══ */
@media (max-width: 768px) {
    .ksf-wrap {
        margin: 16px 0 24px;
    }
    
    .ksf-container {
        border-radius: 12px;
    }
    
    .ksf-tab {
        padding: 11px 6px;
        font-size: 12px;
        gap: 4px;
    }
    
    .ksf-tab-ic {
        width: 14px;
        height: 14px;
    }
    
    .ksf-tab span {
        font-size: 12px;
    }
    
    .ksf-body {
        padding: 14px;
    }
    
    .ksf-search-box {
        flex-wrap: wrap;
    }
    
    .ksf-input {
        font-size: 14px;
        min-width: 150px;
    }
    
    .ksf-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .ksf-adv-grid {
        grid-template-columns: 1fr;
    }
    
    .ksf-countries {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    
    .ksf-country-tab {
        padding: 8px 4px;
    }
    
    .ksf-country-flag {
        font-size: 20px;
    }
    
    .ksf-country-name {
        font-size: 11px;
    }
    
    .ksf-country-count {
        font-size: 9px;
    }
    
    .ksf-cities-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .ksf-city-btn {
        padding: 8px;
        font-size: 11.5px;
    }
    
    .ksf-chips {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }
    
    .ksf-chip {
        white-space: nowrap;
    }
}
