/**
 * Location Finder - Frontend CSS
 */

/* ========================================
   WRAPPER
======================================== */

.location-finder-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Tailwind-first Suche-Layout */
#location-finder.lf-tailwind {
    max-width: none;
    margin: 0;
    font-family: inherit;
}

#location-finder .lf-main-content-tailwind {
    display: flex;
    gap: 0;
    min-height: 0;
    height: 100%;
}

#location-finder .lf-results-panel-tailwind {
    border: 0;
    border-right: 1px solid hsl(var(--border, 210 16% 85%));
    border-radius: 0;
    overflow: hidden;
    background: #f7f7f8;
}

#location-finder .lf-search-section-tailwind {
    margin-bottom: 0;
}

#location-finder .lf-search-container-tailwind {
    display: block;
    gap: 0;
    margin-bottom: 0;
}

#location-finder .lf-results-header-tailwind {
    padding: 0;
    background: transparent;
    border-bottom: 0;
    font-weight: inherit;
    font-size: inherit;
    color: inherit;
}

#location-finder .lf-filters-tailwind {
    display: block;
    padding: 0;
    background: transparent;
    border: 0;
    border-top: 1px solid hsl(var(--border, 210 16% 85%));
    border-radius: 0;
}

#location-finder .lf-results-list-tailwind {
    max-height: none;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

#location-finder .lf-results-resizer {
    position: relative;
    flex: 0 0 14px;
    width: 14px;
    min-width: 14px;
    margin-left: -7px;
    margin-right: -7px;
    cursor: col-resize;
    touch-action: none;
    background: transparent;
    z-index: 15;
    border-radius: 0;
    transition: background-color 180ms ease, box-shadow 180ms ease;
}

#location-finder .lf-results-resizer::before {
    content: none;
}

#location-finder .lf-results-resizer::after {
    content: "";
    position: absolute;
    left: calc(50% - 1px);
    top: 50%;
    width: 6px;
    height: 30px;
    transform: translate(-50%, -50%) scale(0.92);
    border-radius: 9999px;
    background: repeating-linear-gradient(
        to bottom,
        hsl(var(--muted-foreground, 220 12% 38%) / 0.7) 0 2px,
        transparent 2px 5px
    );
    opacity: 0;
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: none;
}

#location-finder .lf-results-resizer:hover,
#location-finder .lf-results-resizer:focus-visible {
    background: hsl(var(--primary, 207 90% 35%) / 0.08);
    box-shadow: inset 0 0 0 1px hsl(var(--primary, 207 90% 35%) / 0.22);
}

#location-finder .lf-results-resizer:hover::before,
#location-finder .lf-results-resizer:focus-visible::before,
#location-finder.lf-is-resizing .lf-results-resizer::before {
    content: none;
}

#location-finder .lf-results-resizer:hover::after,
#location-finder .lf-results-resizer:focus-visible::after,
#location-finder.lf-is-resizing .lf-results-resizer::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#location-finder.lf-is-resizing .lf-results-resizer {
    background: hsl(var(--primary, 207 90% 35%) / 0.12);
    box-shadow: inset 0 0 0 1px hsl(var(--primary, 207 90% 35%) / 0.3), 0 0 0 3px hsl(var(--primary, 207 90% 35%) / 0.12);
}

#location-finder.lf-is-resizing,
#location-finder.lf-is-resizing * {
    cursor: col-resize !important;
    user-select: none;
}

#location-finder.lf-is-resizing .lf-map-panel-tailwind {
    pointer-events: none;
}

#location-finder .lf-map-panel-tailwind {
    border: 0;
    border-radius: 0;
    order: 0;
}

#location-finder #lf-map {
    height: 100%;
    min-height: 100%;
}

#location-finder .lf-accordion-content {
    overflow: hidden;
}

#location-finder .lf-location-card-tailwind.is-active {
    border-color: hsl(var(--primary, 207 90% 35%) / 0.3);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

#location-finder .lf-search-suggestions {
    z-index: 2000;
}

#location-finder .lf-filter-indicator.is-checked {
    border-color: hsl(var(--primary, 207 90% 35%));
    background-color: hsl(var(--primary, 207 90% 35%) / 0.2);
}

#location-finder .lf-filter-indicator-checkbox.is-checked::after {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 2px;
    background-color: hsl(var(--primary, 207 90% 35%));
}

#location-finder .lf-filter-indicator-radio.is-checked::after {
    content: '';
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 9999px;
    background-color: hsl(var(--primary, 207 90% 35%));
}

/* ========================================
   SEARCH & FILTER
======================================== */

.lf-search-section {
    margin-bottom: 20px;
}

.lf-search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.lf-search-box {
    flex: 1;
    position: relative;
}

@media (max-width: 767px) {
    /* Prevent mobile browser zoom-on-focus (iOS/Android) on search page input */
    #location-finder #lf-search-input {
        font-size: 16px !important;
    }
}

.lf-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lf-search-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 1200;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    max-height: 260px;
    overflow-y: auto;
}

.lf-search-suggestion-item {
    display: block;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #eee;
    background: #fff;
    color: #333;
    text-align: left;
    padding: 10px 12px;
    font-size: 14px;
    cursor: pointer;
}

.lf-search-suggestion-item:last-child {
    border-bottom: 0;
}

.lf-search-suggestion-item:hover,
.lf-search-suggestion-item.is-active {
    background: #f5f5f5;
}

.lf-filter-toggle {
    padding: 12px 20px;
    background: white;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.lf-filter-toggle:hover {
    background: #f5f5f5;
}

.lf-filters {
    display: none;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    display: block;
}

.lf-filter-section {
    padding: 6px 0 14px;
    border-bottom: 1px solid #ddd;
}

.lf-filter-section:last-child {
    border-bottom: 0;
    padding-bottom: 4px;
}

.lf-filters-title {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 10px;
}

.lf-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 8px 14px;
}

.lf-filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.lf-filter-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.lf-filter-checkbox input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.lf-checkbox-label {
    font-size: 14px;
}

/* ========================================
   MAIN CONTENT (LIST + MAP)
======================================== */

.lf-main-content {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    min-height: 600px;
}

@media (max-width: 1024px) {
    .lf-main-content {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   RESULTS PANEL (LEFT)
======================================== */

.lf-results-panel {
    display: flex;
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.lf-results-header {
    padding: 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.lf-results-list {
    flex: 1;
    overflow-y: auto;
    max-height: 600px;
}

.lf-results-list::-webkit-scrollbar {
    width: 8px;
}

.lf-results-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.lf-results-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.lf-results-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   LOCATION CARDS
======================================== */

.lf-location-card {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.lf-location-card:hover {
    background: #f9f9f9;
}

.lf-location-card.active {
    background: #e3f2fd;
    border-left: 4px solid #0073aa;
}

.lf-card-left {
    flex-shrink: 0;
    margin-right: 15px;
}

.lf-card-image {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
}

.lf-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lf-card-logo {
    background: #fff;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

.lf-card-logo img {
    object-fit: contain;
}

.lf-card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    font-size: 32px;
}

.lf-card-right {
    flex: 1;
    min-width: 0;
}

.lf-location-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.lf-location-address {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.lf-location-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.lf-category-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #e8f4f8;
    color: #0073aa;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

/* ========================================
   MAP PANEL (RIGHT)
======================================== */

.lf-map-panel {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.lf-debug-zoom {
    position: absolute;
    top: 10px;
    left: 10px;
    right: auto;
    z-index: 1000;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font: 600 12px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    pointer-events: none;
}

#lf-map {
    width: 100%;
    height: 600px;
    min-height: 600px;
}

.lf-3d-control-wrap {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

.lf-3d-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid rgba(0, 0, 0, 0.16);
    border-radius: 10px;
    background: #ffffff;
    color: #111827;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.lf-3d-control-btn:hover {
    background: #f9fafb;
    border-color: rgba(0, 0, 0, 0.24);
    transform: translateY(-1px);
}

.lf-3d-toggle-link {
    display: block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
    color: #333;
    font: 700 11px/30px "Helvetica Neue", Arial, Helvetica, sans-serif;
    background-color: #fff;
    cursor: pointer;
    border-top: 1px solid #ccc;
    border-bottom: 0;
    border-radius: 0 0 4px 4px;
    box-sizing: border-box;
}

.lf-3d-toggle-link:hover,
.lf-3d-toggle-link:focus {
    background-color: #f4f4f4;
    color: #333;
    outline: none;
}

#lf-map .leaflet-control-zoom a.lf-3d-toggle-link {
    border-top: 1px solid #ccc;
}

#lf-map .leaflet-top.leaflet-left {
    left: auto;
    right: 0;
}

#lf-map .leaflet-top.leaflet-left .leaflet-control {
    margin-left: 0;
    margin-right: 10px;
}

.lf-map-panel.lf-mode-3d #lf-map .leaflet-control-container {
    display: none;
}

.lf-map-3d {
    position: absolute;
    inset: 0;
    z-index: 450;
    display: none;
}

.lf-map-3d.is-visible {
    display: block;
}

.lf-mapbox-pin {
    display: block;
    width: 40px;
    height: 40px;
    line-height: 0;
    overflow: visible;
    pointer-events: auto;
}

.lf-mapbox-pin > div,
.lf-mapbox-pin svg {
    display: block;
}

.lf-map-3d .mapboxgl-canvas,
.lf-map-3d .mapboxgl-canvas-container {
    width: 100%;
    height: 100%;
}

.lf-map-3d .mapboxgl-ctrl-top-left {
    left: auto;
    right: 0;
}

.lf-map-3d .mapboxgl-ctrl-top-left .mapboxgl-ctrl {
    margin: 10px 10px 0 0;
}

.lf-map-3d .mapboxgl-ctrl-group {
    border: 2px solid rgba(0,0,0,0.2);
    background-clip: padding-box;
    border-radius: 4px;
    box-shadow: none;
    overflow: hidden;
}

.lf-map-3d .mapboxgl-ctrl-group button {
    width: 30px;
    height: 30px;
    border: 0;
    border-bottom: 1px solid #ccc;
    border-radius: 0;
    background: #fff;
    color: #333;
}

.lf-map-3d .mapboxgl-ctrl-group button:last-child {
    border-bottom: 0;
}

.lf-map-3d .mapboxgl-ctrl-group button:hover,
.lf-map-3d .mapboxgl-ctrl-group button:focus {
    background: #f4f4f4;
    color: #333;
}

.lf-map-3d .lf-mapbox-mode-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-top: 1px solid #ccc;
    background: #fff;
    color: #333;
    font: 700 11px/30px "Helvetica Neue", Arial, Helvetica, sans-serif;
    text-align: center;
    cursor: pointer;
}

/* ========================================
   STATES
======================================== */

.lf-loading,
.lf-no-results,
.lf-error {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.lf-error {
    color: #c00;
}

/* ========================================
   LEAFLET POPUP ANPASSUNGEN
======================================== */

.leaflet-popup {
    margin-bottom: 20px;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.leaflet-popup-content {
    margin: 0;
    min-width: 270px;
}

.lf-leaflet-popup .leaflet-popup-content {
    width: 270px !important;
}

.leaflet-popup-content p {
    margin: 0.5em 0;
}

.lf-popup-card {
    font-family: system-ui, -apple-system, sans-serif;
    padding: 22px;
    min-width: 270px;
}

.lf-popup-head {
    margin-bottom: 12px;
}

.lf-popup-title {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: #111318;
}

.lf-popup-address {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.4;
}

.lf-popup-address-icon,
.lf-popup-contact-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
    vertical-align: -1px;
}

.lf-popup-contact {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.lf-popup-contact-item {
    margin: 0.5em 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.4;
}

.lf-popup-contact-address {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.lf-popup-contact-address .lf-popup-contact-icon {
    display: block;
    width: 14px;
    height: 14px;
    margin: 2px 0 0 0;
    flex-shrink: 0;
    vertical-align: top;
}

.lf-popup-contact-address-text {
    display: block;
    line-height: 1.45;
}

.lf-popup-contact-link,
.lf-popup-contact-link:visited {
    color: #475569 !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

.lf-popup-contact-link:hover,
.lf-popup-contact-link:focus,
.lf-popup-contact-link:active {
    color: #334155 !important;
    text-decoration: none;
}

.lf-popup-capacity {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.lf-popup-capacity-item {
    margin: 0.5em 0;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #475569;
    font-size: 12px;
    line-height: 1.45;
}

.lf-popup-capacity-icon {
    display: block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #0d6fb8;
}

.lf-popup-capacity-label {
    font-weight: 700;
    color: #334155;
}

.lf-popup-distance {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.lf-popup-distance-title {
    margin: 0 0 8px 0;
    letter-spacing: 0.5px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
}

.lf-popup-distance-item {
    margin: 0.5em 0;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #475569;
    font-size: 12px;
    line-height: 1.45;
}

.lf-popup-distance-icon {
    display: block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #64748b;
}

.lf-popup-distance-item strong {
    font-weight: 700;
    color: #334155;
}

.lf-popup-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.lf-popup-tag {
    background: hsl(var(--accent, 199 55% 72%));
    color: #fff !important;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
}

.lf-popup-tag * {
    color: #fff !important;
}

.lf-popup-details-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 20px;
    background: linear-gradient(135deg, #0c6fb5 0%, #1d71b8 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(12, 111, 181, 0.25);
    transition: all 0.2s ease;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform;
}

.lf-popup-details-link:hover {
    transform: translateY(-1px) translateZ(0);
    background: linear-gradient(135deg, #0a5a96 0%, #165d9e 100%) !important;
    color: #fff !important;
    text-decoration: none;
    box-shadow: 0 4px 12px #0c6fb559 !important;
}

.lf-leaflet-popup .lf-popup-details-link,
.lf-leaflet-popup .lf-popup-details-link:link,
.lf-leaflet-popup .lf-popup-details-link:visited,
.lf-leaflet-popup .lf-popup-details-link:focus,
.lf-leaflet-popup .lf-popup-details-link:active,
.lf-leaflet-popup .lf-popup-details-link:hover {
    color: #fff !important;
    -webkit-text-fill-color: #fff;
}

.lf-leaflet-popup .lf-popup-details-link svg {
    color: #fff !important;
}

.lf-popup-details-link:visited,
.lf-popup-details-link:focus,
.lf-popup-details-link:active {
    color: #fff !important;
}

.lf-popup-details-icon {
    width: 14px;
    height: 14px;
}

.leaflet-container a.leaflet-popup-close-button {
    position: absolute;
    top: 6px;
    right: 6px;
    border: none;
    text-align: center;
    width: 30px;
    height: 30px;
    font: 22px Tahoma, Verdana, sans-serif;
    color: #757575;
    text-decoration: none;
    background: transparent;
}

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

@media (max-width: 1024px) {
    .lf-map-panel {
        order: -1;
    }
    
    #lf-map {
        height: 400px;
        min-height: 400px;
    }
}

@media (max-width: 640px) {
    .lf-search-container {
        flex-direction: column;
    }
    
    .lf-location-card {
        flex-direction: column;
    }

    .lf-filter-grid {
        grid-template-columns: 1fr;
    }
    
    .lf-card-left {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .lf-card-image {
        width: 100%;
        height: 150px;
    }
}
