/**
 * HLTV News Archive Style
 * Companion stylesheet for hltv-news-archive.php
 *
 * Builds on top of hltv-news-style.css (which styles the .hltv-news-list rows).
 * Adds: filter bar, meta row, load more, spinner, mobile responsive.
 */

/* ============================================
   Root container
   ============================================ */
.hltv-news-archive {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #e6edf3;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* While AJAX is loading */
.hltv-news-archive.is-busy .hltv-news-list { opacity: .5; pointer-events: none; }
.hltv-news-archive.is-busy { transition: opacity .15s; }

/* ============================================
   Filter bar
   ============================================ */
.hltv-news-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #161a21;
    border: 1px solid #21262d;
    border-radius: 6px;
}

/* Search wrapper */
.hltv-news-filter-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 220px;
    min-width: 160px;
}

.hltv-news-search-icon {
    position: absolute;
    left: 10px;
    color: #6e7681;
    pointer-events: none;
}

.hltv-news-input {
    width: 100%;
    height: 34px;
    padding: 0 10px 0 32px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-size: 13px;
    line-height: 1;
    outline: none;
    transition: border-color .15s, background .15s;
}

.hltv-news-input::placeholder { color: #6e7681; }
.hltv-news-input:focus { border-color: #e94560; background: #0f141b; }

/* Search reset button (native UA control) */
.hltv-news-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e7681' stroke-width='2.5' stroke-linecap='round'><line x1='6' y1='6' x2='18' y2='18'/><line x1='6' y1='18' x2='18' y2='6'/></svg>") center/contain no-repeat;
    cursor: pointer;
}

/* Selects */
.hltv-news-select {
    height: 34px;
    padding: 0 28px 0 10px;
    background: #0d1117 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e7681' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>") right 8px center/12px no-repeat;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color .15s, background-color .15s;
    min-width: 120px;
}

.hltv-news-select:hover  { border-color: #484f58; }
.hltv-news-select:focus  { border-color: #e94560; }

.hltv-news-select option {
    background: #161a21;
    color: #e6edf3;
}

/* Reset button */
.hltv-news-reset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    background: transparent;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #6e7681;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
}

.hltv-news-reset:hover {
    color: #e94560;
    border-color: #e94560;
    background: rgba(233,69,96,.06);
}

.hltv-news-reset svg { display: block; }

/* ============================================
   Meta row (count + spinner)
   ============================================ */
.hltv-news-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px;
    font-size: 12px;
    color: #6e7681;
    min-height: 18px;
}

.hltv-news-count { font-variant-numeric: tabular-nums; }

/* Spinner */
.hltv-news-spinner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hltv-news-spinner-dot {
    width: 12px;
    height: 12px;
    border: 2px solid #30363d;
    border-top-color: #e94560;
    border-radius: 50%;
    animation: hltvNewsSpin .8s linear infinite;
}

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

/* ============================================
   Archive list — extends .hltv-news-list / .hltv-news-item
   from hltv-news-style.css (date instead of time-of-day)
   ============================================ */
.hltv-news-archive .hltv-news-list { min-height: 60px; }

/* Wider min-width on the date label, since "Sep 15" > "23:04" */
.hltv-news-archive .hltv-news-time-date {
    min-width: 46px;
    text-align: left;
    font-weight: 500;
    color: #8b949e;
}

/* Empty state */
.hltv-news-archive .hltv-news-empty {
    padding: 40px 14px;
    text-align: center;
    color: #6e7681;
    font-size: 13px;
    background: #161a21;
    border-bottom: none;
}

/* ============================================
   Load more button
   ============================================ */
.hltv-news-loadmore {
    display: inline-flex;
    align-self: center;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 11px 22px;
    background: #161a21;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .2px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
}

.hltv-news-loadmore:hover {
    background: #1c2333;
    border-color: #e94560;
    color: #ff5a75;
}

.hltv-news-loadmore:active { transform: translateY(1px); }

.hltv-news-loadmore:disabled {
    opacity: .55;
    cursor: wait;
}

.hltv-news-loadmore[hidden] { display: none !important; }

.hltv-news-loadmore svg { display: block; }

/* ============================================
   Mobile
   ============================================ */
@media (max-width: 600px) {
    .hltv-news-filters {
        gap: 6px;
        padding: 8px;
    }

    .hltv-news-filter-search {
        flex: 1 1 100%;
        order: -1;
    }

    .hltv-news-select {
        flex: 1 1 calc(50% - 3px);
        min-width: 0;
        font-size: 12px;
        padding-right: 24px;
    }

    .hltv-news-reset {
        flex: 1 1 100%;
        justify-content: center;
    }

    .hltv-news-archive .hltv-news-time-date {
        min-width: 40px;
        font-size: 10.5px;
    }

    .hltv-news-loadmore {
        width: 100%;
        justify-content: center;
    }
}
