/* Custom styles for Leaflet maps */
.map-container {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    height: 100%;
}

/* Custom Map Markers */
.custom-div-icon {
    background: transparent !important;
    border: none !important;
}

.custom-marker {
    width: 30px;
    height: 30px;
    background: #007bff;
    border: 3px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    position: relative;
}

    .custom-marker::after {
        content: '';
        position: absolute;
        bottom: -8px;
        left: 50%;
        transform: translateX(-50%);
        width: 0;
        height: 0;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-top: 8px solid #007bff;
    }

    .custom-marker:hover {
        background-color: #0056b3;
        transform: scale(1.1);
        transition: all 0.2s ease;
    }

        .custom-marker:hover::after {
            border-top-color: #0056b3;
        }

.marker-number {
    color: white;
    font-weight: bold;
    font-size: 12px;
    line-height: 1;
}

/* Popup Styles */
.journal-entry-popup .leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.journal-entry-popup-content {
    max-width: 350px;
}

.popup-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.popup-title {
    margin: 0;
    color: #333;
    font-weight: 600;
}

.popup-location {
    margin-bottom: 12px;
}

    .popup-location i {
        color: #28a745;
        margin-right: 4px;
    }

/* Photo and Video Styles */
.popup-photos {
    margin: 12px 0;
}

.single-photo {
    text-align: center;
    position: relative;
}

.popup-photo-single {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

    .popup-photo-single:hover {
        transform: scale(1.02);
    }

/* Video-specific styles for single video display */
.popup-video-single {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.video-container-popup {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

    .video-container-popup:hover {
        opacity: 0.9;
    }

.video-play-overlay-large {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
    font-size: 24px;
    transition: all 0.3s ease;
}

.video-container-popup:hover .video-play-overlay-large {
    background: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    z-index: 10;
}

    .video-badge i {
        margin-right: 4px;
    }

.photo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 8px;
}

.popup-photo-grid {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

    .popup-photo-grid:hover {
        transform: scale(1.05);
    }

/* Video grid item container */
.popup-media-grid-item {
    position: relative;
    display: inline-block;
    width: 100%;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

    .popup-media-grid-item:hover {
        transform: scale(1.05);
        transition: transform 0.2s ease;
    }

/* Video play overlay for grid items */
.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
    font-size: 12px;
    transition: all 0.3s ease;
}

.popup-media-grid-item:hover .video-play-overlay {
    background: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

.more-photos {
    grid-column: span 2;
    background: rgba(0,0,0,0.7);
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 12px;
    border-radius: 4px;
}

.photo-caption {
    display: block;
    color: #666;
    font-style: italic;
    margin-top: 4px;
}

.popup-description {
    margin: 12px 0;
}

    .popup-description p {
        color: #555;
        font-size: 14px;
        line-height: 1.4;
    }

.popup-actions {
    border-top: 1px solid #eee;
    padding-top: 8px;
    text-align: center;
}

/* Photo Modal */
.photo-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
}

.photo-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    cursor: default;
}

.video-modal-content {
    max-width: 95vw;
    max-height: 95vh;
}

.photo-modal-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .photo-modal-header h6 {
        margin: 0;
        color: #333;
    }

.photo-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

    .photo-modal-close:hover {
        background-color: #f8f9fa;
    }

.photo-modal-body {
    padding: 16px;
    text-align: center;
}

.photo-modal-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 6px;
}

.video-modal-player {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 6px;
    background-color: #000;
}

.photo-modal-caption {
    margin-top: 12px;
    color: #666;
    font-style: italic;
}

/* Legacy popup styles for backward compatibility */
.map-popup h6 {
    color: #333;
    margin-bottom: 0.5rem;
}

.map-popup p {
    color: #666;
    line-height: 1.4;
}

.map-popup small {
    color: #888;
}

/* Loading state for maps */
.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.map-placeholder {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

    .map-placeholder i {
        font-size: 3rem;
        margin-bottom: 1rem;
        color: #adb5bd;
    }

/* Responsive map heights */
.trip-map {
    height: 400px;
    width: 100%;
    border-radius: 6px;
}

.journal-map {
    height: 300px;
    width: 100%;
}

.location-picker-map {
    height: 350px;
    width: 100%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .trip-map,
    .journal-map,
    .location-picker-map {
        height: 250px;
    }

    .journal-entry-popup-content {
        max-width: 280px;
    }

    .popup-photo-single,
    .popup-video-single {
        max-height: 150px;
    }

    .popup-photo-grid {
        height: 60px;
    }

    .popup-media-grid-item {
        height: 60px;
    }

    .video-play-overlay {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }

    .video-play-overlay-large {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .video-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    .photo-modal-content {
        margin: 20px;
    }

    .video-modal-content {
        margin: 10px;
    }
}
