/* =====================================================
   SONAR PING - Pixel Art Data Lab Radar
   Fixed position radar that links to Data Gallery
   ===================================================== */

.sonar-container {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 900;
    cursor: pointer;
    transition: transform 0.3s ease;
    transform: scale(1.3);
    transform-origin: bottom right;
}

.sonar-container * {
    cursor: pointer;
}

.sonar-container:hover {
    transform: scale(1.35);
}

.sonar-container:hover .sonar-glow {
    opacity: 1;
}

/* Pixel art frame around the sonar */
.sonar-frame {
    position: relative;
    background: linear-gradient(180deg, #2a2a3a 0%, #1a1a2a 100%);
    border: 4px solid #3a3a4a;
    border-radius: 8px;
    padding: 8px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}

/* Corner rivets - pixel style */
.sonar-frame::before,
.sonar-frame::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: #4a4a5a;
    border-radius: 50%;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.3);
}

.sonar-frame::before {
    top: 6px;
    left: 6px;
}

.sonar-frame::after {
    top: 6px;
    right: 6px;
}

/* The radar canvas */
.sonar-canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border-radius: 50%;
    box-shadow:
        0 0 10px rgba(0, 255, 136, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Glow effect on hover */
.sonar-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(0, 255, 136, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* Blinking indicator lights */
.sonar-lights {
    display: flex;
    justify-content: space-between;
    padding: 6px 4px 2px 4px;
}

.sonar-light {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #333;
    box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.sonar-light.active {
    animation: blink 1s ease-in-out infinite;
}

.sonar-light.red { background: #ff4444; box-shadow: 0 0 4px #ff4444; }
.sonar-light.green { background: #44ff88; box-shadow: 0 0 4px #44ff88; }
.sonar-light.blue { background: #4488ff; box-shadow: 0 0 4px #4488ff; }
.sonar-light.yellow { background: #ffcc44; box-shadow: 0 0 4px #ffcc44; }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.sonar-light.red.active { animation-delay: 0s; }
.sonar-light.green.active { animation-delay: 0.25s; }
.sonar-light.blue.active { animation-delay: 0.5s; }
.sonar-light.yellow.active { animation-delay: 0.75s; }

/* Label under the sonar */
.sonar-label {
    text-align: center;
    margin-top: 8px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 7px;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.5);
}

.sonar-label-sub {
    font-size: 5px;
    color: #66aa88;
    margin-top: 2px;
    opacity: 0.8;
}

/* Pulse ring animation when data is "detected" */
.sonar-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border: 2px solid rgba(0, 255, 136, 0.5);
    border-radius: 50%;
    animation: pulse-ring 2s ease-out infinite;
    pointer-events: none;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Click hint */
.sonar-hint {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #00ff88;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sonar-container:hover .sonar-hint {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .sonar-container {
        bottom: 80px;
        right: 15px;
        transform: scale(0.85);
    }

    .sonar-container:hover {
        transform: scale(0.9);
    }
}

@media (max-width: 480px) {
    .sonar-container {
        bottom: 70px;
        right: 10px;
        transform: scale(0.6);
    }

    .sonar-container:hover {
        transform: scale(0.65);
    }
}
