/* Frontend Hotspot Styles */
.hotspot-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

.hotspot-image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    width: 100%;
    background: #f9f9f9;
    border-radius: 0;
    /* Allow tooltips to extend outside image boundaries */
    overflow: visible;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.hotspot-main-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* Hotspot Base Styles */
.hotspot-point.frontend-hotspot {
    position: absolute;
    cursor: pointer;
    transform: translate(-50%, -50%);
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hotspot-point.frontend-hotspot:hover {
    transform: translate(-50%, -50%) scale(1.05);
    z-index: 15;
}

.hotspot-point.frontend-hotspot:focus {
    border-radius: 50%;
}

/* Hotspot Icon Container */
.hotspot-point .hotspot-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Plus Icon (Default State) */
.hotspot-point .hotspot-icon .hotspot-plus-icon {
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.hotspot-point .hotspot-icon svg {
    display: block;
    width: 45px;
    height: 45px;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Custom Image (Hidden by Default) */
.hotspot-point .hotspot-icon .hotspot-custom-image {
    position: absolute;
    width: 25px;
    height: 25px;
    object-fit: cover;
    border-radius: 3px;
    opacity: 0;
    transform: scale(0.5) rotate(-180deg);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Active State Transitions */
.hotspot-point.frontend-hotspot.active .hotspot-icon {
    background: #78BDDD;
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

/* Hide Plus Icon When Active */
.hotspot-point.frontend-hotspot.active .hotspot-icon .hotspot-plus-icon {
    opacity: 0;
    transform: scale(0.5) rotate(180deg);
}

/* Show Custom Image When Active */
.hotspot-point.frontend-hotspot.active .hotspot-icon .hotspot-custom-image {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Pulse Animation for Inactive Hotspots */
.hotspot-point.frontend-hotspot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: hotspot-pulse 2.5s infinite;
    z-index: -1;
    opacity: 1;
    transition: opacity 0.4s ease;
}

/* Stop Pulse When Active */
.hotspot-point.frontend-hotspot.active::before {
    opacity: 0;
}

@keyframes hotspot-pulse {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.6);
    }
}

/* Tooltip Popup Styles - Positioned Below Hotspot */
.hotspot-tooltip {
    position: absolute;
    z-index: 1000;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    max-width: 300px;
    width: 280px;
    overflow: hidden;
    opacity: 0;
    transform: translateX(-50%) translateY(-10px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid rgba(0, 0, 0, 0.08);
    pointer-events: none;
}

/* Show State */
.hotspot-tooltip.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

/* Tooltip Arrow - Points Up to Hotspot (default position below) */
.hotspot-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 12px solid #4A90E2;
    z-index: 1;
}

/* When positioned above hotspot */
.hotspot-tooltip.position-above::before {
    top: 100%;
    bottom: auto;
    border-bottom: none;
    border-top: 12px solid #4A90E2;
}

/* Tooltip Header */
.hotspot-tooltip-header {
    color: white;
    padding: 16px 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
}

.hotspot-tooltip-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.8"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hotspot-tooltip-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    flex: 1;
    padding-right: 15px;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.hotspot-tooltip-icon {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.hotspot-tooltip-icon svg {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.2));
}

/* Tooltip Body */
.hotspot-tooltip-body {
    padding: 20px;
    background: white;
}

.hotspot-tooltip-image {
    width: 100%;
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
}

.hotspot-tooltip-image img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 160px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.hotspot-tooltip-description {
    font-size: 14px;
    line-height: 1.6;
    color: #4a5568;
    margin: 0;
    font-weight: 400;
}

/* Loading State */
.hotspot-tooltip-image.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    position: relative;
}

@keyframes loading-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .hotspot-tooltip {
        max-width: 280px;
        width: 260px;
    }
    
    .hotspot-tooltip-header {
        padding: 14px 18px;
    }
    
    .hotspot-tooltip-title {
        font-size: 15px;
    }
    
    .hotspot-tooltip-icon svg {
        width: 22px;
        height: 22px;
    }
    
    .hotspot-tooltip-body {
        padding: 18px;
    }
    
    .hotspot-tooltip-description {
        font-size: 13px;
    }
    
    .hotspot-tooltip-image img {
        max-height: 140px;
    }
    
    /* Smaller hotspot icons on tablet */
    .hotspot-point .hotspot-icon {
        width: 45px;
        height: 45px;
    }
    
    .hotspot-point .hotspot-icon svg {
        width: 45px;
        height: 45px;
    }
    
    .hotspot-point .hotspot-icon .hotspot-custom-image {
        width: 22px;
        height: 22px;
    }
    
    .hotspot-point.frontend-hotspot::before {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .hotspot-tooltip {
        max-width: 260px;
        width: 240px;
    }
    
    .hotspot-tooltip-header {
        padding: 12px 16px;
    }
    
    .hotspot-tooltip-title {
        font-size: 14px;
        padding-right: 12px;
    }
    
    .hotspot-tooltip-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .hotspot-tooltip-body {
        padding: 16px;
    }
    
    .hotspot-tooltip-description {
        font-size: 12px;
        line-height: 1.5;
    }
    
    .hotspot-tooltip-image {
        margin-bottom: 14px;
    }
    
    .hotspot-tooltip-image img {
        max-height: 120px;
    }
    
    /* Mobile hotspot icons */
    .hotspot-point .hotspot-icon {
        width: 45px;
        height: 45px;
    }
    
    .hotspot-point .hotspot-icon svg {
        width: 45px;
        height: 45px;
    }
    
    .hotspot-point .hotspot-icon .hotspot-custom-image {
        width: 20px;
        height: 20px;
    }
    
    .hotspot-point.frontend-hotspot::before {
        width: 55px;
        height: 55px;
    }
    
    /* Smaller arrow on mobile */
    .hotspot-tooltip::after {
        border-left-width: 10px;
        border-right-width: 10px;
        border-top-width: 10px;
    }
}

@media (max-width: 360px) {
    .hotspot-tooltip {
        max-width: 240px;
        width: 220px;
    }
    
    .hotspot-tooltip-header {
        padding: 10px 14px;
    }
    
    .hotspot-tooltip-body {
        padding: 14px;
    }
    
    /* Very small mobile hotspots */
    .hotspot-point .hotspot-icon {
        width: 38px;
        height: 38px;
    }
    
    .hotspot-point .hotspot-icon svg {
        width: 38px;
        height: 38px;
    }
    
    .hotspot-point .hotspot-icon .hotspot-custom-image {
        width: 18px;
        height: 18px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .hotspot-point.frontend-hotspot:hover {
        transform: translate(-50%, -50%);
    }
    
    .hotspot-point.frontend-hotspot.touched {
        transform: translate(-50%, -50%) scale(1.02);
    }
    
    .hotspot-tooltip-image img:hover {
        transform: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .hotspot-tooltip {
        border: 2px solid #000;
    }
    
    .hotspot-tooltip-header {
        background: #000;
        color: #fff;
    }
    
    .hotspot-tooltip-description {
        color: #000;
    }
    
    .hotspot-point.frontend-hotspot.active .hotspot-icon {
        background: #000;
        border: 2px solid #fff;
    }
    
    .hotspot-point .hotspot-icon {
        border: 1px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .hotspot-point.frontend-hotspot,
    .hotspot-tooltip,
    .hotspot-point .hotspot-icon,
    .hotspot-point .hotspot-icon .hotspot-plus-icon,
    .hotspot-point .hotspot-icon .hotspot-custom-image {
        transition: none;
        animation: none;
    }
    
    .hotspot-point.frontend-hotspot::before {
        animation: none;
        opacity: 0.3;
    }
    
    .hotspot-tooltip.show {
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .hotspot-tooltip {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .hotspot-tooltip-body {
        background: #2d3748;
    }
    
    .hotspot-tooltip-description {
        color: #cbd5e0;
    }
    
    .hotspot-tooltip-image.loading {
        background: linear-gradient(90deg, #4a5568 25%, #2d3748 50%, #4a5568 75%);
        background-size: 200% 100%;
    }
    
    .hotspot-image-wrapper {
        background: #2d3748;
    }
    
  
}

/* Print Styles */
@media print {
    .hotspot-tooltip {
        display: none !important;
    }
    
    .hotspot-point.frontend-hotspot::before {
        display: none;
    }
    
    .hotspot-point .hotspot-icon {
        box-shadow: none;
    }
    
    .hotspot-image-wrapper {
        box-shadow: none;
    }
}

/* Accessibility */
.hotspot-point.frontend-hotspot:focus-visible {
    outline: 3px solid #4A90E2;
    outline-offset: 4px;
    border-radius: 50%;
}

/* Screen Reader Content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Error States */
.hotspot-tooltip-image.error {
    background: #fef2f2;
    border: 1px dashed #fca5a5;
    color: #b91c1c;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.hotspot-tooltip-image.error::before {
    content: 'Image failed to load';
}

/* Animation for hotspot entrance */
.hotspot-point.frontend-hotspot.animated {
    animation: hotspotEntrance 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes hotspotEntrance {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.15);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}