/**
 * Single Marker Map Styles
 * Styles for the embedded map on marker detail pages
 * Copyright (c) 2023-2025 Christian Werner, WERNER.Solutions <office@werner.solutions>
 */

/* Map Section Container */
.grenzstein-map-section {
    margin-top: 40px;
    padding: 30px 0;
    border-top: 2px solid #eee;
    clear: both;
}

.grenzstein-map-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
    font-weight: bold;
}

/* Map Container */
#single-marker-map {
    width: 100%;
    height: 450px;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    background: #f5f5f5;
}

/* Fullscreen Link Control */
.fullscreen-link {
    margin: 10px;
}

.fullscreen-link a {
    background: white !important;
    padding: 8px 15px !important;
    border: 2px solid rgba(0,0,0,0.2) !important;
    border-radius: 4px !important;
    display: block !important;
    text-decoration: none !important;
    color: #333 !important;
    font-size: 14px !important;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.fullscreen-link a:hover {
    background: #2196F3 !important;
    color: white !important;
    border-color: #2196F3 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Loading State */
#single-marker-map.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

#single-marker-map.loading::after {
    content: "Karte wird geladen...";
    color: #666;
    font-size: 16px;
}

/* Leaflet Popup Customization */
.leaflet-popup-content {
    font-size: 14px;
    line-height: 1.4;
    min-width: 150px;
}

.leaflet-popup-content strong {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 16px;
}

/* Updated Button Styles */
.grenzstein-actions {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.grenzstein-actions .button {
    display: inline-block;
    padding: 12px 24px;
    margin: 5px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.grenzstein-actions .gallery-link {
    background: #4CAF50;
    color: white;
}

.grenzstein-actions .gallery-link:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.grenzstein-actions .map-link {
    background: #2196F3;
    color: white;
}

.grenzstein-actions .map-link:hover {
    background: #0b7dda;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Responsive Styles */
@media (max-width: 1024px) {
    #single-marker-map {
        height: 400px;
    }
}

@media (max-width: 767px) {
    .grenzstein-map-section {
        margin-top: 30px;
        padding: 20px 0;
    }

    #single-marker-map {
        height: 350px;
        border-width: 1px;
    }

    .grenzstein-map-section h2 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }

    .grenzstein-actions {
        padding: 15px;
        margin-top: 20px;
    }

    .grenzstein-actions .button {
        display: block;
        width: 100%;
        margin: 10px 0;
        padding: 14px;
    }

    .grenzstein-actions .map-link {
        margin-left: 0;
    }

    .fullscreen-link a {
        font-size: 12px !important;
        padding: 6px 10px !important;
    }
}

@media (max-width: 480px) {
    #single-marker-map {
        height: 300px;
    }

    .grenzstein-map-section {
        padding: 15px 0;
    }
}

/* Lazy Loading Images */
.grenzstein-thumb {
    display: block;
    width: 100%;
    height: auto;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border-radius: 4px;
    min-height: 300px;
    transition: opacity 0.3s ease-in-out;
}

.grenzstein-thumb.lazy-loading {
    opacity: 0;
}

.grenzstein-thumb.lazy-loaded {
    opacity: 1;
    min-height: auto;
}

/* Image Loading Placeholder */
.grenzstein-thumb:not([src]) {
    position: relative;
}

.grenzstein-thumb:not([src])::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Print Styles */
@media print {
    #single-marker-map {
        height: 300px;
        page-break-inside: avoid;
    }

    .fullscreen-link,
    .grenzstein-actions {
        display: none;
    }
}