/*
 * File: wp-content/themes/remotiko-astra-child/assets/css/job-archive.css
 * Styles for the jobs archive page (archive-job_listing.php).
 * Depends on CSS variables in style.css and classes in job-card.css.
 */

/* ============================================================
   ARCHIVE WRAPPER
   ============================================================ */
.remotiko-archive {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 64px;
    box-sizing: border-box;
}

/* ============================================================
   1. PAGE HEADER
   ============================================================ */
.remotiko-archive__header {
    margin-bottom: 28px;
}

.remotiko-archive__heading {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
    margin: 0 0 8px;
    font-family: 'Inter', sans-serif;
}

.remotiko-archive__subheading {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
    line-height: 1.5;
}

/* ============================================================
   2. SEARCH BAR CARD
   ============================================================ */
.remotiko-archive__searchbar {
    margin-bottom: 20px;
}

.remotiko-searchbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #FFFFFF;
    border: 0.5px solid var(--remotiko-card-border);
    border-radius: var(--remotiko-card-radius);
    padding: 14px 16px;
}

.remotiko-searchbar__input,
.remotiko-searchbar__select {
    height: 38px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 13px;
    color: #374151;
    background: #F9FAFB;
    padding: 0 12px;
    outline: none;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.remotiko-searchbar__input {
    flex: 1 1 200px;
    min-width: 160px;
}

.remotiko-searchbar__select {
    flex: 0 1 160px;
    min-width: 130px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    /* chevron */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.remotiko-searchbar__input:focus,
.remotiko-searchbar__select:focus {
    border-color: var(--remotiko-purple);
    background: #FFFFFF;
}

.remotiko-searchbar__btn {
    flex-shrink: 0;
    height: 38px;
    padding: 0 20px;
    white-space: nowrap;
}

/* ============================================================
   3. STATS ROW
   ============================================================ */
.remotiko-stats-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.remotiko-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: #F3F4F6;
    border: 0.5px solid #E5E7EB;
    border-radius: 999px;
    font-size: 12px;
    color: #4B5563;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.remotiko-stat-pill--verified {
    background: #F0FDF4;
    border-color: #86EFAC;
    color: #16A34A;
}

/* ============================================================
   4. TWO-COLUMN GRID  [200px sidebar | 1fr main]
   ============================================================ */
.remotiko-archive__body {
    display: grid;
    grid-template-columns: 200px 1fr;
    column-gap: 24px;
    align-items: start;
}

/* ============================================================
   5. SIDEBAR
   ============================================================ */
.remotiko-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 24px; /* stays in view while scrolling */
}

/* ── Filter group card ─────────────────────────────────────── */
.remotiko-filter-group {
    background: #FFFFFF;
    border: 0.5px solid var(--remotiko-card-border);
    border-radius: var(--remotiko-card-radius);
    padding: 14px;
}

.remotiko-filter-group__title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9CA3AF;
    margin: 0 0 10px;
    line-height: 1;
}

/* ── Filter items (label wrapping checkbox/radio) ──────────── */
.remotiko-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.12s ease;
}

.remotiko-filter-item input[type="checkbox"],
.remotiko-filter-item input[type="radio"] {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    accent-color: var(--remotiko-purple);
    cursor: pointer;
}

.remotiko-filter-item__label {
    flex: 1;
    font-size: 12px;
    color: #4B5563;
    line-height: 1.3;
    transition: color 0.12s ease;
}

.remotiko-filter-item__count {
    font-size: 10px;
    color: #9CA3AF;
    background: #F3F4F6;
    padding: 1px 5px;
    border-radius: 999px;
    font-weight: 500;
    line-height: 1.4;
    flex-shrink: 0;
}

/* Active state — checked item gets purple label */
.remotiko-filter-item.is-active .remotiko-filter-item__label,
.remotiko-filter-item input:checked ~ .remotiko-filter-item__label {
    color: var(--remotiko-purple);
    font-weight: 500;
}

/* ============================================================
   6. MAIN CONTENT COLUMN
   ============================================================ */
.remotiko-jobs-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0; /* prevents grid blowout */
}

/* ── Sort row ──────────────────────────────────────────────── */
.remotiko-sort-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 0.5px solid var(--remotiko-card-border);
    margin-bottom: 4px;
}

.remotiko-sort-row__count {
    font-size: 13px;
    color: #6B7280;
}

.remotiko-sort-row__count strong {
    color: #111827;
    font-weight: 600;
}

.remotiko-sort-row__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.remotiko-sort-row__label {
    font-size: 12px;
    color: #9CA3AF;
    white-space: nowrap;
}

.remotiko-sort-row__select {
    height: 32px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 12px;
    color: #374151;
    background: #F9FAFB;
    padding: 0 28px 0 10px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    outline: none;
}

.remotiko-sort-row__select:focus {
    border-color: var(--remotiko-purple);
    background-color: #FFFFFF;
}

/* ── Job card spacing within the main column ───────────────── */
.remotiko-jobs-main .remotiko-job-card {
    /* cards already have their own border/bg from job-card.css */
}

/* ============================================================
   7. EMPTY STATE
   ============================================================ */
.remotiko-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    background: #FFFFFF;
    border: 0.5px solid var(--remotiko-card-border);
    border-radius: var(--remotiko-card-radius);
}

.remotiko-empty-state__icon {
    color: #D1D5DB;
    margin-bottom: 16px;
}

.remotiko-empty-state__msg {
    font-size: 15px;
    color: #6B7280;
    margin: 0 0 16px;
    font-weight: 500;
}

.remotiko-empty-state__clear {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    color: var(--remotiko-purple);
    text-decoration: none;
    padding: 8px 18px;
    border: 1px solid var(--remotiko-purple);
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.remotiko-empty-state__clear:hover {
    background: var(--remotiko-purple);
    color: #FFFFFF;
}

/* ============================================================
   8. PAGINATION
   ============================================================ */
.remotiko-pagination {
    margin-top: 8px;
}

.remotiko-pagination .page-numbers {
    /* paginate_links outputs a <ul> */
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.remotiko-pagination .page-numbers li {
    display: contents; /* flattens the <li> wrapper */
}

.remotiko-pagination .page-numbers a,
.remotiko-pagination .page-numbers span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    background: #FFFFFF;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
}

.remotiko-pagination .page-numbers a:hover {
    border-color: var(--remotiko-purple);
    color: var(--remotiko-purple);
}

/* Current page */
.remotiko-pagination .page-numbers .current {
    background: var(--remotiko-purple);
    border-color: var(--remotiko-purple);
    color: #FFFFFF;
    font-weight: 600;
}

/* Dots (…) */
.remotiko-pagination .page-numbers .dots {
    border-color: transparent;
    background: transparent;
    color: #9CA3AF;
    min-width: auto;
    padding: 0 4px;
}

/* ============================================================
   9. MOBILE  ≤ 768px — single column, sidebar above main
   ============================================================ */
@media (max-width: 768px) {

    .remotiko-archive {
        padding: 24px 16px 48px;
    }

    .remotiko-archive__heading {
        font-size: 22px;
    }

    /* Stack search bar vertically */
    .remotiko-searchbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .remotiko-searchbar__input,
    .remotiko-searchbar__select,
    .remotiko-searchbar__btn {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
    }

    /* Single column — sidebar moves above main */
    .remotiko-archive__body {
        grid-template-columns: 1fr;
        row-gap: 20px;
    }

    .remotiko-sidebar {
        position: static; /* remove sticky on mobile */
        order: -1;        /* visually above main content */
    }

    /* Collapse filter groups horizontally on mobile */
    .remotiko-filter-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 8px;
    }

    .remotiko-filter-group__title {
        grid-column: 1 / -1;
    }

    /* Sort row wraps on narrow screens */
    .remotiko-sort-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Pagination centres on mobile */
    .remotiko-pagination .page-numbers {
        justify-content: center;
    }
}

/* ============================================================
   10. EXTRA SMALL  ≤ 480px
   ============================================================ */
@media (max-width: 480px) {

    .remotiko-filter-group {
        grid-template-columns: 1fr; /* one column on tiny screens */
    }

    .remotiko-stat-pill {
        font-size: 11px;
        padding: 4px 10px;
    }
}

/* ============================================================
   11. AJAX LOADING — skeleton cards + error state
   ============================================================ */

/* ── Skeleton pulse animation ────────────────────────────────── */
@keyframes rsk-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* Skeleton card — same outer shape as a real .remotiko-card */
.remotiko-card--skeleton {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border: 0.5px solid var(--remotiko-card-border, #E5E7EB);
    border-radius: var(--remotiko-card-radius, 12px);
    background: #FFFFFF;
    animation: rsk-pulse 1.4s ease-in-out infinite;
    pointer-events: none;
}

/* Logo placeholder — 48×48 grey square */
.rsk-logo {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #E5E7EB;
}

/* Body */
.rsk-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Generic skeleton line */
.rsk-line {
    height: 12px;
    border-radius: 6px;
    background: #E5E7EB;
}

.rsk-line--sm   { width: 30%; }
.rsk-line--lg   { width: 65%; height: 16px; }
.rsk-line--md   { width: 50%; }
.rsk-line--tags { width: 40%; height: 20px; border-radius: 10px; }

/* ── AJAX error block ────────────────────────────────────────── */
.remotiko-ajax-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 24px;
    text-align: center;
    color: #6B7280;
}

.remotiko-ajax-error svg {
    color: #D1D5DB;
}

.remotiko-ajax-error p {
    font-size: 15px;
    margin: 0;
    color: #374151;
}

.remotiko-ajax-error__retry {
    margin-top: 4px;
}
