/* Produkt-Standorte – Frontend Styles */
.ps-wrapper {
    --ps-primary: #1a1a1a;
    --ps-accent: #e63946;
    --ps-pin-color: #1a1a1a;
    --ps-border: #e5e5e5;
    --ps-bg: #fff;
    --ps-muted: #6b6b6b;
    --ps-highlight-bg: #fffbea;
    --ps-radius: 8px;
    font-family: inherit;
    max-width: 100%;
}

.ps-search { margin-bottom: 12px; }

.ps-search-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 720px;
}

.ps-search-form input[type=text] {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius);
    font-size: 16px;
    background: var(--ps-bg);
}

.ps-search-form input[type=text]:focus {
    outline: none;
    border-color: var(--ps-pin-color);
}

.ps-search-form button {
    padding: 12px 20px;
    border: none;
    border-radius: var(--ps-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ps-btn-primary { background: var(--ps-pin-color); color: #fff; }
.ps-btn-primary:hover { background: var(--ps-accent); }

.ps-btn-secondary {
    background: #fff;
    color: var(--ps-pin-color);
    border: 1px solid var(--ps-border) !important;
}
.ps-btn-secondary:hover {
    border-color: var(--ps-pin-color) !important;
    background: #fafafa;
}
.ps-btn-secondary svg { flex-shrink: 0; }
.ps-btn-secondary.ps-loading svg { animation: ps-spin 1s linear infinite; }
@keyframes ps-spin { to { transform: rotate(360deg); } }

.ps-search-form button:disabled { opacity: 0.6; cursor: not-allowed; }

.ps-hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--ps-muted);
}

/* Filter Bar */
.ps-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
    padding: 4px 0;
}

.ps-filter-btn {
    padding: 8px 16px;
    background: #fff;
    color: var(--ps-primary);
    border: 1px solid var(--ps-border);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.ps-filter-btn:hover {
    border-color: var(--ps-primary);
    background: #fafafa;
}

.ps-filter-btn.active {
    background: var(--ps-primary);
    color: #fff;
    border-color: var(--ps-primary);
}

/* Layout */
.ps-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 0;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius);
    overflow: hidden;
    background: var(--ps-bg);
}

/* MAP + Gesture Overlay */
#ps-map {
    width: 100%;
    z-index: 1;
    position: relative;
}

.ps-gesture-overlay {
    position: absolute;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s;
}

.ps-gesture-overlay.active {
    background: rgba(0, 0, 0, 0.4);
}

.ps-gesture-hint {
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 80%;
}

.ps-gesture-overlay.active .ps-gesture-hint {
    opacity: 1;
    transform: scale(1);
}

/* LIST */
.ps-list-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 600px;
    border-left: 1px solid var(--ps-border);
    background: #fafafa;
}

.ps-list-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--ps-border);
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: var(--ps-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    flex-shrink: 0;
}

.ps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar – schlank und dezent */
.ps-list::-webkit-scrollbar { width: 8px; }
.ps-list::-webkit-scrollbar-track { background: transparent; }
.ps-list::-webkit-scrollbar-thumb {
    background: #d1d1d1;
    border-radius: 4px;
}
.ps-list::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }
.ps-list { scrollbar-width: thin; scrollbar-color: #d1d1d1 transparent; }

/* Section Header – sticky innerhalb der Liste */
.ps-section-header {
    position: sticky;
    top: 0;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    z-index: 2;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ps-section-highlight {
    background: rgba(255, 251, 234, 0.95);
    color: #8a6d00;
    border-bottom: 1px solid #f0e3a0;
}

.ps-section-muted {
    background: rgba(250, 250, 250, 0.95);
    color: var(--ps-muted);
    border-bottom: 1px solid var(--ps-border);
    border-top: 1px solid var(--ps-border);
}

.ps-list-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--ps-border);
    cursor: pointer;
    transition: background 0.15s;
    background: #fff;
}

.ps-list-item:not(.ps-list-item-highlight) { background: #fafafa; }
.ps-list-item:hover { background: #fff; }
.ps-list-item-highlight { background: #fff; }
.ps-list-item-highlight:hover { background: var(--ps-highlight-bg); }

.ps-list-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.ps-title-with-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* Rank-Badge für Top 5 */
.ps-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ps-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.ps-list-item h4 {
    margin: 0;
    font-size: 15px;
    color: var(--ps-primary);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Brand Logos */
.ps-brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ps-logo-list svg,
.ps-logo-list img {
    height: 22px;
    width: auto;
    max-width: 44px;
    object-fit: contain;
    border-radius: 3px;
}

.ps-logo-popup { margin-right: 8px; }
.ps-logo-popup svg,
.ps-logo-popup img {
    height: 24px;
    width: auto;
    max-width: 50px;
    object-fit: contain;
    border-radius: 3px;
}

.ps-distance {
    font-size: 13px;
    font-weight: 600;
    color: var(--ps-accent);
    white-space: nowrap;
}

.ps-list-address {
    margin: 0;
    font-size: 13px;
    color: var(--ps-muted);
    line-height: 1.4;
}

/* Popup */
.leaflet-popup-content-wrapper {
    border-radius: var(--ps-radius);
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}
.ps-popup { min-width: 220px; }
.ps-popup img:not(.ps-brand-logo img) {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}
.ps-popup-title { display: flex; align-items: center; margin-bottom: 6px; }
.ps-popup h4 { margin: 0; font-size: 15px; font-weight: 600; }
.ps-popup p { margin: 4px 0; font-size: 13px; line-height: 1.45; }
.ps-popup a { color: var(--ps-accent); text-decoration: none; font-weight: 600; }
.ps-popup a:hover { text-decoration: underline; }

/* User-Marker */
.ps-user-marker { background: transparent !important; border: none !important; }
.ps-user-dot {
    width: 18px;
    height: 18px;
    background: #2563eb;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.25);
    animation: ps-pulse 2s infinite;
}
@keyframes ps-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    70%  { box-shadow: 0 0 0 14px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.leaflet-control-zoom a {
    background: #fff !important;
    color: var(--ps-primary) !important;
    border-color: var(--ps-border) !important;
}
.leaflet-control-attribution {
    font-size: 10px !important;
    background: rgba(255,255,255,0.8) !important;
}

/* Responsive */
@media (max-width: 900px) {
    .ps-layout { grid-template-columns: 1fr; }
    .ps-list-wrapper {
        border-left: none;
        border-top: 1px solid var(--ps-border);
        max-height: 480px;
    }
    .ps-search-form { flex-direction: column; }
    .ps-search-form button { width: 100%; justify-content: center; }
    .ps-gesture-hint { font-size: 14px; padding: 10px 18px; }
}
