/* Map Page Styles */

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Montserrat', sans-serif;
    /* Prevent zoom gestures on the entire page */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#map {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
    /* Prevent zoom gestures on the map container */
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* PDF Modal Overrides for Mobile */
.modal.show #pdfFrame {
    touch-action: manipulation;
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

.modal.show .pdf-container {
    touch-action: manipulation;
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Floating controls styling */
#map-back-btn {
    position: fixed;
    top: 18px;
    left: 14px;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 10px;
}

#map-back-btn .btn {
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 1.08rem;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(51,51,51,0.8) !important;
    background-color: rgb(51, 51, 51);
    color: #fff;
    border: none;
    padding: 8px 16px;
}

#map-back-btn .btn:hover {
    background-color: rgb(40, 40, 40);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(51,51,51,0.9) !important;
}

#map-logo-card {
    position: fixed;
    bottom: 40px;
    left: 14px;
    z-index: 1001;
    display: flex;
    align-items: center;
    background: rgb(51, 51, 51);
    box-shadow: 0 4px 16px rgba(51, 51, 51, 0.9);
    border-radius: 999px;
    padding: 0.375rem 0.75rem;
    gap: 10px;
    transition: all 0.3s ease;
    width: fit-content;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 1.08rem;
    color: #fff;
    border: none;
}

#map-logo-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(51, 51, 51, 0.9);
}

/* Map info window styling - matching the report card design */
.map-info-window {
    font-family: 'Montserrat', sans-serif;
    max-width: 320px;
    min-width: 280px;
    padding: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 1px solid #e9ecef;
}

/* Override Google Maps info window default styling */
.gm-style-iw {
    font-family: 'Montserrat', sans-serif !important;
    padding: 0 !important;
    border-radius: 12px !important;
    max-width: 320px !important;
}

.gm-style-iw-d {
    overflow: hidden !important;
    border-radius: 12px !important;
}

.gm-style-iw-t::after {
    background: white !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

/* Ensure cluster markers are visible and properly styled */
.gm-style-marker {
    cursor: pointer;
}

/* Custom cluster marker styling */
.cluster-marker {
    background: #326ffe;
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    text-align: center;
    line-height: 40px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Map info window header - matching report card header */
.map-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
}

.map-info-header .report-category {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-info-header .category-icon {
    font-size: 1.3rem;
}

.map-info-header .category-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.map-info-header .report-status {
    display: flex;
    align-items: center;
}

.map-info-header .status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.map-info-header .status-pending {
    background: #fff3cd;
    color: #856404;
}

.map-info-header .status-approved {
    background: #d4edda;
    color: #155724;
}

/* Map info window body - matching report card body */
.map-info-body {
    padding: 1rem 1.25rem;
}

.map-info-body .report-location {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.map-info-body .location-text {
    color: #666;
    font-weight: 500;
}

.map-info-body .report-description {
    margin-bottom: 0;
}

.map-info-body .description-text {
    color: #333;
    line-height: 1.5;
    margin: 0;
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Map info window footer - matching report card footer */
.map-info-footer {
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

.map-info-footer .report-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
}

.map-info-footer .meta-item {
    display: flex;
    align-items: center;
    color: #666;
}

.map-info-footer .meta-text {
    color: #666;
    font-weight: 500;
}

/* Map info window actions */
.map-info-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.map-info-actions .view-report-btn {
    background: #333;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    font-family: 'Montserrat', sans-serif;
    flex: 1;
    justify-content: center;
}

.map-info-actions .view-report-btn:hover {
    background: #555;
    transform: translateY(-1px);
}

.map-info-actions .vote-btn-map {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-family: 'Montserrat', sans-serif;
    position: relative;
}

.map-info-actions .vote-btn-map:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.map-info-actions .vote-shield {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.1rem 0.3rem;
    border-radius: 10px;
    margin-left: 0.25rem;
    display: inline-block;
}

.map-info-actions .vote-count {
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    display: inline-block;
}

.map-info-actions .vote-shield.vote-updated {
    animation: voteCountUpdate 0.3s ease;
}

@keyframes voteCountUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Map info window media gallery */
.map-info-body .report-media {
    margin-bottom: 0.75rem;
}

.map-info-body .media-preview {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.25rem 0;
}

.map-info-body .media-item {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.map-info-body .media-item:hover {
    transform: scale(1.05);
}

.map-info-body .media-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.map-info-body .media-icon-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
    color: #6c757d;
    font-size: 1.5rem;
    min-height: 80px;
}

.map-info-body .media-icon-thumbnail:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-color: #adb5bd;
    color: #495057;
}

.map-info-body .media-icon-thumbnail i {
    font-size: 2rem;
    opacity: 0.8;
}

.map-info-body .media-icon-thumbnail:hover i {
    opacity: 1;
}

.map-info-body .media-overlay-hover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: white;
    font-size: 1.2rem;
}

.map-info-body .media-item:hover .media-overlay-hover {
    opacity: 1;
}

.map-info-body .media-overlay {
    position: relative;
    width: 70px;
    height: 70px;
    background: rgba(0, 123, 255, 0.1);
    border: 2px dashed #007bff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.map-info-body .media-overlay:hover {
    background: rgba(0, 123, 255, 0.2);
    transform: scale(1.05);
}

.map-info-body .overlay-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: #007bff;
}

/* Mobile responsiveness for media gallery */
@media (max-width: 480px) {
    .map-info-body .media-item,
    .map-info-body .media-overlay {
        width: 60px;
        height: 60px;
    }
    
    .map-info-body .media-preview {
        gap: 0.4rem;
    }
    
    .map-info-body .overlay-text {
        font-size: 0.7rem;
    }
}

/* Mobile responsiveness for map info window */
@media (max-width: 768px) {
    .map-info-window {
        max-width: 280px;
        min-width: 250px;
    }
    
    .gm-style-iw {
        max-width: 280px !important;
    }
    
    .map-info-header {
        padding: 0.75rem 1rem;
    }
    
    .map-info-header .category-name {
        font-size: 0.8rem;
    }
    
    .map-info-header .category-icon {
        font-size: 1.1rem;
    }
    
    .map-info-body {
        padding: 0.75rem 1rem;
    }
    
    .map-info-body .description-text {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    .map-info-footer {
        padding: 0.5rem 1rem 0.75rem;
    }
    
    .map-info-footer .report-meta {
        gap: 0.75rem;
        margin-bottom: 0.5rem;
        font-size: 0.75rem;
    }
    
    .map-info-actions {
        gap: 0.4rem;
    }
    
    .map-info-actions .view-report-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .map-info-actions .vote-btn-map {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .map-info-actions .vote-count {
        font-size: 0.65rem;
        padding: 0.05rem 0.25rem;
    }
}

@media (max-width: 480px) {
    .map-info-window {
        max-width: 260px;
        min-width: 230px;
    }
    
    .gm-style-iw {
        max-width: 260px !important;
    }
    
    .map-info-header {
        padding: 0.6rem 0.8rem;
    }
    
    .map-info-header .category-name {
        font-size: 0.75rem;
    }
    
    .map-info-body {
        padding: 0.6rem 0.8rem;
    }
    
    .map-info-body .description-text {
        font-size: 0.8rem;
    }
    
    .map-info-footer {
        padding: 0.4rem 0.8rem 0.6rem;
    }
    
    .map-info-footer .report-meta {
        flex-direction: column;
        gap: 0.25rem;
        margin-bottom: 0.4rem;
    }
    
    .map-info-actions {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .map-info-actions .view-report-btn,
    .map-info-actions .vote-btn-map {
        width: 100%;
        justify-content: center;
        padding: 0.4rem;
        font-size: 0.75rem;
    }
}

/* General mobile responsiveness */
@media (max-width: 768px) {
    #map-back-btn {
        top: 12px;
        left: 10px;
        gap: 8px;
    }
    
    #map-back-btn .btn {
        font-size: 0.95rem;
        padding: 8px 12px;
    }
    
    #map-logo-card {
        display: none !important;
    }
}

@media (max-width: 480px) {
    #map-back-btn {
        top: 12px;
        left: 8px;
        gap: 6px;
    }
    
    #map-back-btn .btn {
        font-size: 0.9rem;
        padding: 6px 10px;
    }
}

/* Mobile PDF Viewer Enhancements */
@media (max-width: 768px) {
    .modal.show #pdfFrame {
        height: 70vh !important;
        min-height: 400px;
        width: 100%;
        border: none;
        border-radius: 8px;
    }
    
    .modal.show .pdf-container {
        height: 70vh;
        min-height: 400px;
        display: flex;
        flex-direction: column;
    }
    
    .modal.show .pdf-fallback {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 2rem 1rem;
    }
    
    .modal.show .pdf-fallback .btn {
        margin-top: 1rem;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .modal.show #pdfFrame {
        height: 60vh !important;
        min-height: 350px;
    }
    
    .modal.show .pdf-container {
        height: 60vh;
        min-height: 350px;
    }
}
