/* =================================================================
   WHALE RADAR WIDGET - Live Transaction Monitor
   ================================================================= */

/* --- WIDGET CONTAINER --- */
#whale-radar-widget {
    position: fixed;
    bottom: 50px;
    left: 30px;
    width: 260px;
    background: var(--color-surface-80);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    z-index: 9000;
    font-family: 'Inter', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

/* Minimized State */
#whale-radar-widget.minimized {
    display: none !important;
}

#whale-radar-widget.minimized .radar-scope,
#whale-radar-widget.minimized .radar-readout {
    display: none;
}


/* --- HEADER --- */
.radar-header-handle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--color-border);
    cursor: grab;
    user-select: none;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--color-text-light);
    text-transform: uppercase;
}

.radar-header-handle:active {
    cursor: grabbing;
}

.radar-header-handle .radar-status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--color-positive, #00e676);
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 8px var(--color-positive, #00e676);
    animation: radar-pulse 2s infinite;
}

/* Minimize Button */
#radar-minimize-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto !important;
}

#radar-minimize-btn:hover {
    background: rgba(255, 100, 100, 0.2);
    border-color: rgba(255, 100, 100, 0.4);
    color: #ff6b6b;
}


/* --- RADAR SCOPE (VISUALIZATION) --- */
.radar-scope {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 15px auto;
    border-radius: 50%;
    border: 2px solid rgba(0, 242, 254, 0.3);
    background: radial-gradient(circle, rgba(0, 242, 254, 0.05) 0%, transparent 70%);
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.radar-grid {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Use transparent radial gradient for circles */
    background: repeating-radial-gradient(transparent,
            transparent 29px,
            rgba(0, 242, 254, 0.2) 30px);
    pointer-events: none;
}

/* The Spinning Scanner */
.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    margin-top: -100%;
    margin-left: -100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
            transparent 0deg,
            rgba(0, 242, 254, 0.1) 60deg,
            var(--color-accent-cyan, #00f2fe) 90deg,
            transparent 91deg);
    animation: radar-spin 4s linear infinite;
    pointer-events: none;
    z-index: 2;
    transform-origin: center;
}

/* The "Blips" (Whales) */
.radar-blip {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px #fff, 0 0 20px var(--color-accent-cyan, #00f2fe);
    opacity: 0;
    animation: blip-fade 3s ease-out forwards;
    z-index: 100 !important;
    cursor: pointer;
}


/* --- READOUT (BOTTOM TEXT) --- */
.radar-readout {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    padding: 8px 8px;
    transition: background 0.2s;
    user-select: none;
    overflow: hidden;
}

.radar-readout-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--color-text-dim, #64748b);
    letter-spacing: 1.5px;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-family: 'Space Mono', monospace;
}

/* Feed container */
#radar-feed {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rf-status {
    font-size: 10px;
    font-family: 'Space Mono', monospace;
    color: var(--color-positive);
    text-align: center;
    padding: 4px 0;
    letter-spacing: 1px;
}

.radar-feed-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    padding: 3px 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid rgba(0, 242, 254, 0.2);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.radar-feed-item:hover {
    background: rgba(0, 242, 254, 0.06);
    border-left-color: rgba(0, 242, 254, 0.5);
}

.rf-badge {
    font-size: 8px;
    font-weight: 700;
    color: #f7931a;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.rf-amount {
    font-weight: 700;
    font-size: 9px;
    flex-shrink: 0;
}

.rf-usd {
    color: rgba(255, 255, 255, 0.35);
    font-size: 9px;
    flex-shrink: 0;
}

.rf-hash {
    color: rgba(0, 242, 254, 0.3);
    font-size: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rf-time {
    color: rgba(255, 255, 255, 0.2);
    font-size: 8px;
    flex-shrink: 0;
    white-space: nowrap;
    padding-left: 6px;
}


/* --- ANIMATIONS --- */
@keyframes radar-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes blip-fade {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.1);
    }
}

@keyframes radar-pulse {
    0% {
        opacity: 1;
        filter: brightness(1);
    }

    50% {
        opacity: 0.5;
        filter: brightness(0.7);
    }

    100% {
        opacity: 1;
        filter: brightness(1);
    }
}


/* --- LIGHT THEME SUPPORT --- */
body.theme-light #whale-radar-widget {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(14, 116, 144, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

body.theme-light .radar-header-handle {
    background: rgba(14, 116, 144, 0.1);
    color: #0e7490;
    border-bottom: 1px solid rgba(14, 116, 144, 0.2);
}

body.theme-light .radar-grid {
    border: 1px solid rgba(14, 116, 144, 0.1);
    background:
        linear-gradient(rgba(14, 116, 144, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 116, 144, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

body.theme-light .radar-readout {
    background: rgba(0, 0, 0, 0.05);
    border-top: 1px solid rgba(14, 116, 144, 0.2);
    color: #1e293b;
}

body.theme-light .radar-readout-label {
    color: #0e7490;
}

/* === MOBILE RESPONSIVENESS === */
@media (max-width: 768px) {
    #whale-radar-widget {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        bottom: 10px;
        border-radius: 12px;
    }

    #whale-radar-widget.minimized {
        width: auto;
        max-width: 160px;
    }
}