/**
 * Cross-App Links - Solid Dock Style
 * RAM Apps dock with robust magnification effect.
 *
 * @since 2.1.0
 * @see WI #184
 */

/* ==========================================================================
   Float Animation
   ========================================================================== */

@keyframes livePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

/* ==========================================================================
   Dock Container
   ========================================================================== */

.cross-app-links {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 2px 24px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Dock Items - Solid App Icons
   ========================================================================== */

.cross-app-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
    color: #c4c4c4;
    font-size: 10px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.15s ease-out;
    transform-origin: bottom center;
    gap: 5px;
    animation: float 3s ease-in-out infinite;
}

/* Staggered float delays */
.cross-app-link:nth-child(1) { animation-delay: 0s; }
.cross-app-link:nth-child(2) { animation-delay: 0.2s; }
.cross-app-link:nth-child(3) { animation-delay: 0.4s; }
.cross-app-link:nth-child(4) { animation-delay: 0.6s; }
.cross-app-link:nth-child(5) { animation-delay: 0.8s; }
.cross-app-link:nth-child(6) { animation-delay: 1s; }

/* Stop float on hover - dock effect takes over */
.cross-app-links:hover .cross-app-link {
    animation: none;
}

/* ==========================================================================
   Icons - Solid and Visible
   ========================================================================== */

.cross-app-link svg {
    width: 26px;
    height: 26px;
    transition: all 0.15s ease-out;
}

/* Live indicator dot */
.cross-app-link-live {
    position: relative;
}

.cross-app-link-live::before {
    content: '';
    position: absolute;
    top: 2px;
    right: 8px;
    width: 6px;
    height: 6px;
    background: #ef4444;
    border-radius: 50%;
    animation: livePulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.8);
}

/* TV icon - dot in screen area */
.cross-app-link-live-tv::before {
    right: 4px;
    top: 4px;
}

.cross-app-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3b82f6;
    transition: all 0.15s ease-out;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.7),
                0 0 16px rgba(59, 130, 246, 0.4);
}

/* ==========================================================================
   Labels
   ========================================================================== */

.cross-app-link span {
    white-space: nowrap;
    font-size: 9px;
    opacity: 1;
    transition: all 0.15s ease-out;
}

/* ==========================================================================
   Dock Magnification - Robust Effect
   ========================================================================== */

/* Hovered item */
.cross-app-link:hover {
    transform: translateY(-10px) scale(1.3);
    color: #3b82f6;
    text-decoration: none;
    z-index: 10;
}

.cross-app-link:hover svg {
    color: #3b82f6;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.9))
            drop-shadow(0 0 16px rgba(59, 130, 246, 0.5));
}

.cross-app-link:hover .cross-app-avatar {
    border-color: #3b82f6;
    box-shadow:
        0 0 12px rgba(59, 130, 246, 0.8),
        0 0 20px rgba(59, 130, 246, 0.4);
}

.cross-app-link:hover span {
    opacity: 1;
    color: #3b82f6;
}

/* Adjacent items */
.cross-app-link:has(+ .cross-app-link:hover),
.cross-app-link:hover + .cross-app-link {
    transform: translateY(-5px) scale(1.15);
    z-index: 5;
}

/* Second adjacent */
.cross-app-link:has(+ .cross-app-link + .cross-app-link:hover),
.cross-app-link:hover + .cross-app-link + .cross-app-link {
    transform: translateY(-2px) scale(1.08);
}

/* ==========================================================================
   Active State
   ========================================================================== */

.cross-app-link:active {
    transform: translateY(-8px) scale(1.25);
    transition: all 0.05s ease-out;
}

/* ==========================================================================
   Responsive - Tablet
   ========================================================================== */

@media (max-width: 768px) {
    .cross-app-links {
        gap: 4px;
        padding: 2px 8px 0;
    }

    .cross-app-link {
        padding: 4px;
    }

    .cross-app-link svg,
    .cross-app-avatar {
        width: 22px;
        height: 22px;
    }

    .cross-app-link span {
        font-size: 8px;
    }

    .cross-app-link:hover {
        transform: translateY(-10px) scale(1.4);
    }

    .cross-app-link:has(+ .cross-app-link:hover),
    .cross-app-link:hover + .cross-app-link {
        transform: translateY(-5px) scale(1.2);
    }
}

/* ==========================================================================
   Responsive - Mobile
   ========================================================================== */

@media (max-width: 480px) {
    .cross-app-links {
        gap: 3px;
        padding: 2px 6px 0;
        justify-content: space-between;
    }

    .cross-app-link {
        padding: 4px;
        gap: 4px;
    }

    .cross-app-link svg,
    .cross-app-avatar {
        width: 20px;
        height: 20px;
    }

    .cross-app-link span {
        font-size: 7px;
    }

    .cross-app-link:hover {
        transform: translateY(-8px) scale(1.35);
    }

    .cross-app-link:has(+ .cross-app-link:hover),
    .cross-app-link:hover + .cross-app-link {
        transform: translateY(-4px) scale(1.15);
    }

    .cross-app-link:has(+ .cross-app-link + .cross-app-link:hover),
    .cross-app-link:hover + .cross-app-link + .cross-app-link {
        transform: translateY(-2px) scale(1.05);
    }
}

/* ==========================================================================
   Fallback for browsers without :has()
   ========================================================================== */

@supports not selector(:has(*)) {
    .cross-app-link:hover + .cross-app-link {
        transform: translateY(-5px) scale(1.15);
    }

    .cross-app-link:hover + .cross-app-link + .cross-app-link {
        transform: translateY(-2px) scale(1.08);
    }
}
