/* ==========================================================
   LEIKTÍMINN · SÍUR (shared advanced filters)
   js/leiktiminn-filter-panel.js. Uses the lt-app.css tokens.
   Desktop: centred modal. ≤760px: bottom sheet.
   ========================================================== */

.ltf-root [hidden],
.ltf-chips[hidden] {
    display: none !important;
}

/* ---------------------------------------------- trigger
   A segment of .filter-group in the header, or standalone. */

.ltf-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 12px 0 10px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    transition:
        background-color 150ms var(--ease),
        border-color 150ms var(--ease);
}

.filter-group > .ltf-trigger {
    flex: 0 0 auto;
    height: auto;
    border-width: 0 0 0 1px;
    border-color: var(--line);
}

.ltf-trigger:hover {
    background: var(--surface-2);
}

.ltf-trigger .lt-icon {
    width: 15px;
    height: 15px;
    color: var(--text-3);
}

.ltf-trigger.is-active {
    background: var(--selected-bg);
}

.ltf-trigger.is-active .lt-icon {
    color: var(--accent);
}

.ltf-trigger-count {
    display: inline-grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 11.5px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.ltf-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.filter-group > .ltf-trigger:focus-visible {
    outline-offset: -3px;
}

/* ---------------------------------------------- panel */

.ltf-root {
    position: fixed;
    inset: 0;
    z-index: 160;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ltf-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 6, 7, 0.66);
    animation: lt-fade 180ms var(--ease);
}

.ltf-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(560px, 100%);
    max-height: min(760px, calc(100dvh - 48px));
    overflow: hidden;
    border: 1px solid var(--line-2);
    border-radius: 20px;
    background: var(--bg-elev);
    box-shadow: var(--shadow-pop);
    animation: lt-fade-in 200ms var(--ease);
}

.ltf-card:focus {
    outline: none;
}

.ltf-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 16px 14px 24px;
    border-bottom: 1px solid var(--line);
}

.ltf-eyebrow {
    margin: 0;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ltf-head h2 {
    margin: 2px 0 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.ltf-close {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
}

.ltf-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.ltf-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px 0 10px;
}

.ltf-scope {
    margin: 10px 24px 4px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 12.5px;
}

/* Einhver skilyrði | Öll skilyrði: compact, above the categories */
.ltf-combine {
    margin: 10px 24px 6px;
}

.ltf-combine-label {
    margin: 0 0 6px;
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 600;
}

.ltf-segments.ltf-combine-segments {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.ltf-combine-segments .ltf-segment {
    min-height: 36px;
    font-size: 13.5px;
}

.ltf-combine-hint {
    margin: 6px 2px 0;
    color: var(--text-3);
    font-size: 12px;
}

/* sections */

.ltf-section {
    margin: 0;
    padding: 0 12px;
}

.ltf-section + .ltf-section {
    border-top: 1px solid var(--line);
}

.ltf-section-heading,
.ltf-section-label {
    margin: 0;
    font: inherit;
}

.ltf-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
    text-align: left;
}

.ltf-section-head:hover {
    background: rgba(255, 255, 255, 0.03);
}

.ltf-section-head:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.ltf-section-icon {
    width: 17px;
    height: 17px;
    color: var(--text-3);
}

.ltf-section.is-active .ltf-section-icon {
    color: var(--accent);
}

.ltf-section-title {
    flex: 0 0 auto;
}

.ltf-section-summary {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ltf-chevron {
    width: 16px;
    height: 16px;
    margin-left: auto;
    color: var(--text-3);
    transition: transform 160ms var(--ease);
}

.ltf-section-summary:not(:empty) + .ltf-chevron {
    margin-left: 0;
}

.ltf-section-head[aria-expanded="true"] .ltf-chevron {
    transform: rotate(180deg);
}

.ltf-section-body {
    padding: 0 0 14px;
}

.ltf-hint {
    margin: -4px 12px 10px;
    color: var(--text-3);
    font-size: 12.5px;
}

.ltf-section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 12px 10px;
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
}

.ltf-section-open {
    padding-bottom: 14px;
}

/* search */

.ltf-search {
    position: relative;
    display: block;
    margin: 0 12px 8px;
}

.ltf-search .lt-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-3);
    pointer-events: none;
    transform: translateY(-50%);
}

.ltf-search input {
    width: 100%;
    min-height: 42px;
    padding: 0 12px 0 38px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14.5px;
    -webkit-appearance: none;
    appearance: none;
}

.ltf-search input::placeholder {
    color: #6f7773;
}

.ltf-search input:focus {
    border-color: var(--accent-line);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.ltf-search input::-webkit-search-cancel-button {
    filter: invert(0.7);
}

/* option rows */

.ltf-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: min(320px, 42vh);
    margin: 0;
    padding: 0 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
}

.ltf-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 10px 0 8px;
    border-radius: 10px;
    color: var(--text);
    font-size: 14.5px;
    cursor: pointer;
    transition: background-color 120ms var(--ease);
}

.ltf-option:hover {
    background: rgba(255, 255, 255, 0.04);
}

.ltf-option input,
.ltf-pill input,
.ltf-segment input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.ltf-check {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--line-3);
    border-radius: 6px;
    color: transparent;
    transition:
        background-color 120ms var(--ease),
        border-color 120ms var(--ease);
}

.ltf-check .lt-icon {
    width: 14px;
    height: 14px;
    stroke-width: 2.6;
}

.ltf-option-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ltf-option-count,
.ltf-pill-count {
    flex: 0 0 auto;
    color: var(--text-3);
    font-size: 12.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ltf-option-row.is-selected .ltf-option {
    background: var(--selected-bg);
}

.ltf-option-row.is-selected .ltf-check {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
}

.ltf-option-row.is-selected .ltf-option-label {
    font-weight: 650;
}

.ltf-option-row.is-selected .ltf-option-count {
    color: var(--accent);
}

.ltf-option-row.is-zero .ltf-option-label,
.ltf-option-row.is-zero .ltf-option-count {
    color: var(--text-3);
}

.ltf-option:has(input:focus-visible) {
    box-shadow: inset 0 0 0 2px var(--accent);
}

.ltf-none {
    margin: 4px 12px 0;
    padding: 12px;
    border: 1px dashed var(--line-2);
    border-radius: 10px;
    color: var(--text-3);
    font-size: 13px;
    text-align: center;
}

/* role pills and GPS segments */

.ltf-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 12px;
}

.ltf-pill,
.ltf-segment {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 120ms var(--ease),
        border-color 120ms var(--ease);
}

.ltf-pill:hover,
.ltf-segment:hover {
    border-color: var(--line-3);
}

.ltf-pill.is-selected,
.ltf-segment.is-selected {
    border-color: var(--line-3);
    background: var(--selected-bg);
    color: var(--accent);
}

.ltf-pill.is-selected .ltf-pill-count,
.ltf-segment.is-selected .ltf-pill-count {
    color: var(--accent);
}

.ltf-pill.is-selected::before {
    content: "";
    width: 12px;
    height: 12px;
    margin-left: -3px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.ltf-pill.is-zero,
.ltf-segment.is-zero {
    opacity: 0.45;
    cursor: default;
}

.ltf-pill:has(input:focus-visible),
.ltf-segment:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.ltf-segments {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin: 0 12px;
    padding: 4px;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: var(--surface);
}

.ltf-segment {
    min-width: 0;
    padding: 0 8px;
    border-color: transparent;
    border-radius: 9px;
    background: transparent;
}

.ltf-segment:hover {
    border-color: transparent;
    background: rgba(255, 255, 255, 0.04);
}

.ltf-segment.is-selected:hover {
    background: var(--selected-bg);
}

/* footer */

.ltf-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px calc(14px + var(--safe-bottom)) 24px;
    border-top: 1px solid var(--line);
    background: var(--bg-elev);
}

.ltf-result {
    margin: 0;
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ltf-result.is-zero {
    color: var(--danger);
}

.ltf-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.ltf-clear:disabled {
    opacity: 0.45;
    cursor: default;
}

.ltf-apply {
    min-width: 150px;
}

/* ---------------------------------------------- active chips */

.ltf-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.ltf-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ltf-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 220px;
    height: 32px;
    padding: 0 8px 0 10px;
    border: 1px solid var(--accent-line);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.ltf-chip:hover {
    border-color: var(--accent);
}

.ltf-chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.ltf-chip-icon {
    width: 14px;
    height: 14px;
    color: var(--accent);
}

.ltf-chip-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ltf-chip-x {
    width: 14px;
    height: 14px;
    color: var(--text-3);
}

.ltf-chip:hover .ltf-chip-x {
    color: var(--text);
}

.ltf-chip-more {
    padding: 0 12px;
    border-color: var(--line-2);
    background: var(--surface);
    color: var(--text-2);
}

/* "Einhver skilyrði" before the chips: how they combine (opens Síur) */
.ltf-chip-mode {
    padding: 0 12px;
    border-style: dashed;
    border-color: var(--line-3);
    background: transparent;
    color: var(--text-2);
    font-weight: 600;
}

/* Hreinsa síur / Sýna alla leiki as quiet text buttons (not .filter-clear,
   which shrinks to an icon on phones) */
.ltf-text-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 10px 0 8px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.ltf-text-button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.ltf-text-button .lt-icon {
    width: 15px;
    height: 15px;
}

/* ---------------------------------------------- empty results */

.ltf-empty {
    gap: 6px;
}

.ltf-empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.ltf-empty-actions .ltf-text-button {
    height: 40px;
    padding: 0 14px;
}

/* ---------------------------------------------- phone: bottom sheet */

@media (max-width: 760px) {

    .ltf-root {
        align-items: flex-end;
        padding: 0;
    }

    .ltf-card {
        width: 100%;
        max-height: calc(100dvh - var(--safe-top) - 16px);
        border-width: 1px 0 0;
        border-radius: 20px 20px 0 0;
        animation: ltf-sheet-up 240ms var(--ease);
    }

    .ltf-head {
        padding: 14px 10px 12px 18px;
    }

    .ltf-scope {
        margin: 10px 18px 4px;
    }

    .ltf-combine {
        margin: 10px 18px 6px;
    }

    .ltf-section {
        padding: 0 6px;
    }

    .ltf-foot {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 16px calc(12px + var(--safe-bottom));
    }

    .ltf-result {
        text-align: center;
    }

    .ltf-actions > button {
        flex: 1 1 0;
        min-height: 46px;
        padding: 0 12px;
    }

    .ltf-apply {
        min-width: 0;
    }

    /* Avoid iOS zoom on focus */
    .ltf-search input {
        font-size: 16px;
    }

    /* Long names: chips stay short so the row wraps less */
    .ltf-chip {
        max-width: 170px;
    }
}

@keyframes ltf-sheet-up {
    from {
        transform: translateY(24px);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ltf-backdrop,
    .ltf-card,
    .ltf-chevron {
        animation: none;
        transition: none;
    }
}

/* ---------------------------------------------- page headers
   Spilaðir and Tölfræði: Allt tímabil | ☆ | Síur, custom dates, chips
   (leiktiminn.html, js/leiktiminn-filter-bar.js). */

.shared-filter-bar {
    margin-bottom: 10px;
}

.shared-filter-bar .stats-custom-date-range {
    margin-top: 0;
}

.shared-filter-chips {
    margin: 0 0 14px;
}

.stats-overview-panel .shared-filter-chips {
    margin-bottom: 4px;
}

/* The zero-results block spans the Tölfræði grid */
.stats-future > .ltf-empty {
    grid-column: 1 / -1;
}
