/* Interactive Image Hotspots - Frontend Styles */

.iih-interactive-image-container {
    margin: 20px auto;
    text-align: center;
}

.iih-interactive-image {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.iih-interactive-image:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.iih-background-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Hotspot points */
.iih-hotspot {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.iih-hotspot:hover,
.iih-hotspot.active {
    z-index: 12000;
}

.iih-hotspot-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #dc3545;
    font-size: 20px;
    box-shadow: 0 3px 12px rgba(220, 53, 69, 0.3);
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.iih-hotspot:hover .iih-hotspot-icon {
    transform: scale(1.1);
    background: #dc3545;
    color: white;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
    animation: none;
}

/* Pulse animation */
@keyframes pulse {
    0% {
        box-shadow: 0 3px 12px rgba(220, 53, 69, 0.3), 0 0 0 0 rgba(220, 53, 69, 0.4);
    }
    70% {
        box-shadow: 0 3px 12px rgba(220, 53, 69, 0.3), 0 0 0 15px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 3px 12px rgba(220, 53, 69, 0.3), 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Modal Popup for Mobile/Tablet */
.iih-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.iih-modal.active {
    display: flex;
}

.iih-modal-content {
    background: #ffebee;
    border-radius: 12px;
    padding: 20px;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

.iih-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #dc3545;
    line-height: 1;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.iih-modal-close:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Desktop tooltip - card style next to dot */
@media (min-width: 1025px) {
    .iih-tooltip {
        position: absolute;
        display: none;
        z-index: 11000;
        background: #ffebee;
        border-radius: 12px;
        padding: 16px;
        min-width: 280px;
        max-width: 320px;
        box-shadow: 0 8px 32px rgba(220, 53, 69, 0.15);
        border: 1px solid rgba(220, 53, 69, 0.1);
        animation: tooltipFadeIn 0.3s ease-out;
        opacity: 0;
        transition: opacity 0.2s ease, visibility 0.2s ease;
        visibility: hidden;
    }
    
    /* Show tooltip on hover or active (clicked) */
    .iih-hotspot:hover .iih-tooltip,
    .iih-hotspot.active .iih-tooltip,
    .iih-hotspot.hover-active .iih-tooltip {
        display: block !important;
        opacity: 1;
        visibility: visible;
    }
    
    /* Keep tooltip visible when hovering over it */
    .iih-tooltip:hover {
        display: block !important;
        opacity: 1;
        visibility: visible;
    }
    
    /* Active state styling for clicked hotspots */
    .iih-hotspot.active .iih-hotspot-icon {
        background: #dc3545;
        color: white;
        transform: scale(1.1);
        box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
        animation: none;
    }
    
    /* Arrow styles for different positions */
    .iih-tooltip-arrow {
        position: absolute;
        width: 0;
        height: 0;
        border: 8px solid transparent;
        z-index: 11001;
    }

    /* Right side tooltip - arrow on left */
    .iih-hotspot.tooltip-right .iih-tooltip-arrow {
        display: none;
        left: -16px;
        top: 50%;
        transform: translateY(-50%);
        border-right-color: #ffebee;
    }
    
    /* Left side tooltip - arrow on right */
    .iih-hotspot.tooltip-left .iih-tooltip-arrow {
        right: -16px;
        top: 50%;
        transform: translateY(-50%);
        border-left-color: #ffebee;
    }
}

/* Mobile and Tablet - hide tooltips, show modal */
@media (max-width: 1024px) {
    .iih-tooltip {
        display: none !important;
    }
    
    .iih-hotspot:hover .iih-tooltip,
    .iih-hotspot.active .iih-tooltip {
        display: none !important;
    }
}

/* Modal for Mobile and Tablet */
@media (max-width: 1024px) {
    .iih-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.7);
        z-index: 999999;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        padding: 20px;
    }

    .iih-modal.active {
        opacity: 1;
        visibility: visible;
    }

    .iih-modal-content {
        background: #ffebee;
        border-radius: 12px;
        padding: 24px;
        position: relative;
        max-width: 90%;
        width: 100%;
        max-width: 400px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        transform: translateY(20px);
        transition: transform 0.3s ease;
    }

    .iih-modal.active .iih-modal-content {
        transform: translateY(0);
    }
}

/* Hide modal on desktop */
@media (min-width: 1025px) {
    .iih-modal {
        display: none !important;
    }
}

.iih-tooltip-content {
    position: relative;
    text-align: left;
}

.iih-tooltip-title {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #dc3545;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
}

.iih-tooltip-title::before {
    content: "📍";
    font-size: 16px;
}

.iih-tooltip-address,
.iih-tooltip-phone {
    margin: 10px 0;
    background: white;
    padding: 8px 12px !important;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.iih-label {
    font-weight: 600;
    color: #dc3545;
    display: block;
    font-size: 12px;
}

.iih-tooltip-address p,
.iih-tooltip-phone p {
    margin: 0;
    color: #333;
    font-size: 13px;
    line-height: 1.4;
}

.iih-tooltip-phone a {
    color: #333;
    text-decoration: none;
}

.iih-tooltip-address {
    margin-bottom: 12px;
}

.iih-label {
    font-weight: 600;
    color: #333;
    display: inline;
    margin-right: 4px;
}

.iih-tooltip-phone a {
    text-decoration: none;
    font-weight: normal;
}

.iih-tooltip-phone a:hover {
    text-decoration: underline;
}

/* Tooltip Actions */
.iih-tooltip-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    pointer-events: auto;
}

.iih-tooltip-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: white;
    color: #333;
    text-align: center;
    min-height: 40px;
    cursor: pointer;
    border: 1px solid #ddd;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.iih-tooltip-btn:hover {
    background: #dc3545;
    color: #333;
    text-decoration: none;
    border-color: #dc3545;
}

.iih-maps-btn {
    background: white;
    color: #333;
}

.iih-maps-btn:hover {
    background: #dc3545;
    color: #333;
}

.iih-call-btn {
    background: white;
    color: #333;
}

.iih-call-btn:hover {
    background: #dc3545;
    color: #333;
}

.iih-tooltip-btn span {
    font-size: 13px;
    font-weight: 500;
}

/* Tooltip arrow */
.iih-tooltip-arrow {
    display: none;
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #ffebee;
    filter: drop-shadow(-2px 0 2px rgba(0, 0, 0, 0.1));
}

/* Tooltip positioning based on hotspot location */
.iih-hotspot.tooltip-right .iih-tooltip {
    left: -320px;
    right: auto;
}

.iih-hotspot.tooltip-right .iih-tooltip-arrow {
    display: none;
    left: auto;
    right: -8px;
    border-right: none;
    border-left: 8px solid white;
    filter: drop-shadow(2px 0 2px rgba(0, 0, 0, 0.1));
}

.iih-hotspot.tooltip-top .iih-tooltip {
    top: auto;
    bottom: 50px;
}

.iih-hotspot.tooltip-bottom .iih-tooltip {
    top: 50px;
    bottom: auto;
}

/* Tablet specific styles */
.device-tablet .iih-hotspot-icon {
    width: 38px;
    height: 38px;
    font-size: 17px;
    border-width: 2px;
}

/* Mobile specific styles */
.device-mobile .iih-hotspot-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
    border-width: 2px;
}

/* No hotspots message */
.iih-no-hotspots {
    text-align: center;
    color: #646970;
    font-style: italic;
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Modal popup for mobile/tablet */
.iih-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.iih-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.iih-modal-content {
    background: #ffebee;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    position: relative;
}

.iih-modal-overlay.active .iih-modal-content {
    transform: scale(1) translateY(0);
}

.iih-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f6f8fa;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #586069;
    transition: all 0.2s ease;
}

.iih-modal-close:hover {
    background: #e1e4e8;
    color: #24292e;
}

/* Modal versions of tooltip content */
.iih-modal-title {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #24292e;
    line-height: 1.3;
    padding-right: 40px;
}

.iih-modal-address,
.iih-modal-phone {
    margin: 12px 0;
    font-size: 15px;
    line-height: 1.4;
    color: #586069;
}

.iih-modal-address {
    margin-bottom: 16px;
}

.iih-modal-label {
    font-weight: 600;
    color: #24292e;
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
}

.iih-modal-phone a {
    color: #0366d6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.iih-modal-phone a:hover {
    color: #0254b8;
    text-decoration: underline;
}

.iih-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e1e4e8;
}

.iih-modal-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 44px;
    cursor: pointer;
    border: none;
}

.iih-modal-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-decoration: none;
}

.iih-modal-maps-btn {
    background: #0366d6;
    color: white;
}

.iih-modal-maps-btn:hover {
    background: #0254b8;
    color: white;
}

.iih-modal-call-btn {
    background: #28a745;
    color: white;
}

.iih-modal-call-btn:hover {
    background: #228c3a;
    color: white;
}

/* Responsive design */
@media (max-width: 768px) {
    .iih-interactive-image-container {
        margin: 15px auto;
        padding: 0 10px;
    }
    
    .iih-interactive-image {
        max-width: 100%;
    }
    
    .iih-hotspot-icon {
        width: 35px;
        height: 35px;
        font-size: 18px;
        border-width: 2px;
    }
    
    /* Hide tooltip on mobile, use modal instead */
    .iih-tooltip {
        display: none !important;
    }
    
    .iih-hotspot:hover .iih-tooltip {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .iih-hotspot-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* Loading animation */
.iih-loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .iih-hotspot-icon {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }
    
    .iih-tooltip {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    }
}

/* Accessibility improvements */
.iih-hotspot:focus {
    outline: none;
}

.iih-hotspot:focus .iih-hotspot-icon {
    transform: scale(1.15);
    background: #2271b1;
    color: white;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.3);
}

.iih-hotspot:focus .iih-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .iih-hotspot-icon {
        animation: none;
        transition: none;
    }
    
    .iih-tooltip {
        transition: none;
    }
    
    .iih-hotspot:hover .iih-hotspot-icon {
        transition: none;
    }
}