/**
 * GPS-Routen Seite - BikerFreunde-Rath e.V.
 */

/* Card Header Anpassung */
.card .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
}

/* Statistiken & Suchfilter Bar */
.gps-stats-bar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.gps-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.stat-item-left {
    justify-content: flex-start;
}

.stat-item-right {
    justify-content: flex-end;
}

.stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon .material-symbols-outlined {
    font-size: 1.25rem;
    color: white;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-item-right .stat-content {
    text-align: right;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.125rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Suchfilter in der Mitte */
.stat-search-center {
    flex: 1;
    margin: 0 1rem;
}

.stat-search-center .search-filter {
    margin-bottom: 0;
}

/* Kilometer-Filter */
.km-filter-wrapper {
    width: 100%;
}

.km-filter-values {
    display: flex;
    justify-content: space-between;
}

.km-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-color);
}

.km-value::after {
    content: ' km';
    font-weight: 500;
    color: var(--text-secondary);
}

/* Range-Slider */
.range-slider {
    position: relative;
    width: 100%;
    height: 40px;
}

.range-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
}

.range-track-fill {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover));
    border-radius: 3px;
    transition: all 0.1s ease;
}

.range-input {
    position: absolute;
    width: 100%;
    height: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.range-input::-webkit-slider-thumb:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.range-input::-webkit-slider-thumb:active {
    transform: scale(1.2);
    box-shadow: 0 3px 12px rgba(227, 6, 19, 0.4);
}

.range-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.range-input::-moz-range-thumb:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.range-input::-moz-range-thumb:active {
    transform: scale(1.2);
    box-shadow: 0 3px 12px rgba(227, 6, 19, 0.4);
}

.range-input::-moz-range-track {
    background: transparent;
    border: none;
}

.range-input:focus {
    outline: none;
}

.range-max {
    z-index: 2;
}

.range-min {
    z-index: 3;
}

/* Filter */
.gps-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-badge .material-symbols-outlined {
    font-size: 1.25rem;
}

.filter-badge:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
}

.filter-badge.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.filter-badge.active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Error State */
.gps-routes-error {
    padding: 2rem;
    text-align: center;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
}

.gps-routes-error .material-symbols-outlined {
    font-size: 3rem;
    display: block;
    margin: 0 auto 0.5rem;
}

.gps-routes-error p {
    margin: 0;
    font-weight: 500;
}

/* Spinner Animation für Metadaten-Button */
.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Karten-Modal */
#mapModal .modal-container {
    width: 90% !important;
    max-width: none !important;
}

.map-container {
    height: 70vh;
    position: relative;
    z-index: 1;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    position: relative;
    z-index: 1;
}

#mapModal .modal-header {
    z-index: 100;
}

/* Leaflet Layer Control */
#map .leaflet-control-layers {
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#map .leaflet-control-layers-toggle {
    background-color: var(--bg-primary);
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

#map .leaflet-control-layers-expanded {
    padding: 0.75rem;
    font-family: var(--font-family);
}

#map .leaflet-control-layers-base label {
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 0.5rem;
    margin: 0;
    display: block;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

#map .leaflet-control-layers-base label:hover {
    background-color: var(--bg-hover);
}

#map .leaflet-control-layers-base input[type="radio"] {
    margin-right: 0.5rem;
}

/* Leaflet Popup Anpassungen */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 1rem;
    font-family: var(--font-family);
}

/* Responsive */
@media (max-width: 768px) {
    .gps-stats-bar {
        padding: 1rem;
        gap: 0.75rem;
    }

    .gps-stats-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .stat-item {
        width: 100%;
        justify-content: center;
    }

    .stat-item-left,
    .stat-item-right {
        justify-content: center;
    }

    .stat-item-right .stat-content {
        text-align: left;
    }

    /* Reihenfolge auf Mobile: Stats oben, Suche unten */
    .stat-item-left {
        order: 1;
    }

    .stat-item-right {
        order: 2;
        flex-direction: row-reverse;
    }

    .stat-search-center {
        order: 3;
        margin: 0.5rem 0 0 0;
        width: 100%;
    }

    .stat-icon {
        width: 2rem;
        height: 2rem;
    }

    .stat-icon .material-symbols-outlined {
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .km-value {
        font-size: 0.8rem;
    }

    .map-container {
        height: 60vh;
    }

    #map {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .filter-badge {
        flex: 1 1 auto;
        justify-content: center;
        min-width: calc(50% - 0.375rem);
    }
}
