/* Enhanced Menu Animations and Bootstrap Features */

/* Animate.css Integration */
@import url('https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css');

/* Menu Item Entrance Animations */
.menu-item {
    animation: fadeInUp 0.5s ease-out;
}

.menu-item:nth-child(1) { animation-delay: 0.1s; }
.menu-item:nth-child(2) { animation-delay: 0.2s; }
.menu-item:nth-child(3) { animation-delay: 0.3s; }
.menu-item:nth-child(4) { animation-delay: 0.4s; }
.menu-item:nth-child(5) { animation-delay: 0.5s; }
.menu-item:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Menu Link Hover Effects */
.menu-link {
    position: relative;
    overflow: hidden;
}

.menu-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.menu-link:hover::before {
    left: 100%;
}

/* Badge Pulse Animation */
.badge.animate__pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Menu Toggle Arrow Rotation */
.menu-toggle::after {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item.open .menu-toggle::after {
    transform: translateY(-50%) rotate(90deg);
}

/* Sub Menu Slide Animation */
.menu-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.menu-item.open .menu-sub {
    max-height: 500px;
    transition: max-height 0.3s ease-in;
}

/* Menu Search Focus Animation */
.menu-search-container .form-control:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Loading Spinner for Menu Items */
.menu-item.loading .menu-link::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Menu Header Animation */
.menu-header {
    animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Menu Divider Animation */
.menu-divider {
    animation: expandWidth 0.8s ease-out;
}

@keyframes expandWidth {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Responsive Menu Animations */
@media (max-width: 1199.98px) {
    .menu-item {
        animation-duration: 0.3s;
    }
    
    .menu-item:nth-child(n) {
        animation-delay: 0s;
    }
}

@media (max-width: 767.98px) {
    .menu-item {
        animation: fadeIn 0.3s ease-out;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* Dark Theme Animations */
[data-bs-theme="dark"] .menu-link::before {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
}

[data-bs-theme="dark"] .menu-search-container .form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Menu Item Active State Animation */
.menu-item.active .menu-link {
    animation: activePulse 2s infinite;
}

@keyframes activePulse {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    50% {
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
}

/* Tooltip Animation Enhancement */
.tooltip {
    animation: tooltipFadeIn 0.3s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Menu Search Results Animation */
.menu-item.search-highlight {
    animation: highlightPulse 1s ease-out;
}

@keyframes highlightPulse {
    0% {
        background: rgba(255,193,7,0.2);
    }
    50% {
        background: rgba(255,193,7,0.4);
    }
    100% {
        background: rgba(255,193,7,0.2);
    }
}

/* Menu Collapse Animation */
.layout-menu-collapsed .menu-item .menu-link {
    transition: all 0.3s ease;
}

.layout-menu-collapsed .menu-item .menu-link:hover {
    transform: translateX(0);
}

/* Menu Brand Animation */
.app-brand-link {
    transition: all 0.3s ease;
}

.app-brand-link:hover {
    transform: scale(1.05);
}

/* Menu Icon Animation */
.menu-icon {
    transition: all 0.3s ease;
}

.menu-link:hover .menu-icon {
    transform: scale(1.1);
    color: var(--bs-primary);
}

/* Menu Badge Hover Effect */
.menu-item .badge:hover {
    animation: badgeBounce 0.5s ease;
}

@keyframes badgeBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-3px);
    }
    60% {
        transform: translateY(-2px);
    }
}
