/* ==========================================================================
   AQRO XƏBƏRLƏR listing — search / date filter / sort / page-size toolbar
   Markup: inc/news_list.php · Behaviour: js/news-list.js
   Desktop (>= 992px): single-row toolbar with popovers.
   Mobile  (<  992px): search row, [Sırala][Filter][count] row, chips, bottom sheets.
   Never uses the class .active (style.css paints every .active green).
   ========================================================================== */

.nl-toolbar,
.nl-results {
    --nl-teal: #0093CB;
    --nl-teal-dark: #007AA8;
    --nl-teal-light: #E6F5FA;
    --nl-navy: #1A2B49;
    --nl-text: #334155;
    --nl-muted: #64748B;
    --nl-border: #E2E8F0;
    --nl-surface: #F8FAFC;
    --nl-surface-2: #F1F5F9;
    --nl-danger: #B42318;
    --nl-radius: 10px;
    --nl-h: 38px;
    --nl-shadow-pop: 0 10px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .06);
}

.nl-toolbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--nl-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    font-family: 'Montserrat', sans-serif;
    color: var(--nl-text);
}

.nl-sr {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.nl-toolbar :focus-visible,
.nl-pager :focus-visible {
    outline: 2px solid var(--nl-teal, #0093CB);
    outline-offset: 2px;
}

/* ---------- Search ---------- */
.nl-search {
    position: relative;
    flex: 1 1 280px;
    min-width: 0;
    margin: 0;
}
.nl-toolbar .nl-search__input {
    width: 100%;
    height: var(--nl-h);
    margin: 0;
    padding: 0 38px 0 38px;
    font-size: 14px;
    color: var(--nl-navy);
    background: var(--nl-surface);
    border: 1px solid var(--nl-border);
    border-radius: var(--nl-radius);
    box-shadow: none;
    text-overflow: ellipsis;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color .2s, border-color .2s, box-shadow .2s;
}
.nl-toolbar .nl-search__input::placeholder { color: #94A3B8; opacity: 1; }
.nl-toolbar .nl-search__input:hover { background: #fff; }
.nl-toolbar .nl-search__input:focus {
    background: #fff;
    border-color: var(--nl-teal);
    box-shadow: 0 0 0 3px rgba(0, 147, 203, .18);
    outline: none;
}
.nl-search__input::-webkit-search-cancel-button,
.nl-search__input::-webkit-search-decoration { -webkit-appearance: none; display: none; }

.nl-search__btn,
.nl-search__clear {
    position: absolute;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: var(--nl-h);
    padding: 0;
    color: #94A3B8;
    background: none;
    border: 0;
    border-radius: var(--nl-radius);
    font-size: 14px;
    cursor: pointer;
}
.nl-search__btn { left: 0; }
.nl-search__clear { right: 0; }
.nl-search__btn:hover,
.nl-search__clear:hover { color: var(--nl-text); }
.nl-search:focus-within .nl-search__btn { color: var(--nl-teal); }

/* ---------- Control row ---------- */
.nl-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.nl-toolbar .nl-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0 10px;
    min-height: 30px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--nl-text);
    background: var(--nl-surface-2);
    border-radius: 8px;
    hyphens: none;
}
.nl-count__dot {
    flex: none;
    width: 8px; height: 8px;
    background: var(--nl-teal);
    border-radius: 50%;
}
.nl-toolbar .nl-count--found {
    color: var(--nl-teal-dark);
    background: var(--nl-teal-light);
    border: 1px solid rgba(0, 147, 203, .2);
}

.nl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: var(--nl-h);
    padding: 0 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: var(--nl-text);
    background: #fff;
    border: 1px solid var(--nl-border);
    border-radius: var(--nl-radius);
    cursor: pointer;
    transition: background-color .2s, border-color .2s, color .2s;
}
a.nl-btn { text-decoration: none; }
.nl-btn:hover { color: var(--nl-navy); background: var(--nl-surface); border-color: #CBD5E1; }
.nl-btn[aria-expanded="true"] { border-color: var(--nl-teal); color: var(--nl-navy); }
.nl-btn--on {
    color: var(--nl-teal-dark);
    background: var(--nl-teal-light);
    border-color: rgba(0, 147, 203, .4);
}
.nl-btn--on:hover { color: var(--nl-teal-dark); background: var(--nl-teal-light); border-color: var(--nl-teal); }
.nl-btn i { padding: 0; font-size: 13px; color: var(--nl-muted); }
.nl-btn--on i { color: var(--nl-teal); }
.nl-btn .nl-caret { font-size: 10px; color: #94A3B8; transition: transform .2s; }
.nl-btn[aria-expanded="true"] .nl-caret { transform: rotate(180deg); color: var(--nl-teal); }
.nl-muted { font-weight: 400; color: var(--nl-muted); }

.nl-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--nl-h);
    height: var(--nl-h);
    color: var(--nl-muted);
    border: 1px solid transparent;
    border-radius: var(--nl-radius);
    font-size: 14px;
}
.nl-reset:hover { color: var(--nl-text); background: var(--nl-surface-2); border-color: var(--nl-border); }
.nl-reset i { padding: 0; }

/* ---------- Popovers / menus ---------- */
.nl-dd { position: relative; }

.nl-pop {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 60;
    min-width: 220px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--nl-border);
    border-radius: 12px;
    box-shadow: var(--nl-shadow-pop);
    text-align: left;
}
.nl-pop--filter { width: 280px; padding: 14px; }

.nl-pop__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.nl-pop--filter .nl-pop__head {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--nl-surface-2);
}
.nl-pop--menu .nl-pop__head { display: none; }
.nl-pop__handle { display: none; }
.nl-toolbar .nl-pop__title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--nl-navy);
}
.nl-pop__close {
    display: none;
    padding: 6px 4px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--nl-teal-dark);
    background: none;
    border: 0;
    cursor: pointer;
}

.nl-toolbar .nl-menu { margin: 0; padding: 0; list-style: none; }
.nl-toolbar .nl-menu li { margin: 0; padding: 0; }
.nl-menu__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--nl-text);
    border-radius: 8px;
    white-space: nowrap;
}
.nl-menu__item:hover,
.nl-menu__item:focus { color: var(--nl-navy); background: var(--nl-surface); }
.nl-menu__check { visibility: hidden; padding: 0; font-size: 12px; color: var(--nl-teal); }
.nl-menu__item[aria-checked="true"] { font-weight: 700; color: var(--nl-teal-dark); background: rgba(230, 245, 250, .6); }
.nl-menu__item[aria-checked="true"] .nl-menu__check { visibility: visible; }

/* Filter form */
.nl-toolbar .nl-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.nl-toolbar .nl-legend {
    float: none;
    width: auto;
    margin: 0 0 8px;
    padding: 0;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: none;
    color: var(--nl-navy);
    background: none;
}
.nl-field { margin-bottom: 10px; }
.nl-toolbar .nl-field label {
    display: block;
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--nl-muted);
}
.nl-toolbar .nl-input {
    display: block;
    width: 100%;
    height: 36px;
    margin: 0;
    padding: 0 10px;
    font-family: inherit;
    font-size: 14px;
    color: var(--nl-navy);
    background: #fff;
    border: 1px solid var(--nl-border);
    border-radius: 8px;
}
.nl-toolbar .nl-input:focus { border-color: var(--nl-teal); box-shadow: 0 0 0 3px rgba(0, 147, 203, .18); outline: none; }
.nl-toolbar .nl-input[aria-invalid="true"] { border-color: var(--nl-danger); }
.nl-toolbar .nl-hint { margin: -4px 0 10px; font-size: 12px; line-height: 1.4; color: var(--nl-danger); hyphens: none; }

.nl-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.nl-seg__item { position: relative; margin: 0; }
.nl-seg__item input { position: absolute; opacity: 0; pointer-events: none; }
.nl-seg__item span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    font-size: 13px;
    font-weight: 600;
    color: var(--nl-text);
    background: var(--nl-surface);
    border: 1px solid var(--nl-border);
    border-radius: 10px;
    cursor: pointer;
}
.nl-seg__item input:checked + span { color: var(--nl-teal-dark); background: var(--nl-teal-light); border-color: var(--nl-teal); }
.nl-seg__item input:focus-visible + span { outline: 2px solid var(--nl-teal); outline-offset: 2px; }

.nl-pop__actions { display: flex; gap: 8px; padding-top: 4px; }
.nl-action {
    flex: 1;
    height: 36px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .2s;
}
.nl-action--sec { color: var(--nl-text); background: var(--nl-surface-2); }
.nl-action--sec:hover { background: var(--nl-border); }
.nl-action--pri { font-weight: 700; color: #fff; background: var(--nl-teal); }
.nl-action--pri:hover { background: var(--nl-teal-dark); }

/* ---------- Active filter chips (mobile) ---------- */
.nl-toolbar .nl-chips {
    display: none;
    flex: 1 0 100%;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0 0 2px;
    list-style: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.nl-toolbar .nl-chips::-webkit-scrollbar { display: none; }
.nl-toolbar .nl-chips li { flex: none; margin: 0; padding: 0; }
.nl-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--nl-text);
    background: var(--nl-surface-2);
    border-radius: 999px;
}
.nl-chip i { padding: 0; font-size: 11px; color: #94A3B8; }
.nl-chip:hover { color: var(--nl-navy); background: var(--nl-border); }
.nl-chips__clear {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--nl-teal-dark);
}

.nl-backdrop { display: none; }

.nl-only-mob { display: none !important; }

/* ---------- Result area: AJAX loading / error states ---------- */
.nl-region { display: contents; }

.nl-results { position: relative; outline: none; }
.nl-results [data-nl-body] { transition: filter .15s ease, opacity .15s ease; }
.nl-results.is-loading [data-nl-body] {
    filter: blur(2px);
    opacity: .55;
    pointer-events: none;
    user-select: none;
}
.nl-results-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding-top: 48px;
    background: rgba(255, 255, 255, .3);
    border-radius: 12px;
}
.nl-results.is-loading .nl-results-loading { display: flex; }
.nl-results-loading__box {
    position: sticky;
    top: 140px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--nl-navy);
    background: #fff;
    border: 1px solid var(--nl-border);
    border-radius: 999px;
    box-shadow: var(--nl-shadow-pop);
}
.nl-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--nl-teal-light);
    border-top-color: var(--nl-teal);
    border-radius: 50%;
    animation: nl-spin .7s linear infinite;
}
@keyframes nl-spin { to { transform: rotate(360deg); } }

.nl-results-error {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px 12px 10px 16px;
    font-size: 14px;
    color: var(--nl-danger);
    background: #FEF3F2;
    border: 1px solid #FECDCA;
    border-radius: 10px;
}
.nl-results-error .nl-action { flex: none; height: 36px; padding: 0 14px; }

/* ---------- Empty state ---------- */
.nl-empty {
    margin-bottom: 40px;
    padding: 40px 20px;
    text-align: center;
    background: var(--nl-surface);
    border: 1px dashed var(--nl-border);
    border-radius: 12px;
}
.nl-empty i { font-size: 28px; color: #94A3B8; }
.nl-empty p { margin: 10px 0 12px; font-size: 15px; color: var(--nl-text); }
.nl-empty a { font-size: 14px; font-weight: 600; color: var(--nl-teal-dark); text-decoration: underline; }

/* ---------- News grid (scoped tweaks to the existing cards) ---------- */
.nl-grid .ltn__blog-item-3 .ltn__blog-img img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

/* ---------- Pagination footer ---------- */
.nl-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--nl-border);
}
.nl-pager .nl-pager__summary { margin: 0; font-size: 13px; color: var(--nl-muted); hyphens: none; }
.nl-pager__summary strong { font-weight: 600; color: var(--nl-text); }
.nl-pager .pagination { margin: 0; flex-wrap: wrap; gap: 4px; }
.nl-pager .page-item,
.nl-pager .page-item.active { padding: 0; background: none; }
.nl-pager .page-item.active::before { display: none; }
.nl-pager a.page-link {
    min-width: 34px;
    text-align: center;
    color: var(--nl-text);
    border: 1px solid var(--nl-border);
    border-radius: 8px !important;
}
.nl-pager a.page-link:hover { color: var(--nl-navy); background: var(--nl-surface-2); }
.nl-pager .page-item.active .page-link { color: #fff; background: var(--nl-teal); border-color: var(--nl-teal); }
.nl-pager .page-item.disabled .page-link { color: #CBD5E1; }
.nl-pager__compact { display: none; }
.nl-pager__compact .nl-btn { --nl-h: 44px; min-width: 96px; font-size: 13px; }
.nl-pager__compact span.nl-btn { color: #CBD5E1; cursor: default; background: #fff; }
.nl-pager__of { font-size: 13px; font-weight: 700; color: var(--nl-text); }

/* ==========================================================================
   Tablet + mobile (< 992px)
   ========================================================================== */
@media (max-width: 991px) {
    .nl-toolbar { --nl-h: 44px; gap: 10px; margin-bottom: 24px; }

    .nl-only-desk { display: none !important; }
    .nl-only-mob { display: initial !important; }
    i.nl-only-mob { display: inline-block !important; }
    .nl-fieldset.nl-only-mob { display: block !important; }

    .nl-search { flex-basis: 100%; }
    .nl-toolbar .nl-search__input { font-size: 16px; } /* no iOS zoom on focus */
    .nl-search__btn, .nl-search__clear { width: 44px; }
    .nl-toolbar .nl-search__input { padding: 0 44px; }

    .nl-bar { flex: 1 0 100%; flex-wrap: nowrap; justify-content: flex-start; }
    .nl-dd--sort { order: 1; flex: 1 1 0; min-width: 0; }
    .nl-dd--filter { order: 2; flex: 1 1 0; min-width: 0; }
    .nl-toolbar .nl-count { order: 3; flex: 0 1 34%; min-width: 0; justify-content: flex-end; padding: 0 2px; text-align: right; background: none; border: 0; color: var(--nl-muted); }
    .nl-toolbar .nl-count--found { color: var(--nl-teal-dark); }
    .nl-count__dot { display: none; }
    .nl-dd--size, .nl-reset { display: none; }
    .nl-dd .nl-btn { width: 100%; font-size: 13px; background: var(--nl-surface); }
    .nl-dd .nl-btn--on { background: var(--nl-teal-light); }

    .nl-toolbar .nl-chips { display: flex; }

    /* Bottom sheet */
    .nl-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1000;
        display: block;
        background: rgba(15, 23, 42, .45);
    }
    .nl-pop,
    .nl-pop--filter {
        position: fixed;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1001;
        width: auto;
        max-width: 560px;
        max-height: 85vh;
        margin: 0 auto;
        padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
        overflow-y: auto;
        border: 0;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 30px rgba(15, 23, 42, .18);
        animation: nl-sheet-in .2s ease-out;
    }
    .nl-pop__head,
    .nl-pop--menu .nl-pop__head,
    .nl-pop--filter .nl-pop__head {
        display: flex;
        position: relative;
        margin: 0 0 8px;
        padding: 14px 0 10px;
        border-bottom: 1px solid var(--nl-surface-2);
    }
    .nl-pop__handle {
        display: block;
        position: absolute;
        top: 2px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        background: #CBD5E1;
        border-radius: 4px;
    }
    .nl-toolbar .nl-pop__title { font-size: 15px; }
    .nl-pop__close { display: block; min-height: 44px; }
    .nl-menu__item { min-height: 48px; font-size: 15px; }
    .nl-field label { font-size: 12px; }
    .nl-toolbar .nl-input { height: 44px; font-size: 16px; }
    .nl-fieldset + .nl-fieldset { margin-top: 16px; }
    .nl-pop__actions { padding-top: 16px; }
    .nl-action { height: 48px; font-size: 15px; }

    .ltn__blog-item-3-normal .nl-grid .ltn__blog-item-3 { margin-bottom: 24px; }
}

@media (max-width: 575px) {
    .nl-pager { justify-content: center; }
    .nl-pager__summary { width: 100%; text-align: center; }
    .nl-pager__full { display: none; }
    .nl-pager__compact {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
    }
    .nl-grid .ltn__blog-item-3 .ltn__blog-brief { padding: 20px; }
}

@media (max-width: 359px) {
    .nl-dd .nl-btn { padding: 0 8px; font-size: 12px; }
    .nl-toolbar .nl-count { font-size: 11px; }
    .nl-pager__compact .nl-btn { min-width: 0; padding: 0 10px; }
}

@keyframes nl-sheet-in {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .nl-pop { animation: none; }
    .nl-spinner { animation-duration: 1.6s; }
    .nl-results [data-nl-body] { transition: none; }
    .nl-toolbar *, .nl-pager * { transition: none !important; }
}
