/**
 * Frontend Hotspot Map Styles
 * Responsive and accessible styles for hotspot image maps
 */

/* ==========================================================================
   Base Container Styles
   ========================================================================== */

.hotspot-map-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
}

.hotspot-map-wrapper {
    position: relative;
    display: block;
    width: 100%;
    line-height: 0; /* Remove extra space below image */
}

/* ==========================================================================
   Background Image Styles
   ========================================================================== */

.hotspot-background-image {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
    border: none;
    transition: opacity 0.3s ease;
}

.hotspot-map-container:not(.map-loaded) .hotspot-background-image {
    opacity: 0.7;
}

.hotspot-map-container.map-loaded .hotspot-background-image {
    opacity: 1;
}

.hotspot-map-container.map-error .hotspot-background-image {
    opacity: 0.3;
    filter: grayscale(100%);
}

/* ==========================================================================
   Hotspot Pins Overlay
   ========================================================================== */

.hotspot-pins-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow pins to handle their own events */
}

/* ==========================================================================
   Individual Hotspot Pin Styles
   ========================================================================== */

.hotspot-pin {
    position: absolute;
    z-index: 10;
    pointer-events: auto;
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
}

/* Pin visibility animation */
.hotspot-pin.pin-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Hover states */
.hotspot-pin:hover,
.hotspot-pin.pin-hover,
.hotspot-pin:focus {
    z-index: 20;
    transform: translate(-50%, -50%) scale(1.15);
}

/* Active/clicked state */
.hotspot-pin:active,
.hotspot-pin.pin-clicked {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Highlighted state */
.hotspot-pin.pin-highlighted {
    z-index: 30;
    animation: pulseHighlight 1.5s infinite;
}

@keyframes pulseHighlight {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
    }
}

/* ==========================================================================
   Pin Icon Styles
   ========================================================================== */

.hotspot-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}



/* Default pin styles (when no custom icon) */
.pin-default {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    position: relative;
    transition: all 0.2s ease;
}

.pin-default::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}



/* ==========================================================================
   Pin Labels
   ========================================================================== */

.pin-label-text {
    display: none !important;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-bottom: 8px;
    z-index: 100;
    line-height: 1.2;
}

.pin-label-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid rgba(0, 0, 0, 0.9);
}

.pin-label-text.visible,
.hotspot-pin:hover .pin-label-text,
.hotspot-pin.pin-hover .pin-label-text,
.hotspot-pin:focus .pin-label-text {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-2px);
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.hotspot-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    z-index: 50;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    color: #666;
}

/* ==========================================================================
   Accessibility Styles
   ========================================================================== */

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


/* High contrast mode support */
@media (prefers-contrast: high) {
    .pin-default {
        border-width: 3px;
    }
    
    .hotspot-pin:focus {
        outline-width: 3px;
    }
    
    .pin-label-text {
        background-color: #000000;
        color: #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .hotspot-pin,
    .hotspot-icon,
    .pin-default,
    .pin-label-text,
    .hotspot-background-image {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Large screens */
@media (min-width: 1200px) {
    .hotspot-icon {
        width: 28px;
        height: 28px;
    }
    
    .pin-default {
        width: 24px;
        height: 24px;
    }
    
    .pin-label-text {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* Medium screens */
@media (max-width: 1199px) and (min-width: 768px) {
    .hotspot-icon {
        width: 28px;
        height: 28px;
    }
    
    .pin-default {
        width: 18px;
        height: 18px;
    }
}

/* Small screens and tablets */
@media (max-width: 767px) {
    .hotspot-map-container {
        margin: 0;
    }
    
    .hotspot-icon {
        width: 24px;
        height: 24px;
    }
    
    .pin-default {
        width: 16px;
        height: 16px;
        border-width: 1px;
    }
    
    .pin-default::before {
        width: 4px;
        height: 4px;
    }
    
    .pin-label-text {
        font-size: 11px;
        padding: 4px 8px;
        margin-bottom: 6px;
    }
    
    /* Slightly larger touch targets */
    .hotspot-pin {
        min-width: 32px;
        min-height: 32px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .hotspot-icon {
        width: 20px;
        height: 20px;
    }
    
    .pin-default {
        width: 14px;
        height: 14px;
    }
    
    .pin-default::before {
        width: 3px;
        height: 3px;
    }
    
    .pin-label-text {
        font-size: 10px;
        padding: 3px 6px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .hotspot-map-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .hotspot-pin {
        opacity: 1 !important;
        transform: translate(-50%, -50%) scale(1) !important;
    }
    
    .pin-label-text {
        opacity: 1 !important;
        visibility: visible !important;
        background-color: #000000 !important;
        color: #ffffff !important;
    }
    
    .hotspot-loading {
        display: none !important;
    }
}

/* ==========================================================================
   Custom Pin Classes (Examples)
   ========================================================================== */

/* Red pins for offices */
.hotspot-pin.office-location .pin-default {
    background-color: #dc3545;
}

.hotspot-pin.office-location:hover .pin-default,
.hotspot-pin.office-location.pin-hover .pin-default {
    background-color: #c82333;
}

/* Blue pins for stores */
.hotspot-pin.store-location .pin-default {
    background-color: #007bff;
}

.hotspot-pin.store-location:hover .pin-default,
.hotspot-pin.store-location.pin-hover .pin-default {
    background-color: #0056b3;
}

/* Green pins for parks */
.hotspot-pin.park-location .pin-default {
    background-color: #28a745;
}

.hotspot-pin.park-location:hover .pin-default,
.hotspot-pin.park-location.pin-hover .pin-default {
    background-color: #1e7e34;
}

/* Orange pins for restaurants */
.hotspot-pin.restaurant-location .pin-default {
    background-color: #fd7e14;
}

.hotspot-pin.restaurant-location:hover .pin-default,
.hotspot-pin.restaurant-location.pin-hover .pin-default {
    background-color: #e55a00;
}

/* Purple pins for hotels */
.hotspot-pin.hotel-location .pin-default {
    background-color: #6f42c1;
}

.hotspot-pin.hotel-location:hover .pin-default,
.hotspot-pin.hotel-location.pin-hover .pin-default {
    background-color: #59359a;
}

/* Yellow pins for attractions */
.hotspot-pin.attraction-location .pin-default {
    background-color: #ffc107;
}

.hotspot-pin.attraction-location:hover .pin-default,
.hotspot-pin.attraction-location.pin-hover .pin-default {
    background-color: #e0a800;
}

/* Teal pins for services */
.hotspot-pin.service-location .pin-default {
    background-color: #17a2b8;
}

.hotspot-pin.service-location:hover .pin-default,
.hotspot-pin.service-location.pin-hover .pin-default {
    background-color: #117a8b;
}

/* Pink pins for events */
.hotspot-pin.event-location .pin-default {
    background-color: #e83e8c;
}

.hotspot-pin.event-location:hover .pin-default,
.hotspot-pin.event-location.pin-hover .pin-default {
    background-color: #d91a72;
}

/* ==========================================================================
   Pin Animations and Effects
   ========================================================================== */

/* Bounce animation for new pins */
@keyframes pinBounce {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(360deg);
        opacity: 1;
    }
}

.hotspot-pin.pin-animate-in {
    animation: pinBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Pulse animation for active pins */
@keyframes pinPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 123, 186, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 123, 186, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 123, 186, 0);
    }
}

.hotspot-pin.pin-pulse {
    animation: pinPulse 2s infinite;
}

/* Shake animation for error states */
@keyframes pinShake {
    0%, 100% {
        transform: translate(-50%, -50%) translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translate(-50%, -50%) translateX(-2px);
    }
    20%, 40%, 60%, 80% {
        transform: translate(-50%, -50%) translateX(2px);
    }
}

.hotspot-pin.pin-error {
    animation: pinShake 0.5s ease-in-out;
    border: 2px solid #dc3545;
}

/* ==========================================================================
   Special Effects and Overlays
   ========================================================================== */

/* Ripple effect on click */
/*.hotspot-pin::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s ease;
}*/

/*.hotspot-pin.pin-clicked::before {
    width: 50px;
    height: 50px;
    opacity: 1;
}*/

/* Glow effect for important pins */
.hotspot-pin.pin-important {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
}

.hotspot-pin.pin-important:hover {
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 1));
}

/* ==========================================================================
   Map Info and Accessibility
   ========================================================================== */

.hotspot-map-info {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007cba;
}

.hotspot-map-info h3 {
    margin: 0 0 10px;
    color: #1e1e1e;
    font-size: 18px;
}

.hotspot-map-info .map-description {
    margin-bottom: 15px;
    color: #495057;
    line-height: 1.6;
}

.hotspot-map-info .hotspots-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hotspot-map-info .hotspots-list li {
    padding: 5px 0;
    border-bottom: 1px solid #dee2e6;
    color: #495057;
    font-size: 14px;
}

.hotspot-map-info .hotspots-list li:last-child {
    border-bottom: none;
}



/* ==========================================================================
   Error States
   ========================================================================== */

.hotspot-map-container.map-error {
    border: 2px dashed #dc3545;
    background-color: #f8d7da;
}

.hotspot-map-container.map-error::after {
    content: 'Failed to load map image';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 53, 69, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    z-index: 100;
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

/* GPU acceleration for smooth animations */
.hotspot-pin,
.hotspot-icon,
.pin-default {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimize for touch devices */
@media (hover: none) and (pointer: coarse) {
    .hotspot-pin {
        /* Larger touch targets on mobile */
        min-width: 44px;
        min-height: 44px;
    }
    
    .hotspot-pin:hover {
        /* Disable hover effects on touch devices */
        transform: translate(-50%, -50%) scale(1);
    }
    
    .pin-label-text {
        /* Show labels on touch for accessibility */
        opacity: 0.8;
        visibility: visible;
        font-size: 10px;
        padding: 2px 6px;
    }
}