/**
 * mapvis POI Map - Frontend Styles
 * Version: 0.1.3.4
 * 
 * Changelog v0.1.3.4:
 * - Filled monochrome SVG-Icons (fill: currentColor)
 * - Border-Colors vereinheitlicht (#e5e7eb)
 * - Popup-Icons als SVG
 * - Konsistentes Styling ÃƒÂ¼berall
 */

/* ===== CONTAINER ===== */
.mapvis-poi-container {
    position: relative;
    width: 100%;
    min-height: 600px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow-x: hidden;
}

/* ===== HEADER BAR (mittig, nur so breit wie Inhalt) ===== */
.mapvis-header-bar {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 8px 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 1100;
    max-width: 90vw;
}

.mapvis-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.mapvis-search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.mapvis-search-input {
    width: 280px;
    padding: 8px 36px 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    color: #1a1a1a;
    outline: none;
    transition: all 0.2s;
}

.mapvis-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.mapvis-search-input::placeholder {
    color: #9ca3af;
}

.mapvis-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6b7280;
}

.mapvis-search-icon svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.mapvis-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.mapvis-search-clear:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1a1a1a;
}

.mapvis-search-clear svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Map */
.poi-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Leaflet Home Control */
.leaflet-control-home {
    background: white;
    border-radius: 4px;
}

.leaflet-control-home a {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    text-decoration: none;
    font-size: 16px;
    transition: all 0.2s;
}

.leaflet-control-home a:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* Glassmorphism Panel Style */
.mapvis-poi-container .panel {
    position: absolute;
    top: 8px;
    bottom: 8px;
    width: 380px;
    max-height: calc(100vh - 96px); /* Dynamic height */
    height: auto; /* Auto height based on content */
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mapvis-poi-container .panel-left {
    left: 8px;
    transform: translateX(0);
}

.mapvis-poi-container .panel-left.hidden {
    transform: translateX(-100%);
}

.mapvis-poi-container .panel-right {
    right: 8px;
    transform: translateX(0);
}

.mapvis-poi-container .panel-right.hidden {
    transform: translateX(100%);
}

/* Responsive Design - Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .mapvis-poi-container .panel {
        width: 320px;
    }
}

/* Responsive Design - Mobile (< 768px) */
@media (max-width: 768px) {
    .mapvis-header-bar {
        top: 12px;
        padding: 6px 10px;
        gap: 8px;
    }
    
    .mapvis-home-btn {
        width: 32px;
        height: 32px;
    }
    
    .mapvis-home-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .mapvis-search-input {
        width: 200px;
        font-size: 13px;
        padding: 6px 32px 6px 10px;
    }
    
    .mapvis-poi-container .panel {
        top: auto;
        left: 8px !important;
        right: 8px !important;
        bottom: 8px;
        width: auto;
        height: auto;
        max-height: 60vh; /* Fixed height on mobile */
        border-radius: 6px 6px 0 0;
    }

    .mapvis-poi-container .panel-left,
    .mapvis-poi-container .panel-right {
        transform: translateY(0);
    }

    .mapvis-poi-container .panel-left.hidden,
    .mapvis-poi-container .panel-right.hidden {
        transform: translateY(100%);
    }

    /* Stack panels on mobile - right panel goes higher */
    .mapvis-poi-container .panel-right {
        z-index: 1001;
    }

    .mapvis-poi-container .panel-left {
        z-index: 1002;
    }
}

/* Responsive Design - Small Mobile (< 480px) */
@media (max-width: 480px) {
    .mapvis-search-input {
        width: 160px;
    }
    
    .mapvis-poi-container .panel {
        height: 60vh;
        max-height: none;
    }
}

/* Toggle Buttons */
.mapvis-poi-container .toggle-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 80px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: all 0.3s ease;
    border: none;
}

.mapvis-poi-container .toggle-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.mapvis-poi-container .toggle-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.mapvis-poi-container .toggle-btn-left {
    left: 8px;
    border-radius: 0 6px 6px 0;
}

.mapvis-poi-container .toggle-btn-right {
    right: 8px;
    border-radius: 6px 0 0 6px;
}

/* Responsive Toggle Buttons - Mobile */
@media (max-width: 768px) {
    .mapvis-poi-container .toggle-btn {
        top: auto;
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 80px;
        height: 32px;
        border-radius: 6px 6px 0 0;
    }

    .mapvis-poi-container .toggle-btn-left {
        left: 50%;
        margin-left: -90px;
        border-radius: 6px 6px 0 0;
    }

    .mapvis-poi-container .toggle-btn-right {
        left: 50%;
        margin-left: 10px;
        border-radius: 6px 6px 0 0;
    }

    .mapvis-poi-container .toggle-btn-left::before {
        content: 'Ã°Å¸â€œÂ';
    }

    .mapvis-poi-container .toggle-btn-right::before {
        content: 'Ã°Å¸â€œâ€¹';
    }

    /* Hide arrow symbols on mobile */
    .mapvis-poi-container .toggle-btn-left,
    .mapvis-poi-container .toggle-btn-right {
        font-size: 0;
    }
}

/* Panel Header */
.mapvis-poi-container .panel-header {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mapvis-poi-container .panel-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.mapvis-poi-container .close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    padding: 0;
}

.mapvis-poi-container .close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #000;
}

.mapvis-poi-container .close-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Panel Content */
.mapvis-poi-container .panel-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Important for flex child scrolling */
}

/* POI Details */
.mapvis-poi-container .poi-detail {
    text-align: left;
}

.mapvis-poi-container .poi-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 20px;
    background: #f0f0f0; /* Loading background */
}

.mapvis-poi-container .poi-image.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@media (max-width: 768px) {
    .mapvis-poi-container .poi-image {
        height: 180px;
    }
}

.mapvis-poi-container .poi-detail h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: #1a1a1a;
    line-height: 1.3;
}

.mapvis-poi-container .poi-category {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 16px;
}

.mapvis-poi-container .poi-description {
    line-height: 1.7;
    color: #374151;
    margin-bottom: 20px;
    font-size: 15px;
}

.mapvis-poi-container .poi-meta-section {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    padding: 14px;
    margin-bottom: 12px;
}

.mapvis-poi-container .poi-meta-title {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.mapvis-poi-container .poi-meta-content {
    font-size: 14px;
    color: #1a1a1a;
    line-height: 1.5;
}

.mapvis-poi-container .poi-address {
    padding: 14px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 4px;
    font-size: 14px;
    color: #1e40af;
    border-left: 3px solid #3b82f6;
}

/* POI List */
.mapvis-poi-container .filter-section {
    margin-bottom: 16px;
}

.mapvis-poi-container .filter-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.mapvis-poi-container .filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    color: #1a1a1a;
    cursor: pointer;
}

.mapvis-poi-container .poi-count {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
}

.mapvis-poi-container .poi-list-item {
    padding: 12px 12px 12px 16px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border-left: 4px solid #3b82f6;
    display: flex;
    gap: 12px;
    align-items: center;
}

.mapvis-poi-container .poi-list-item-content {
    flex: 1;
    min-width: 0;
}

.mapvis-poi-container .poi-list-item-thumbnail {
    width: 80px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.mapvis-poi-container .poi-list-item:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mapvis-poi-container .poi-list-item h3 {
    font-size: 15px;
    margin-bottom: 4px;
    color: #1a1a1a;
}

.mapvis-poi-container .poi-list-item p {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}

@media (max-width: 480px) {
    .mapvis-poi-container .poi-list-item-thumbnail {
        width: 60px;
        height: 45px;
    }

    .mapvis-poi-container .poi-list-item-content h3 {
        font-size: 14px;
    }

    .mapvis-poi-container .poi-list-item-content p {
        font-size: 12px;
    }
}

/* Custom Scrollbar */
.mapvis-poi-container .panel-content::-webkit-scrollbar {
    width: 6px;
}

.mapvis-poi-container .panel-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}

.mapvis-poi-container .panel-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.mapvis-poi-container .panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Leaflet Popup Custom Style */
.mapvis-poi-container .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 0; /* Remove default padding */
}

.mapvis-poi-container .leaflet-popup-content {
    margin: 0;
    font-family: inherit;
    min-width: 280px;
    max-width: 320px;
}

.mapvis-poi-container .popup-content {
    display: flex;
    flex-direction: column;
}

.mapvis-poi-container .popup-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    display: block;
}

.mapvis-poi-container .popup-body {
    padding: 16px;
}

.mapvis-poi-container .popup-header {
    margin-bottom: 12px;
}

.mapvis-poi-container .popup-content h3 {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.mapvis-poi-container .popup-short-desc {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

.mapvis-poi-container .popup-info {
    margin-bottom: 12px;
}

.mapvis-poi-container .popup-info-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #4b5563;
}

.mapvis-poi-container .popup-info-item:last-child {
    margin-bottom: 0;
}

.mapvis-poi-container .popup-info-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    fill: currentColor;
    color: #6b7280;
}

.mapvis-poi-container .popup-info-text {
    flex: 1;
    word-break: break-word;
}

.mapvis-poi-container .popup-info-link {
    color: #3b82f6;
    text-decoration: none;
}

.mapvis-poi-container .popup-info-link:hover {
    text-decoration: underline;
}

.mapvis-poi-container .popup-footer {
    padding: 0 16px 16px 16px;
}

.mapvis-poi-container .popup-btn {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
}

.mapvis-poi-container .popup-btn:hover {
    background: #2563eb;
}

/* ===== PANEL HOME BUTTON ===== */
.panel-home-section {
    margin-bottom: 16px;
}

.panel-home-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 6px;
    color: #2563eb;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.panel-home-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.panel-home-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ===== PANEL EDIT BUTTON ===== */
.panel-edit-section {
    margin-bottom: 16px;
}

.panel-edit-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 6px;
    color: #7c3aed;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.panel-edit-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

.panel-edit-btn.active {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
}

.panel-edit-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ===== PANEL SEARCH ===== */
.panel-search-section {
    margin-bottom: 16px;
}

.panel-search-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.panel-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.panel-search-input {
    width: 100%;
    padding: 10px 36px 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    color: #1a1a1a;
    outline: none;
    transition: all 0.2s;
}

.panel-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.panel-search-input::placeholder {
    color: #9ca3af;
}

.panel-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    fill: currentColor;
    color: #6b7280;
    pointer-events: none;
}

.panel-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.panel-search-clear:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1a1a1a;
}

.panel-search-clear svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Custom marker FontAwesome icons */
.custom-marker-fa i,
.marker-icon-wrapper i {
    display: inline-block !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
}

/* Ensure FontAwesome loads properly in Leaflet markers */
.leaflet-marker-icon.custom-marker-fa {
    background: transparent !important;
    border: none !important;
    font-family: "Font Awesome 6 Free" !important;
}

.leaflet-marker-icon .marker-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaflet-marker-icon .marker-icon-wrapper i {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
}
