/* ============================================
   Town Explorer — Styles
   Append to living-in-italy.css or enqueue separately
   ============================================ */

/* ---- Explorer Header ---- */
.lit-explorer-header {
    background: linear-gradient(135deg, var(--lit-blue) 0%, var(--lit-blue-light) 100%);
    padding: 48px 0 40px;
    text-align: center;
}

.lit-explorer-title {
    font-family: var(--lit-font-heading);
    font-size: 40px;
    font-weight: 700;
    color: var(--lit-white);
    margin: 0 0 8px 0;
}

.lit-explorer-subtitle {
    font-size: 16px;
    color: rgba(255,255,255,0.8);
    margin: 0;
}

/* ---- Search Bar ---- */
.lit-explorer-search {
    max-width: 520px;
    margin: 20px auto 0;
}

.lit-search-form {
    display: flex;
    border-radius: var(--lit-radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.lit-search-input {
    flex: 1;
    padding: 14px 18px;
    border: none;
    font-size: 15px;
    font-family: var(--lit-font-body);
    color: var(--lit-charcoal);
    outline: none;
    background: var(--lit-white);
}

.lit-search-input::placeholder {
    color: var(--lit-grey-light);
}

.lit-search-btn {
    padding: 14px 20px;
    border: none;
    background: var(--lit-white);
    color: var(--lit-blue);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.lit-search-btn:hover {
    background: var(--lit-cream);
}

/* ---- Search Suggestions Dropdown ---- */
.lit-explorer-search {
    position: relative;
}

.lit-search-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--lit-white);
    border-radius: 0 0 var(--lit-radius) var(--lit-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
    margin-top: -4px;
}

.lit-suggest-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    text-decoration: none;
    color: var(--lit-charcoal);
    border-bottom: 1px solid var(--lit-cream);
    transition: background 0.15s;
}

.lit-suggest-item:last-child {
    border-bottom: none;
}

.lit-suggest-item:hover,
.lit-suggest-active {
    background: var(--lit-cream);
}

.lit-suggest-label {
    font-weight: 600;
    font-size: 14px;
}

.lit-suggest-type {
    font-size: 11px;
    color: var(--lit-grey);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    margin-left: 12px;
}

/* ---- Body Layout: Sidebar + Results ---- */
.lit-explorer-body {
    display: flex;
    gap: 28px;
    padding-top: 28px;
    padding-bottom: 48px;
    align-items: flex-start;
}

/* ---- Filter Sidebar ---- */
.lit-filters {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--lit-white);
    border-radius: var(--lit-radius);
    border: 1px solid var(--lit-stone);
    box-shadow: var(--lit-shadow);
    padding: 20px;
}

.lit-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--lit-stone);
}

.lit-filters-title {
    font-family: var(--lit-font-heading);
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--lit-charcoal);
}

.lit-filters-reset {
    font-size: 12px;
    cursor: pointer;
}

.lit-filter-group {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--lit-cream);
}

.lit-filter-group:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.lit-filter-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--lit-charcoal);
    margin: 0 0 12px 0;
}

.lit-filter-item {
    margin-bottom: 14px;
}

.lit-filter-item:last-child {
    margin-bottom: 0;
}

.lit-filter-sublabel {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--lit-grey);
    margin-bottom: 6px;
}

/* Filter dropdowns */
.lit-filter-select,
.lit-filters .facetwp-dropdown {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--lit-stone);
    border-radius: var(--lit-radius-sm);
    font-size: 14px;
    font-family: var(--lit-font-body);
    color: var(--lit-charcoal);
    background: var(--lit-white);
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.lit-filter-select:focus,
.lit-filters .facetwp-dropdown:focus {
    outline: none;
    border-color: var(--lit-blue);
    box-shadow: 0 0 0 3px rgba(27, 73, 101, 0.1);
}

.lit-filters-apply {
    display: none; /* shown on mobile */
    margin-top: 16px;
}

.lit-filters-toggle {
    display: none; /* shown on mobile */
}

/* ---- Results Area ---- */
.lit-results {
    flex: 1;
    min-width: 0;
}

/* ---- Results Toolbar ---- */
.lit-results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px 24px;
    background: var(--lit-white);
    border-radius: var(--lit-radius);
    border: 1px solid var(--lit-stone);
    box-shadow: var(--lit-shadow);
}

/* Shared label above each control */
.lit-toolbar-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--lit-grey);
    margin-bottom: 6px;
}

/* Results count */
.lit-results-meta {
    font-size: 14px;
    color: var(--lit-grey);
    font-weight: 500;
}

.lit-results-meta .facetwp-counts {
    font-size: 15px;
    color: var(--lit-charcoal);
    font-weight: 700;
}

/* Controls row */
.lit-results-controls {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

/* View wrap */
.lit-view-wrap {
    display: flex;
    flex-direction: column;
}

/* Sort dropdown — targets all FacetWP select variants */
.lit-sort-wrap {
    position: relative;
}

.lit-sort-wrap select,
.lit-sort-wrap .facetwp-sort-select,
.lit-sort-wrap .facetwp-type-sort select,
.facetwp-facet-town_sort select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 9px 36px 9px 14px;
    border: 1.5px solid var(--lit-stone);
    border-radius: var(--lit-radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--lit-font-body);
    color: var(--lit-charcoal);
    background-color: var(--lit-white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 180px;
}

.lit-sort-wrap select:hover,
.lit-sort-wrap .facetwp-sort-select:hover,
.facetwp-facet-town_sort select:hover {
    border-color: var(--lit-blue-light);
}

.lit-sort-wrap select:focus,
.lit-sort-wrap .facetwp-sort-select:focus,
.facetwp-facet-town_sort select:focus {
    outline: none;
    border-color: var(--lit-blue);
    box-shadow: 0 0 0 3px rgba(27, 73, 101, 0.1);
}

/* Sort label prefix */
.lit-sort-wrap::before {
    content: '↕';
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--lit-grey-light);
    pointer-events: none;
    display: none; /* enable if you want an icon outside the dropdown */
}

/* ---- View Toggle ---- */
.lit-view-toggle {
    display: flex;
    gap: 2px;
    background: var(--lit-cream);
    border: 1.5px solid var(--lit-stone);
    border-radius: var(--lit-radius-sm);
    padding: 3px;
}

.lit-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--lit-grey);
    cursor: pointer;
    transition: all 0.2s;
}

.lit-view-btn:hover {
    color: var(--lit-charcoal);
    background: rgba(0,0,0,0.04);
}

.lit-view-btn-active {
    background: var(--lit-white);
    color: var(--lit-blue);
    box-shadow: var(--lit-shadow);
}

/* ---- Mobile Filters Button (in toolbar) ---- */
.lit-results-toolbar .lit-filters-toggle {
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    border: 1.5px solid var(--lit-stone);
    border-radius: var(--lit-radius-sm);
    background: var(--lit-white);
    color: var(--lit-charcoal);
    cursor: pointer;
    transition: all 0.2s;
}

.lit-results-toolbar .lit-filters-toggle:hover {
    border-color: var(--lit-blue);
    color: var(--lit-blue);
}

/* ---- Results Grid (Card Grid) ---- */
.lit-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ---- Town Cards (Explorer) ---- */
.lit-results-grid .lit-town-card {
    background: var(--lit-white);
    border-radius: var(--lit-radius);
    padding: 0;
    border: 1px solid var(--lit-stone);
    transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.lit-results-grid .lit-town-card:hover {
    box-shadow: var(--lit-shadow-lg);
    transform: translateY(-4px);
}

/* Accent colours */
.lit-results-grid .lit-accent-green:hover  { border-color: #10B981; }
.lit-results-grid .lit-accent-amber:hover  { border-color: #F59E0B; }
.lit-results-grid .lit-accent-red:hover    { border-color: #EF4444; }
.lit-results-grid .lit-accent-neutral:hover { border-color: var(--lit-blue); }

/* Top accent bar */
.lit-results-grid .lit-tc-accent {
    height: 4px;
    width: 100%;
}

.lit-results-grid .lit-accent-green .lit-tc-accent  { background: linear-gradient(90deg, #10B981, #34D399); }
.lit-results-grid .lit-accent-amber .lit-tc-accent  { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.lit-results-grid .lit-accent-red .lit-tc-accent    { background: linear-gradient(90deg, #EF4444, #F87171); }
.lit-results-grid .lit-accent-neutral .lit-tc-accent { background: linear-gradient(90deg, var(--lit-blue), var(--lit-blue-light)); }

/* Header */
.lit-results-grid .lit-tc-header {
    padding: 16px 16px 0;
}

.lit-results-grid .lit-tc-name-link {
    text-decoration: none;
    color: inherit;
}

.lit-results-grid .lit-tc-name {
    font-family: var(--lit-font-heading);
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: var(--lit-charcoal);
    transition: color 0.2s;
}

.lit-results-grid .lit-tc-name-link:hover .lit-tc-name {
    color: var(--lit-blue);
}

.lit-results-grid .lit-tc-province {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--lit-grey);
    background: var(--lit-cream);
    padding: 2px 10px;
    border-radius: 10px;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Score badges */
.lit-results-grid .lit-tc-scores {
    display: flex;
    gap: 8px;
    padding: 12px 16px 0;
}

.lit-results-grid .lit-tc-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    text-align: center;
}

.lit-results-grid .lit-tc-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    width: 100%;
    box-sizing: border-box;
}

.lit-results-grid .lit-tc-score-text {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--lit-grey);
    margin-top: 3px;
}

/* Stat pills */
.lit-results-grid .lit-tc-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 16px;
}

.lit-results-grid .lit-tc-pill {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--lit-charcoal);
    background: var(--lit-cream);
    padding: 4px 10px;
    border-radius: 16px;
    border: 1px solid var(--lit-stone);
}

/* Button */
.lit-results-grid .lit-btn {
    margin: auto 16px 16px;
    border-radius: var(--lit-radius-sm);
}

/* ---- No Results ---- */
.lit-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: var(--lit-white);
    border-radius: var(--lit-radius);
    border: 1px solid var(--lit-stone);
}

.lit-no-results h3 {
    font-family: var(--lit-font-heading);
    font-size: 22px;
    color: var(--lit-charcoal);
    margin: 0 0 8px 0;
}

.lit-no-results p {
    font-size: 15px;
    color: var(--lit-grey);
}

.lit-no-results a {
    color: var(--lit-blue);
    text-decoration: underline;
}

/* ---- Map View ---- */
.lit-results-map {
    border-radius: var(--lit-radius);
    overflow: hidden;
    border: 1px solid var(--lit-stone);
    box-shadow: var(--lit-shadow);
}

.lit-map-popup {
    font-family: var(--lit-font-body);
    font-size: 13px;
    line-height: 1.5;
}

.lit-map-popup strong {
    font-size: 14px;
    color: var(--lit-charcoal);
}

.lit-map-popup a {
    color: var(--lit-blue);
    font-weight: 600;
    text-decoration: none;
}

.lit-map-popup a:hover {
    text-decoration: underline;
}

/* ---- Pagination ---- */
.lit-results-pagination {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.lit-page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: var(--lit-radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--lit-charcoal);
    background: var(--lit-white);
    border: 1px solid var(--lit-stone);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.lit-page-num:hover {
    background: var(--lit-cream);
    border-color: var(--lit-blue);
    color: var(--lit-blue);
}

.lit-page-current {
    background: var(--lit-blue);
    border-color: var(--lit-blue);
    color: var(--lit-white);
    cursor: default;
}

.lit-page-current:hover {
    background: var(--lit-blue);
    color: var(--lit-white);
}

.lit-page-dots {
    padding: 0 4px;
    color: var(--lit-grey);
    font-size: 14px;
    user-select: none;
}

.lit-page-prev,
.lit-page-next {
    font-size: 13px;
    padding: 0 14px;
}

/* ============================================
   Responsive — Explorer
   ============================================ */
@media (max-width: 1024px) {
    .lit-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .lit-explorer-title {
        font-size: 28px;
    }

    .lit-explorer-search {
        max-width: 100%;
        margin-top: 16px;
    }

    .lit-search-input {
        padding: 12px 14px;
        font-size: 14px;
    }

    .lit-search-btn {
        padding: 12px 16px;
    }

    .lit-explorer-body {
        flex-direction: column;
    }

    /* Sidebar becomes off-canvas overlay on mobile */
    .lit-filters {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        height: 100vh;
        max-height: 100vh;
        z-index: 9999;
        border-radius: 0;
        border: none;
        box-shadow: var(--lit-shadow-lg);
        transition: left 0.3s ease;
        padding: 20px 20px 100px;
    }

    .lit-filters.lit-filters-open {
        left: 0;
    }

    .lit-filters-toggle {
        display: inline-flex;
    }

    .lit-filters-apply {
        display: block;
    }

    .lit-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #lit-leaflet-map {
        height: 400px !important;
    }
}

@media (max-width: 480px) {
    .lit-results-grid {
        grid-template-columns: 1fr;
    }

    .lit-results-toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .lit-results-controls {
        justify-content: space-between;
    }
}
