/* ========================================
   Sidebar Active Link Styles
   ======================================== */

/* Base nav-link styling */
.sidebar .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    margin: 4px 0;
    border-radius: 12px;
    transition: all 0.3s ease;
    color: #1f2937;
    font-weight: 600;
    font-size: 18px !important;
}

.sidebar .nav-link span {
    font-size: 18px !important;
    font-weight: 600;
    color: #1f2937;
}

/* Hover effect for nav-links */
.sidebar .nav-link:hover {
    background: linear-gradient(135deg, #04787A15 0%, #04787A08 100%);
    transform: translateX(-3px);
    border-radius: 12px;
}

/* Active state for nav-links */
.sidebar .nav-link.active,
.sidebar .sub-menu a.active,
.sidebar a.active {
    background: linear-gradient(135deg, #04787A 0%, #036466 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(4, 120, 122, 0.4) !important;
    transform: translateX(-3px);
    border-radius: 12px !important;
}

/* Active link border accent */
.sidebar .nav-link.active::before,
.sidebar .sub-menu a.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 70%;
    width: 5px;
    background: linear-gradient(to bottom, #10b981, #059669);
    border-radius: 10px;
}

/* Active link icon color */
.sidebar .nav-link.active svg,
.sidebar .sub-menu a.active svg,
.sidebar a.active svg {
    color: white !important;
    stroke: white !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Active link text color */
.sidebar .nav-link.active span,
.sidebar .sub-menu a.active span,
.sidebar a.active span {
    color: white !important;
    font-weight: 600;
}

.sidebar .nav-link.active .flex span,
.sidebar a.active .flex span {
    color: white !important;
}

/* Sub-menu link styling */
.sidebar .sub-menu a {
    position: relative;
    display: block;
    padding: 12px 20px 12px 50px;
    margin: 2px 0;
    border-radius: 10px;
    color: #374151;
    font-size: 17px !important;
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Sub-menu link hover */
.sidebar .sub-menu a:hover {
    background: #f3f4f6;
    color: #04787A;
    transform: translateX(-2px);
    border-radius: 10px;
}

/* Sub-menu active link */
.sidebar .sub-menu a.active {
    background: linear-gradient(135deg, #04787A 0%, #036466 100%) !important;
    color: white !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(4, 120, 122, 0.3);
    border-radius: 10px !important;
}

/* Sub-menu active link indicator */
.sidebar .sub-menu a.active::after {
    content: '';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* Parent menu item when child is active */
.sidebar .menu.has-active > .nav-link {
    background: linear-gradient(135deg, #04787A10 0%, #04787A05 100%);
    border-right: 3px solid #04787A;
}

/* Icon animation on active */
.sidebar .nav-link.active svg,
.sidebar a.active svg {
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

/* Icons styling */
.sidebar .nav-link svg,
.sidebar a svg {
    color: #374151;
    stroke: #374151;
}

/* Dark mode support */
.dark .sidebar .nav-link {
    color: #9ca3af;
    font-weight: 600;
}

.dark .sidebar .nav-link span {
    color: #9ca3af;
    font-weight: 600;
}

.dark .sidebar .nav-link:hover {
    background: linear-gradient(135deg, #04787A25 0%, #04787A15 100%);
}

.dark .sidebar .nav-link.active,
.dark .sidebar .sub-menu a.active,
.dark .sidebar a.active {
    background: linear-gradient(135deg, #04787A 0%, #036466 100%) !important;
    color: white !important;
}

.dark .sidebar .sub-menu a {
    color: #9ca3af;
}

.dark .sidebar .sub-menu a:hover {
    background: #1f2937;
    color: #10b981;
}

/* Smooth transitions for dropdown arrows */
.sidebar .nav-link svg:last-child {
    transition: transform 0.3s ease;
}

/* Badge styling for active items */
.sidebar .nav-link.active .badge,
.sidebar .sub-menu a.active .badge,
.sidebar a.active .badge {
    background: white !important;
    color: #04787A !important;
    font-weight: 700;
}

/* Badge/Count styling - specific classes used in sidebar */
.sidebar a.active .rounded-md.py-0\.5,
.sidebar a.active .rounded-md.py-1,
.sidebar a.active span.rounded-md,
.sidebar a.active div.rounded-md,
.sidebar a.active span[class*="rounded-md"],
.sidebar a.active div[class*="rounded-md"],
.sidebar a.active span[class*="ring-"],
.sidebar a.active div[class*="ring-"] {
    background: white !important;
    color: #04787A !important;
    border: 2px solid white !important;
    font-weight: 700 !important;
    box-shadow: 0 0 0 1px #04787A !important;
    border-radius: 8px !important;
}

/* More specific selectors for count badges */
.sidebar a.active span.text-red-700,
.sidebar a.active div.text-red-700,
.sidebar a.active span.bg-red-50,
.sidebar a.active div.bg-red-50 {
    background: white !important;
    color: #04787A !important;
    font-weight: 700 !important;
}

/* Enhanced visual feedback */
.sidebar .nav-item {
    position: relative;
}

/* Improved spacing and readability */
.sidebar .sub-menu {
    margin-top: 4px;
    margin-bottom: 8px;
}

/* Section headers enhancement */
.sidebar h2 {
    position: relative;
    overflow: hidden;
    font-size: 16px !important;
    font-weight: 800;
}

.sidebar h2 span {
    font-size: 16px !important;
    font-weight: 800;
    color: #111827;
}

/* Section header buttons (collapsible sections) */
.sidebar li.nav-item > button span {
    font-size: 16px !important;
    font-weight: 800;
}

.sidebar h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, #04787A, transparent);
    opacity: 0.3;
}

/* Additional specificity for active links */
.sidebar ul li a.active,
.sidebar .nav-item a.active {
    background: linear-gradient(135deg, #04787A 0%, #036466 100%) !important;
    color: white !important;
}

/* Smooth scrolling for sidebar - only styling, no overflow changes */
.sidebar .perfect-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.sidebar .perfect-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar .perfect-scrollbar::-webkit-scrollbar-thumb {
    background: #04787A40;
    border-radius: 10px;
    transition: background 0.3s ease;
}

.sidebar .perfect-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #04787A60;
}

/* Smooth scroll behavior for Firefox */
.sidebar .perfect-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #04787A40 transparent;
}

/* ========================================
   Section Headers as Collapsible Menus
   ======================================== */

/* Section header button styling */
.sidebar li.nav-item > button {
    text-align: right;
    cursor: pointer;
    user-select: none;
    outline: none;
}

.sidebar li.nav-item > button:hover {
    background: linear-gradient(135deg, #04787A 0%, #036466 100%) !important;
}

.sidebar li.nav-item > button:hover span,
.sidebar li.nav-item > button:hover svg {
    color: white !important;
    fill: currentColor;
}

/* Arrow icon rotation for sections */
.sidebar li.nav-item > button > div svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Section content wrapper */
.sidebar li.nav-item > ul {
    overflow: hidden;
}

/* Improved collapse animation */
[x-cloak] {
    display: none !important;
}
