/**
 * Frontend CSS
 *
 * @package InteractiveFloorPlans
 */

/* ===== Karte Container ===== */
.im-map-container {
    margin: 20px 0;
    position: relative;
}

.im-map-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.im-map-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===== Markers Layer ===== */
.im-markers-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.im-marker {
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
}

/* Verlinkte Marker hervorheben */
.im-marker-linked .im-marker-pin {
    background: linear-gradient(135deg, #3498db 0%, #2ecc71 100%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    50% {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), 0 0 0 8px rgba(46, 204, 113, 0);
    }
}

/* ===== Marker Pin ===== */
.im-marker-pin {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    background-color: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-45deg);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    animation: bounce 2s infinite;
}

.im-marker-pin svg {
    transform: rotate(45deg);
    width: 20px;
    height: 20px;
}

.im-marker:hover .im-marker-pin {
    transform: rotate(-45deg) scale(1.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

@keyframes bounce {
    0%, 100% {
        transform: rotate(-45deg) translateY(0);
    }
    50% {
        transform: rotate(-45deg) translateY(-5px);
    }
}

/* ===== Marker Popup ===== */
.im-marker-popup {
    position: absolute !important;
    bottom: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin-bottom: 15px !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    padding: 15px !important;
    min-width: 320px !important;
    width: 320px !important;
    max-width: 420px !important;
    z-index: 100 !important;
    pointer-events: auto !important;
    visibility: hidden !important;
    opacity: 0 !important;
    transition: opacity 0.2s ease, visibility 0.2s ease !important;
}

.im-marker:hover .im-marker-popup,
.im-marker-popup.im-popup-visible {
    visibility: visible !important;
    opacity: 1 !important;
}

.im-marker-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-top-color: #e9ecef;
}

.im-marker-popup-inner {
    position: relative;
}

.im-marker-title {
    margin: 0 0 10px 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
}

.im-marker-description {
    margin: 0 0 10px 0 !important;
    font-size: 14px !important;
    color: #495057 !important;
    line-height: 1.5 !important;
}

.im-marker-content {
    margin: 10px 0 !important;
    font-size: 14px !important;
    color: #343a40 !important;
    line-height: 1.6 !important;
}

.im-marker-content p:first-child {
    margin-top: 0;
}

.im-marker-content p:last-child {
    margin-bottom: 0;
}

/* ===== Navigation Button ===== */
.im-navigate-to-map {
    width: 100%;
    transition: all 0.3s ease;
}

.im-navigate-to-map:hover {
    background: #2980b9 !important;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.im-navigate-to-map:active {
    transform: translateX(2px);
}

/* ===== Marker Images ===== */
.im-marker-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.im-marker-image-link {
    display: block;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.im-marker-image-link::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.im-marker-image-link:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.im-marker-image-link:hover::after {
    opacity: 1;
}

.im-marker-image-link img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}

/* ===== Description ===== */
.im-map-description {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
    margin-top: 15px;
    color: #555;
    line-height: 1.6;
}

/* ===== Open Lightbox Button ===== */
.im-open-lightbox {
    display: inline-block;
    margin-top: 15px;
    padding: 12px 24px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.im-open-lightbox:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

/* ===== Lightbox Overlay ===== */
.im-lightbox-overlay {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.im-lightbox-wrapper {
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.im-lightbox-close {
    transition: all 0.3s ease;
}

.im-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: rotate(90deg);
}

/* ===== Lightbox Markers ===== */
.im-lightbox-overlay .im-marker-pin {
    width: 40px;
    height: 40px;
}

.im-lightbox-overlay .im-marker-pin svg {
    width: 24px;
    height: 24px;
}

.im-lightbox-overlay .im-marker-popup {
    min-width: 300px;
    max-width: 400px;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .im-marker-popup {
        min-width: 200px;
        max-width: 280px;
        padding: 12px;
    }
    
    .im-marker-title {
        font-size: 14px;
    }
    
    .im-marker-description,
    .im-marker-content {
        font-size: 13px;
    }
    
    .im-marker-images {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .im-marker-image-link img {
        height: 60px;
    }
    
    .im-lightbox-overlay .im-marker-popup {
        min-width: 250px;
        max-width: 320px;
    }
    
    .im-marker-pin {
        width: 28px;
        height: 28px;
    }
    
    .im-marker-pin svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .im-marker-popup {
        min-width: 180px;
        max-width: 240px;
    }
    
    .im-lightbox-close {
        width: 40px !important;
        height: 40px !important;
        font-size: 30px !important;
    }
}

/* ===== Print Styles ===== */
@media print {
    .im-marker-popup,
    .im-open-lightbox {
        display: none !important;
    }
    
    .im-map-image {
        box-shadow: none;
    }
}

/* ===== Accessibility ===== */
.im-marker:focus {
    outline: 3px solid #3498db;
    outline-offset: 4px;
}

.im-marker-popup {
    /* Für bessere Lesbarkeit */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Dark Mode deaktiviert - Farben bleiben immer gleich */

/* ===== Loading State ===== */
.im-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.im-loader {
    animation: fadeIn 0.3s ease;
}

/* ===== Transitions für Grundriss-Wechsel ===== */
.im-map-container {
    transition: opacity 0.3s ease;
}