/* Floating Navigation Styles - Circular Ring Design */
.floating-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    background: transparent;
    padding: 0;
    transition: all 0.3s ease;
}

.floating-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.floating-nav li {
    position: relative;
    /* Ensure tooltip positioning works correctly */
    overflow: visible;
}

.floating-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-decoration: none;
    background: rgba(229, 231, 235, 0.8);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    /* overflow: hidden; Removed to allow tooltip visibility */
}

.floating-nav a:hover {
    transform: scale(1.15);
    box-shadow: 0 8px 24px rgba(0, 71, 107, 0.3);
    border-color: #00476b;
    background: transparent;
    backdrop-filter: none;
}

.floating-nav a:hover::before {
    opacity: 1;
}

/* Gradient background effect - uses ::before */
.floating-nav a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -3;
    border-radius: 50%;
}

/* Enhanced hover effects with ripple animation - now uses ::before (gradient) */
.floating-nav a:hover::before {
    opacity: 1;
}

/* Ripple effect animation */
@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 0.5;
    }
    100% {
        width: 100px;
        height: 100px;
        opacity: 0;
    }
}

.floating-nav a:hover {
    animation: ripple 0.6s ease-out;
}

/* Pulse animation on hover */
.floating-nav a:hover {
    animation: pulse 2s infinite;
    border-color: #00476b;
}

@keyframes pulse {
    0% {
        box-shadow: 0 8px 24px rgba(0, 71, 107, 0.3);
    }
    50% {
        box-shadow: 0 8px 24px rgba(0, 71, 107, 0.6), 0 0 0 10px rgba(0, 71, 107, 0.1);
    }
    100% {
        box-shadow: 0 8px 24px rgba(0, 71, 107, 0.3);
    }
}

.floating-nav a:hover::before {
    opacity: 1;
}

.floating-nav a.active {
    background: transparent;
    border-color: #00476b;
    box-shadow: 0 6px 20px rgba(0, 71, 107, 0.4);
    transform: scale(1.1);
}

.floating-nav a.active::before {
    opacity: 1;
}

/* Icon styles */
.floating-nav a i {
    font-size: 20px;
    color: #6b7280;
    transition: all 0.3s ease;
    z-index: 1;
}

.floating-nav a:hover i {
    color: #00476b;
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(0, 71, 107, 0.3));
    animation: iconGlow 1.5s ease-in-out infinite alternate;
}

@keyframes iconGlow {
    from {
        filter: drop-shadow(0 0 8px rgba(0, 71, 107, 0.3));
    }
    to {
        filter: drop-shadow(0 0 12px rgba(0, 71, 107, 0.6)) drop-shadow(0 0 20px rgba(0, 71, 107, 0.4));
    }
}

.floating-nav a.active i {
    color: #00476b;
    text-shadow: 0 0 8px rgba(0, 71, 107, 0.3);
}

/* Tooltip styles */
/* Tooltip styles - Enhanced for better visibility */
.floating-nav a .tooltip {
    position: absolute;
    right: 55px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 71, 107, 0.95);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 71, 107, 0.3);
    z-index: 9999; /* Increased z-index to ensure visibility */
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none; /* Prevent tooltip from blocking interactions */
}

.floating-nav a .tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: rgba(0, 71, 107, 0.95);
}

/* Enhanced hover effect for tooltips */
.floating-nav a:hover .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
    animation: tooltipSlide 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto; /* Enable pointer events on hover */
}

@keyframes tooltipSlide {
    0% {
        opacity: 0;
        transform: translateY(-50%) translateX(-10px);
    }
    60% {
        opacity: 1;
        transform: translateY(-50%) translateX(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* Floating Nav Toggle Button - Circular Design */
.floating-nav-toggle {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    background: rgba(59, 130, 246, 0.9);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
}

.floating-nav-toggle:hover {
    background: rgba(59, 130, 246, 1);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    animation: buttonPulse 1.5s infinite;
}

@keyframes buttonPulse {
    0% {
        box-shadow: 0 8px 24px rgba(0, 71, 107, 0.4);
    }
    50% {
        box-shadow: 0 8px 24px rgba(0, 71, 107, 0.6), 0 0 0 8px rgba(0, 71, 107, 0.2);
    }
    100% {
        box-shadow: 0 8px 24px rgba(0, 71, 107, 0.4);
    }
}

/* Floating Nav Toggle Button */
.floating-nav-toggle {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    background: rgba(0, 71, 107, 0.9);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 71, 107, 0.2);
    transition: all 0.3s ease;
    display: none;
}

.floating-nav-toggle:hover {
    background: rgba(0, 71, 107, 1);
    transform: translateY(-50%) scale(1.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .floating-nav {
        right: -280px;
        top: 0;
        transform: none;
        height: 100vh;
        width: 280px;
        border-radius: 0;
        padding: 24px 16px;
        transition: right 0.3s ease;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
    }
    
    .floating-nav.active {
        right: 0;
    }
    
    .floating-nav ul {
        gap: 16px;
        align-items: flex-start;
    }
    
    .floating-nav a {
        width: auto;
        height: auto;
        padding: 12px 16px;
        border-radius: 8px;
        background: rgba(229, 231, 235, 0.6);
        border: 1px solid rgba(255, 255, 255, 0.3);
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 14px;
        font-weight: 500;
        color: #374151;
    }
    
    .floating-nav a:hover {
        transform: translateX(4px);
        background: transparent;
        color: #00476b;
        box-shadow: 0 2px 8px rgba(0, 71, 107, 0.3);
        border-color: #00476b;
        position: relative;
        overflow: hidden;
    }
    
    .floating-nav a:hover::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
        transition: left 0.6s ease;
    }
    
    .floating-nav a:hover::before {
        left: 100%;
    }
    
    .floating-nav a.active {
        background: transparent;
        color: #00476b;
        transform: translateX(4px);
        border-color: #00476b;
    }
    
    .floating-nav a i {
        font-size: 16px;
    }
    
    .floating-nav a::after {
        display: none;
    }
    
    .floating-nav-toggle {
        display: block;
    }
    
    /* Mobile navigation text styles */
    .floating-nav a .nav-text {
        margin-left: 12px;
        font-size: 14px;
        font-weight: 500;
        color: inherit;
        transition: all 0.3s ease;
    }
    
    /* Mobile active state */
    .floating-nav a.active .nav-text {
        color: #00476b;
        font-weight: 600;
    }
    
    /* Mobile active state with border only */
    .floating-nav a.active {
        background: transparent;
        border-color: #00476b;
        color: #00476b;
    }
    
    /* Hide tooltips on mobile to prevent text overlap */
    .floating-nav a .tooltip {
        display: none !important;
    }
}

/* Desktop: ensure tooltips are visible */
@media (min-width: 769px) {
    .floating-nav a .tooltip {
        display: block !important;
    }
}

/* Smooth scrolling for the entire page */
html {
    scroll-behavior: smooth;
}

/* Section spacing for better navigation experience */
section {
    scroll-margin-top: 80px;
}

/* Hide floating nav on very small screens */
@media (max-width: 480px) {
    .floating-nav {
        width: 240px;
        right: -240px;
    }
}

/* Pulse animation for active state */
@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

/* Desktop-specific pulse animation - ensures perfect center alignment */
.floating-nav a.active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.3);
    animation: pulse-ring 2s infinite;
    z-index: -2;
    will-change: transform, opacity;
}

/* Mobile-specific pulse animation fix */
@media (max-width: 768px) {
    /* Fix for pulse animation ellipse issue on mobile */
    .floating-nav a.active::after {
        width: 40px;  /* Fixed width to prevent ellipse */
        height: 40px; /* Fixed height to maintain circle */
        border-radius: 50%;
        transform: translate(-50%, -50%) scale(1);
        -webkit-transform: translate(-50%, -50%) scale(1);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        will-change: transform, opacity;
    }
    
    /* Mobile-optimized pulse animation with better transform handling */
    @keyframes pulse-ring-mobile {
        0% {
            transform: translate(-50%, -50%) scale(1);
            opacity: 1;
        }
        100% {
            transform: translate(-50%, -50%) scale(1.3);
            opacity: 0;
        }
    }
    
    /* Apply mobile-specific animation */
    .floating-nav a.active::after {
        animation: pulse-ring-mobile 2s infinite;
    }
    
    /* Ensure mobile navigation buttons maintain circular shape */
    .floating-nav a {
        position: relative;
        overflow: visible; /* Prevent clipping of pulse effect */
        will-change: transform;
        transform: translateZ(0); /* Enable hardware acceleration */
    }
    
    /* Additional fix for very small screens */
    .floating-nav a.active {
        transform: translateX(4px) translateZ(0);
        -webkit-transform: translateX(4px) translateZ(0);
    }
}

/* iOS-specific fixes for pulse animation */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .floating-nav a.active::after {
            -webkit-transform: translate(-50%, -50%) scale(1);
            transform: translate(-50%, -50%) scale(1);
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
        }
        
        @keyframes pulse-ring-ios {
            0% {
                -webkit-transform: translate(-50%, -50%) scale(1);
                transform: translate(-50%, -50%) scale(1);
                opacity: 1;
            }
            100% {
                -webkit-transform: translate(-50%, -50%) scale(1.3);
                transform: translate(-50%, -50%) scale(1.3);
                opacity: 0;
            }
        }
        
        .floating-nav a.active::after {
            animation: pulse-ring-ios 2s infinite;
        }
    }
}

/* Entrance animation */
.floating-nav {
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateY(-50%) translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateY(-50%) translateX(0);
        opacity: 1;
    }
}

/* Hover ripple effect */
.floating-nav a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    z-index: -1;
}

.floating-nav a:hover::before {
    width: 100%;
    height: 100%;
}