/* Navigation styles */
.main-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* Three columns: logo, menu, CTA button */
    align-items: center;
    padding: 12px 40px;
    position: relative;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.08);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    margin: 0 20px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    overflow: visible; /* Changed from hidden to visible */
    min-height: 65px; /* Ensure consistent height */
}

.main-nav::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 70%);
    opacity: 0.4;
    animation: shimmer 8s infinite linear;
    pointer-events: none;
    z-index: -1;
}

@keyframes shimmer {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.nav-logo {
    height: 40px;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    grid-column: 1;
    justify-self: start;
}

.nav-logo:hover {
    transform: scale(1.02);
}

.nav-logo img {
    height: 100%;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 20px;
    margin: 0; /* Changed from auto to 0 */
    padding: 0;
    align-items: center;
    min-height: 40px; /* Changed from fixed height to minimum height */
    position: relative; /* Needed for dropdown positioning */
    justify-content: center; /* This centers the items horizontally */
    width: 100%; /* Ensure full width for proper centering */
    grid-column: 2; /* Place in the middle column */
}

.nav-links li {
    height: 100%;
    display: flex;
    align-items: center;
    border-bottom: none;
    position: relative; /* Add for dropdown positioning */
}

.nav-links li a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding: 6px 10px;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    border-radius: var(--border-radius-sm);
    background-color: transparent;
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-links li a:hover {
    color: var(--primary);
    background-color: rgba(99, 102, 241, 0.1);
}

.nav-links li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(to right, var(--primary), var(--accent));
    border-radius: 2px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-links li a:hover::after,
.nav-links li a.active::after {
    opacity: 1;
    width: 24px;
}

.nav-links li a.active {
    color: var(--primary);
    font-weight: 600;
    background-color: rgba(99, 102, 241, 0.15);
}

.dropdown {
    position: static; /* Changed from relative to allow correct positioning */
}

.dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
    visibility: visible; /* Add for better rendering */
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: rgba(255, 255, 255, 0.98);
    min-width: 250px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1);
    z-index: 10; /* Increased z-index to ensure visibility */
    border-radius: var(--border-radius);
    padding: 10px;
    top: 100%; /* Position relative to parent */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border);
    opacity: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    visibility: hidden; /* Prevent hover issues */
}

.dropdown-content::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--border);
    z-index: 2;
}

.dropdown-content a {
    color: var(--text);
    padding: 14px 20px;
    text-decoration: none;
    display: block;
    text-align: left;
    transition: var(--transition);
    border-radius: var(--border-radius-sm);
    font-size: 0.92rem;
    position: relative;
    overflow: hidden;
}

.dropdown-content a:last-child {
    margin-bottom: 0;
}

.dropdown-content a:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dropdown-content a:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding-left: 24px;
}

.dropdown-content a:hover:before {
    opacity: 1;
}

.dropdown .nav-item::after {
    content: '▼';
    font-size: 8px;
    margin-left: 6px;
    vertical-align: middle;
    transition: transform 0.3s ease;
    display: inline-block;
}

.dropdown:hover .nav-item::after {
    transform: rotate(180deg);
}

.nav-cta {
    margin-left: 25px; /* Increased spacing */
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-cta .cta-button {
    padding: 8px 16px; /* Reduced padding to fit the menu height */
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    color: #ffffff;
    position: relative;
    overflow: hidden;
    z-index: 1;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    font-weight: 600;
    border-radius: 6px;
    border: none;
    letter-spacing: 0.5px;
    white-space: nowrap; /* Prevent text wrapping */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Add specific media query for smaller displays */
@media (max-width: 1100px) and (min-width: 993px) {
    .nav-cta .cta-button {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .nav-cta {
        margin-left: 15px;
    }
}

.nav-cta .cta-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--secondary) 0%, var(--accent) 100%);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-cta .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.nav-cta .cta-button:hover:before {
    opacity: 1;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text);
    transition: color 0.3s ease;
    grid-column: 3;
    justify-self: end;
}

.mobile-menu-toggle:hover {
    color: var(--primary);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    padding: 12px 16px;
    background-color: rgba(36, 26, 50, 0.4);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(123, 44, 191, 0.15);
}

.breadcrumbs a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    padding: 3px 0;
    font-weight: 500;
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: 0;
    left: 0;
    background-color: var(--primary);
    transition: width 0.2s ease;
}

.breadcrumbs a:hover::after {
    width: 100%;
}

.breadcrumbs .separator {
    color: #ccc;
    font-size: 0.8rem;
}

/* Close button for mobile menu */
.mobile-close-button {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 24px;
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    background-color: rgba(99, 102, 241, 0.1);
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 1000; /* Ensure it's above other elements */
}

.mobile-close-button:hover {
    background-color: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

/* Mobile navigation */
@media (max-width: 992px) {
    .main-nav {
        padding: 12px 20px;
        margin: 0;
        border-radius: 0;
        display: flex; /* Change back to flex for mobile */
        justify-content: space-between;
        align-items: center;
        position: sticky;
        top: 0;
        z-index: 1000;
        width: 100%;
        box-sizing: border-box;
        overflow: visible;
    }
    
    .nav-logo {
        grid-column: auto;
        justify-self: auto;
        height: 35px; /* Slightly smaller logo on mobile */
    }
    
    .nav-links {
        /* Reset desktop styles */
        justify-content: flex-start;
        margin: 0;
        position: static;
        grid-column: auto;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        background-color: rgba(99, 102, 241, 0.1);
        font-size: 20px;
        color: var(--primary);
        z-index: 1001;
        cursor: pointer;
        grid-column: auto;
        justify-self: auto;
    }

    .nav-links {
        position: fixed;
        flex-direction: column;
        background-color: rgba(255, 255, 255, 0.98);
        width: 100%;
        height: 100vh;
        top: 0;
        left: 0;
        transform: none;
        padding: 80px 20px 20px;
        box-shadow: none;
        border-radius: 0;
        gap: 8px; /* Adjusted gap */
        z-index: 999;
        display: none;
        overflow-y: auto;
        overflow-x: hidden;
        border: none;
        animation: fadeIn 0.3s ease-out forwards;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        margin: 0;
        justify-content: flex-start; /* Override desktop center alignment */
        box-sizing: border-box;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

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

    .nav-links.show {
        display: flex !important; /* Force display with !important */
    }
    
    .nav-links.show .mobile-close-button {
        display: flex;
    }

    .nav-links li {
        width: 100%;
        margin: 0;
        padding: 0;
        border-bottom: none;
        box-sizing: border-box;
    }

    .nav-links li:last-child {
        margin-top: 15px;
    }

    .nav-links li a {
        display: block;
        padding: 15px;
        font-size: 1.1rem;
        height: auto;
        margin: 2px 0;
        border-radius: 8px;
        width: 100%;
        text-align: left;
        box-sizing: border-box;
        word-wrap: break-word;
    }

    .nav-links li a::after {
        display: none;
    }

    .dropdown-content {
        position: static;
        box-shadow: none;
        display: none;
        padding: 0;
        margin: 0 0 5px 0;
        transform: none;
        border: none;
        border-radius: 8px;
        opacity: 1;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        background-color: rgba(99, 102, 241, 0.08);
        visibility: hidden;
        width: 100%;
        box-sizing: border-box;
    }

    .dropdown-content::before {
        display: none;
    }

    .dropdown.open .dropdown-content {
        display: block;
        max-height: 500px;
        visibility: visible;
        padding: 5px 0;
        margin-top: -5px;
    }

    .dropdown-content a {
        padding: 10px 15px 10px 25px;
        border-left: none;
        border-bottom: none;
        font-size: 1rem;
        line-height: 1.4;
        margin: 2px 5px;
        box-sizing: border-box;
        max-width: 100%;
        word-wrap: break-word;
    }
    
    .dropdown-content a:last-child {
        border-bottom: none;
    }

    .dropdown-content a:hover {
        border-left: none;
        padding-left: 25px;
        background-color: rgba(99, 102, 241, 0.12);
    }
    
    /* Make sure the dropdown content is fully visible */
    .dropdown.open .dropdown-content {
        overflow: visible;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    .dropdown .nav-item::after {
        float: right;
        margin-top: 5px;
    }

    .dropdown.open .nav-item::after {
        transform: rotate(180deg);
    }

    .nav-cta {
        margin-left: 0;
        padding: 15px 0;
        width: 100%;
        height: auto;
        box-sizing: border-box;
    }

    .nav-cta .cta-button {
        display: block;
        text-align: center;
        padding: 14px;
        color: white;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}