/* ========================================
   MAP MODAL COMPONENTS
   ======================================== */

/* Map Modal Base Styles */
.map-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.map-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.map-modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 95%;
    max-width: 1200px;
    height: 90%;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.map-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    background: white;
    border-radius: 16px 16px 0 0;
}

.map-modal-header h2 {
    margin: 0;
    color: #111827;
    font-size: 20px;
    font-weight: 600;
}

.map-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6B7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-modal-close:hover {
    color: #374151;
    background-color: #F3F4F6;
}

.map-modal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Modal Map Container */
.modal-map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.modal-libraries-map,
.modal-bookstores-map,
.modal-places-map {
    width: 100%;
    height: 100%;
}

/* Modal Map Controls */
.modal-map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.modal-map-control-group {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-map-control-btn {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #374151;
    font-size: 16px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-map-control-btn:hover {
    background-color: #F3F4F6;
    color: #111827;
    transform: scale(1.05);
}

.modal-map-control-btn:active {
    transform: scale(0.95);
}

/* Modal Map Legend */
.modal-map-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.legend-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.legend-text {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

/* Modal Sidebar */
.modal-map-sidebar {
    width: 320px;
    background: #F9FAFB;
    border-left: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid #E5E7EB;
    background: white;
}

.modal-sidebar-header h3 {
    margin: 0;
    color: #111827;
    font-size: 16px;
    font-weight: 600;
}

.modal-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.modal-sidebar-place-item {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    border: 1px solid #E5E7EB;
    transition: all 0.2s ease;
}

.modal-sidebar-place-item:hover {
    border-color: #8B5CF6;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.modal-sidebar-place-item h4 {
    margin: 0 0 8px 0;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
}

.modal-sidebar-place-item p {
    margin: 4px 0;
    color: #6B7280;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-sidebar-place-item i {
    width: 12px;
    color: #8B5CF6;
    font-size: 12px;
}

.modal-sidebar-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6B7280;
}

/* ========================================
   MOBILE FULLSCREEN MAP
   ======================================== */

.mobile-fullscreen-map {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 10000;
    flex-direction: column;
}

.mobile-map-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid #E5E7EB;
    z-index: 1001;
}

.mobile-close-button {
    background: none;
    border: none;
    font-size: 20px;
    color: #374151;
    cursor: pointer;
    padding: 8px;
    margin-right: 16px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.mobile-close-button:hover {
    background-color: #F3F4F6;
}

.mobile-map-title h2 {
    margin: 0;
    color: #111827;
    font-size: 18px;
    font-weight: 600;
}

.mobile-map-subtitle {
    color: #6B7280;
    font-size: 14px;
}

.mobile-map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.mobile-libraries-map,
.mobile-bookstores-map,
.mobile-places-map {
    width: 100%;
    height: 100%;
}

/* Mobile Map Controls */
.mobile-map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.mobile-map-control-group {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-map-control-btn {
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #374151;
    font-size: 18px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-map-control-btn:hover {
    background-color: #F3F4F6;
    color: #111827;
}

.mobile-map-control-btn:active {
    transform: scale(0.95);
}

/* Mobile Map Legend */
.mobile-map-legend {
    position: absolute;
    bottom: 140px;
    left: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Mobile Swiper */
.mobile-libraries-swiper,
.mobile-bookstores-swiper,
.mobile-places-swiper {
    background: white;
    border-top: 1px solid #E5E7EB;
    z-index: 1001;
}

.mobile-swiper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #F3F4F6;
}

.mobile-swiper-header h3 {
    margin: 0;
    color: #111827;
    font-size: 16px;
    font-weight: 600;
}

.mobile-swiper-indicator {
    color: #6B7280;
    font-size: 14px;
}

.mobile-swiper-container {
    height: 120px;
    overflow: hidden;
}

.mobile-swiper-wrapper {
    display: flex;
    transition: transform 0.3s ease;
}

.mobile-swiper-slide {
    min-width: 280px;
    padding: 12px 20px;
}

.mobile-place-card {
    background: #F9FAFB;
    border-radius: 8px;
    padding: 12px;
    height: 100%;
    border: 1px solid #E5E7EB;
}

.mobile-place-card h4 {
    margin: 0 0 6px 0;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.mobile-place-card p {
    margin: 4px 0;
    color: #6B7280;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mobile-place-card i {
    width: 12px;
    color: #8B5CF6;
    font-size: 12px;
}

.mobile-swiper-pagination {
    text-align: center;
    padding: 12px;
}

.mobile-swiper-pagination .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #D1D5DB;
    border-radius: 50%;
    display: inline-block;
    margin: 0 4px;
    transition: background-color 0.2s ease;
}

.mobile-swiper-pagination .swiper-pagination-bullet-active {
    background: #8B5CF6;
}

/* ========================================
   CUSTOM MARKERS
   ======================================== */

/* Base Marker Styles */
.custom-marker {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 999;
}

.custom-marker:hover {
    transform: scale(1.1);
    z-index: 1000;
}

.custom-marker svg {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: transform 0.2s ease;
}

.custom-marker:hover svg {
    transform: scale(1.05);
}

/* Library Markers */
.library-marker {
    width: 32px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bookstore Markers */
.bookstore-marker {
    width: 32px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Place Markers */
.place-marker {
    width: 32px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   INFO POPUPS
   ======================================== */

.library-info-popup,
.bookstore-info-popup,
.place-info-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.popup-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0;
    border-bottom: 1px solid #E5E7EB;
    margin-bottom: 16px;
}

.popup-header h3 {
    margin: 0;
    color: #111827;
    font-size: 18px;
    font-weight: 600;
}

.popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6B7280;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.popup-close:hover {
    color: #374151;
    background-color: #F3F4F6;
}

.popup-body {
    padding: 0 20px 20px;
}

.popup-body p {
    margin: 8px 0;
    color: #6B7280;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.popup-body i {
    width: 16px;
    color: #8B5CF6;
    font-size: 14px;
}

.popup-body a {
    color: #8B5CF6;
    text-decoration: none;
}

.popup-body a:hover {
    text-decoration: underline;
}

.popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
}

.btn-primary.btn-sm {
    background-color: #8B5CF6;
    color: white;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.btn-primary.btn-sm:hover {
    background-color: #7C3AED;
}

.btn-secondary.btn-sm {
    background-color: #F3F4F6;
    color: #374151;
    border: 1px solid #D1D5DB;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-secondary.btn-sm:hover {
    background-color: #E5E7EB;
    border-color: #9CA3AF;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .map-modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-width: none;
        max-height: none;
    }
    
    .map-modal-header {
        border-radius: 0;
        padding: 16px 20px;
    }
    
    .modal-map-sidebar {
        display: none;
    }
    
    .modal-map-container {
        width: 100%;
    }
    
    .popup-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .popup-actions {
        flex-direction: column;
    }
    
    .btn-sm {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .modal-map-controls,
    .mobile-map-controls {
        top: 16px;
        right: 16px;
    }
    
    .modal-map-legend,
    .mobile-map-legend {
        left: 16px;
        bottom: 16px;
    }
    
    .mobile-map-legend {
        bottom: 120px;
    }
    
    .mobile-swiper-slide {
        min-width: 260px;
    }
}

/* ========================================
   ANIMATIONS AND TRANSITIONS
   ======================================== */

.map-modal {
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

.map-modal-content {
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.mobile-fullscreen-map {
    animation: mobileMapSlideIn 0.3s ease;
}

@keyframes mobileMapSlideIn {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.flex {
    display: flex !important;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-up {
    animation: slideUp 0.3s ease;
}

/* ========================================
   PLACE TYPE BADGES
   ======================================== */

/* Place Type Badges */
.place-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.place-type-badge.library {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.place-type-badge.bookstore {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}