/* frontend.css - Exact Backend Structure */

.hotspot-container {
    position: relative;
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 8px;
    max-width: 100%;
    margin: 20px 0;
}

.hotspot-search {
    position: relative;
    margin-bottom: 15px;
    z-index: 100;
}

.hotspot-search-input {
    width: 100%;
    max-width: 300px;
    padding: 12px 40px 12px 15px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.hotspot-search-input:focus {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0,123,255,0.2);
    outline: none;
}

.hotspot-search-input::placeholder {
    color: #999;
    font-style: italic;
}

/* Search icon */
.hotspot-search::before {
    content: '🔍';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none;
    opacity: 0.6;
    z-index: 10;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.search-result-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    color: #333;
}

.search-result-item:hover,
.search-result-item.keyboard-active {
    background: #f5f5f5;
}

.hotspot-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100;
    color: #333;
}

.hotspot-info {
    color: #ccc;
    font-size: 12px;
    margin-bottom: 10px;
    text-align: center;
}

/* OPTIMIZED FRONTEND STRUCTURE - Responsive Image Display */
.hotspot-image-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.image-workspace {
    position: relative;
    width: 100%;
    height: 85vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Optimized workspace-container for desktop and mobile - Fixed scrolling */
.workspace-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    cursor: grab;
    display: block; /* Changed from flex to avoid centering issues */
}

.workspace-container:active {
    cursor: grabbing;
}

/* Fixed workspace-image for desktop - proper scrolling from left edge */
.workspace-image {
    display: block;
    height: 100%;
    width: auto;
    max-width: none;
    position: relative;
    vertical-align: top;
    object-fit: contain;
    /* Ensure image starts from left edge for proper scrolling */
    margin: 0;
    padding: 0;
}

/* Hide the data elements */
.hotspot-marker-data {
    display: none !important;
}

/* HOTSPOT MARKERS - Hidden by default, only show when searched */
.hotspot-marker {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #dc3545;
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    z-index: 50;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Show hotspots when highlighted (from search) - Black and static */
.hotspot-marker.highlighted {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: #000000; /* Changed to black */
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6); /* Darker shadow for black */
    z-index: 60;
    /* Removed pulsing animation */
}

/* Show hotspots when active (clicked from search) - Blue remains */
.hotspot-marker.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: #007bff;
    transform: translate(-50%, -50%) scale(1.3);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.8);
    z-index: 70;
}

/* Hover effects only for visible hotspots - Black theme */
.hotspot-marker.highlighted:hover,
.hotspot-marker.active:hover {
    transform: translate(-50%, -50%) scale(1.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8); /* Darker shadow for better contrast */
}

/* Tooltip only shows for visible hotspots */
.hotspot-marker.highlighted .hotspot-tooltip,
.hotspot-marker.active .hotspot-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
    pointer-events: auto;
}

.hotspot-marker.highlighted:hover .hotspot-tooltip,
.hotspot-marker.active:hover .hotspot-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

/* Tooltip styling - enhanced for black hotspots */
.hotspot-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    min-width: 150px;
    max-width: 250px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    z-index: 100;
    pointer-events: none;
    border: 2px solid #000; /* Stronger border for better contrast with black hotspots */
}

.hotspot-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: white; /* Keep white to match tooltip background */
}

/* Show tooltip on hover/active for visible hotspots only */
.hotspot-marker.highlighted:hover .hotspot-tooltip,
.hotspot-marker.active:hover .hotspot-tooltip,
.hotspot-marker.active .hotspot-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

.hotspot-tooltip h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    line-height: 1.3;
}

.hotspot-tooltip p {
    margin: 0;
    font-size: 12px;
    color: #666;
    white-space: normal;
    line-height: 1.4;
}

/* Tooltip edge positioning */
.hotspot-marker[data-position*="top"] .hotspot-tooltip {
    top: calc(100% + 12px);
    bottom: auto;
}

.hotspot-marker[data-position*="top"] .hotspot-tooltip::after {
    top: -8px;
    border-top-color: transparent;
    border-bottom-color: white;
}

.hotspot-marker[data-position*="left"] .hotspot-tooltip {
    left: calc(100% + 12px);
    transform: translateY(-50%);
}

.hotspot-marker[data-position*="left"] .hotspot-tooltip::after {
    top: 50%;
    left: -8px;
    transform: translateY(-50%);
    border-left-color: transparent;
    border-right-color: white;
    border-top-color: transparent;
}

.hotspot-marker[data-position*="right"] .hotspot-tooltip {
    right: calc(100% + 12px);
    left: auto;
    transform: translateY(-50%);
}

.hotspot-marker[data-position*="right"] .hotspot-tooltip::after {
    top: 50%;
    right: -8px;
    left: auto;
    transform: translateY(-50%);
    border-right-color: transparent;
    border-left-color: white;
    border-top-color: transparent;
}

/* Scrollbar styling - sleeker design */
.workspace-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.workspace-container::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.workspace-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.workspace-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

/* Scroll indicators - improved visibility */
.scroll-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    z-index: 60;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.scroll-indicator.scroll-left {
    left: 15px;
}

.scroll-indicator.scroll-right {
    right: 15px;
}

.scroll-indicator:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
    border-color: #fff;
}

/* Desktop specific adjustments - fixed scrolling */
@media (min-width: 769px) {
    .image-workspace {
        height: 85vh;
    }
    
    .workspace-container {
        justify-content: flex-start; /* Always start from left, not center */
        align-items: flex-start; /* Start from top */
        padding: 0; /* Remove any padding that might offset */
    }
    
    .workspace-image {
        height: 100%;
        width: auto;
        max-height: 100%;
        object-fit: contain;
        display: block;
        /* Ensure no margin/padding pushes image away from edges */
        margin: 0;
        padding: 0;
    }
}

/* Mobile and tablet adjustments - FIXED */
@media (max-width: 768px) {
    .hotspot-container {
        padding: 10px;
        margin: 10px 0;
    }
    
    .image-workspace {
        height: 80vh; /* Increased height for mobile */
    }
    
    .workspace-container {
        display: block; /* Changed from flex to block */
        overflow-x: auto;
        overflow-y: hidden;
        height: 100vh;
    }
    
    .workspace-image {
        height: auto;
        max-width: none;
        max-height: 100vh; /* Remove max-height restriction */
        object-fit: cover; /* Changed to cover for better mobile display */
        display: block;
        margin: 0;
        padding: 0;
    }
    
    .hotspot-marker {
        width: 20px;
        height: 20px;
        border-width: 2px;
    }
    
    .hotspot-tooltip {
        min-width: 120px;
        max-width: 200px;
        padding: 10px 12px;
    }
    
    .hotspot-tooltip h4 {
        font-size: 13px;
    }
    
    .hotspot-tooltip p {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .hotspot-container {
        padding: 5px; /* Reduced padding for smaller screens */
        margin: 5px 0;
    }
    
    .image-workspace {
        height: 85vh; /* Even more height on very small screens */
    }
    
    .workspace-image {
        width: auto!important;
        height: 100vh!important;
        object-fit: cover;
    }
    
    .hotspot-tooltip {
        min-width: 100px;
        max-width: 180px;
        padding: 8px 10px;
    }
    
    .hotspot-search-input {
        font-size: 16px; /* Prevents zoom on iOS */
        max-width: calc(100vw - 40px); /* Ensure it doesn't overflow */
    }
}