/* ========================================
   RunRoute — Explore Page (/ruter/)
   ========================================
   Prefix: rex- (Route EXplore)
   ======================================== */

/* --- Theme resets (prevent Astra interference) --- */

/* --- Force Full Width --- */
body.runroute-full-width .ast-container,
body.runroute-full-width #primary {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.rex,
.rex *,
.rex *::before,
.rex *::after {
    box-sizing: border-box;
}

.rex a {
    text-decoration: none;
    color: inherit;
}

.rex a:hover {
    text-decoration: none;
}

/* --- Base --- */
.rex {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    color: #1d1d1f;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* --- Hero --- */
.rex-hero {
    text-align: center;
    padding: 36px 20px 28px;
}

.rex-hero-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 8px;
    color: #1d1d1f;
}

.rex-hero-title i {
    color: #e63946;
    margin-right: 8px;
}

.rex-hero-sub {
    font-size: 0.95rem;
    color: #6e6e73;
    margin: 0;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* --- Filter bar --- */
.rex-filters {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 20px;
    background: #f9f9fb;
    border-radius: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    border: 1px solid rgba(60, 60, 67, 0.08);
}

.rex-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 140px;
}

.rex-filter-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rex-filter-label i {
    margin-right: 3px;
    font-size: 0.68rem;
}

.rex-filter-input,
.rex-filter-select {
    height: 40px;
    padding: 0 12px;
    border: 1px solid rgba(60, 60, 67, 0.18);
    border-radius: 10px;
    font-size: 0.88rem;
    background: #fff;
    color: #1d1d1f;
    font-family: inherit;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.rex-filter-select {
    padding-right: 32px;
    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='%238e8e93' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    cursor: pointer;
}

.rex-filter-input:focus,
.rex-filter-select:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.rex-filter-btn {
    height: 40px;
    padding: 0 20px;
    border: none;
    border-radius: 10px;
    background: #007AFF;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}

.rex-filter-btn:hover {
    background: #0066d6;
}

.rex-filter-btn:active {
    transform: scale(0.97);
}

.rex-filter-btn:disabled {
    background: #aeaeb2;
    cursor: not-allowed;
}

.rex-filter-btn i {
    margin-right: 5px;
}

/* --- Main layout --- */
.rex-layout {
    display: grid;
    grid-template-columns: 55% 45%;
    gap: 20px;
    align-items: start;
}

/* --- Map --- */
.rex-map-wrap {
    position: sticky;
    top: 20px;
}

.rex-map {
    width: 100%;
    height: calc(100vh - 240px);
    min-height: 400px;
    max-height: 700px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(60, 60, 67, 0.08);
    z-index: 1;
}

/* --- Cards wrap --- */
.rex-cards-wrap {
    min-width: 0;
}

.rex-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- Card --- */
.rex-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(60, 60, 67, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
    cursor: pointer;
}

.rex-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    color: inherit;
    text-decoration: none;
}

.rex-card-highlight {
    border-color: #007AFF;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.25), 0 6px 20px rgba(0, 0, 0, 0.08);
}

/* --- Card mini-map thumb --- */
.rex-map-thumb {
    width: 160px;
    min-width: 160px;
    max-width: 160px;
    min-height: 110px;
    background: #f2f2f7;
    flex-shrink: 0;
    flex-grow: 0;
    position: relative;
    overflow: hidden;
}

/* Leaflet container inside thumb */
.rex-map-thumb .leaflet-container {
    width: 100% !important;
    height: 100% !important;
}

/* Hide Leaflet attribution in mini-maps */
.rex-map-thumb .leaflet-control-attribution {
    display: none !important;
}

/* --- Card info --- */
.rex-info {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.rex-route-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: #1d1d1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.rex-route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.78rem;
    color: #6e6e73;
    margin-bottom: 6px;
}

.rex-route-meta i {
    margin-right: 3px;
    font-size: 0.72rem;
}

.rex-route-author {
    font-size: 0.72rem;
    color: #aeaeb2;
}

.rex-route-author i {
    margin-right: 3px;
    font-size: 0.68rem;
}

.rex-author-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    transition: color 0.15s;
}

.rex-author-link:hover {
    color: #007AFF;
    text-decoration: none;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 900px) {
    .rex-layout {
        grid-template-columns: 1fr;
    }

    .rex-map-wrap {
        position: relative;
        top: 0;
    }

    .rex-map {
        height: 280px;
        min-height: 200px;
        max-height: 320px;
    }

    .rex-map-thumb {
        width: 120px;
        min-width: 120px;
        max-width: 120px;
        min-height: 90px;
    }
}

@media (max-width: 600px) {
    .rex {
        padding: 0 12px 32px;
    }

    .rex-hero {
        padding: 24px 12px 20px;
    }

    .rex-hero-title {
        font-size: 1.35rem;
    }

    .rex-hero-sub {
        font-size: 0.85rem;
    }

    .rex-filters {
        padding: 12px 14px;
        gap: 10px;
    }

    .rex-filter-group {
        min-width: 100%;
    }

    .rex-filter-btn {
        width: 100%;
    }

    .rex-map {
        height: 220px;
        min-height: 180px;
        border-radius: 10px;
    }

    .rex-card {
        border-radius: 10px;
    }

    .rex-map-thumb {
        width: 100px;
        min-width: 100px;
        max-width: 100px;
        min-height: 80px;
    }

    .rex-info {
        padding: 10px 12px;
    }

    .rex-route-name {
        font-size: 0.85rem;
    }

    .rex-route-meta {
        gap: 8px;
        font-size: 0.72rem;
    }
}
