/* Modern Professional Navbar Styles */

/* Root Variables */
:root {
    --primary-blue: #1A376B;
    --secondary-blue: #2a4a7f;
    --accent-gold: #FBB705;
    --light-bg: #F4F6F9;
    --white: #ffffff;
    --text-dark: #121212;
    --text-gray: #5E6D87;
    --shadow-light: rgba(26, 55, 107, 0.1);
    --shadow-medium: rgba(26, 55, 107, 0.2);
    --shadow-heavy: rgba(26, 55, 107, 0.3);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.2s ease;
}

/* Main Navbar Container */
.navbar-modern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(26, 55, 107, 0.1);
    transition: var(--transition-smooth);
    box-shadow: 0 2px 20px var(--shadow-light);
}

.navbar-modern.scrolled {
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--accent-gold);
    box-shadow: 0 4px 30px var(--shadow-medium);
    backdrop-filter: blur(25px);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    position: relative;
}

/* Brand Section */
.navbar-brand-section {
    display: flex;
    align-items: center;
    z-index: 1001;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.brand-link:hover {
    transform: translateY(-1px);
}

.logo-container {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--white) 0%, #f8f9fa 100%);
    box-shadow: 0 4px 15px var(--shadow-light);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    border: 2px solid rgba(251, 183, 5, 0.2);
}

.logo-container:hover {
    box-shadow: 0 6px 25px var(--shadow-medium);
    border-color: var(--accent-gold);
    transform: scale(1.05);
}

.navbar-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    transition: var(--transition-smooth);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-blue);
    margin: 0;
    letter-spacing: -0.5px;
}

.brand-tagline {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent-gold);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Desktop Navigation */
.desktop-nav {
    display: none;
}

@media (min-width: 1024px) {
    .desktop-nav {
        display: block;
    }
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-gray);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    background: transparent;
}

.nav-item:hover {
    color: var(--primary-blue);
    background: rgba(26, 55, 107, 0.05);
    transform: translateY(-1px);
}

.nav-item.active {
    color: var(--primary-blue);
    background: rgba(26, 55, 107, 0.08);
}

.nav-text {
    position: relative;
    z-index: 2;
}

.nav-indicator {
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-gold), #ffd700);
    border-radius: 2px;
    transform: translateX(-50%);
    transition: var(--transition-smooth);
}

.nav-item:hover .nav-indicator,
.nav-item.active .nav-indicator {
    width: 80%;
}

/* CTA Button */
.nav-cta {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: var(--white) !important;
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    margin-left: 1rem;
    position: relative;
    overflow: hidden;
}

.nav-cta:hover {
    background: linear-gradient(135deg, var(--secondary-blue), var(--primary-blue));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.cta-glow {
    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;
}

.nav-cta:hover .cta-glow {
    left: 100%;
}

/* Dropdown Styles */
.nav-dropdown {
    position: relative;
}

.dropdown-icon {
    font-size: 0.75rem;
    transition: var(--transition-fast);
}

.nav-dropdown:hover .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 320px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 10px 40px var(--shadow-medium);
    border: 1px solid rgba(26, 55, 107, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-smooth);
    padding: 1rem;
    margin-top: 0.5rem;
    backdrop-filter: blur(20px);
}

.dropdown-menu.active,
.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-section {
    margin-bottom: 1rem;
}

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, rgba(26, 55, 107, 0.05), rgba(251, 183, 5, 0.05));
    border-radius: 12px;
    margin-bottom: 0.5rem;
    color: var(--primary-blue);
    font-weight: 700;
    font-size: 0.9rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-gray);
    font-weight: 500;
    transition: var(--transition-fast);
    margin-bottom: 0.25rem;
}

.dropdown-item:hover {
    background: rgba(26, 55, 107, 0.05);
    color: var(--primary-blue);
    transform: translateX(5px);
}

.dropdown-item i {
    width: 16px;
    color: var(--accent-gold);
}

.dropdown-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(26, 55, 107, 0.1), transparent);
    margin: 1rem 0;
}

/* Sub-dropdown */
.sub-dropdown {
    position: relative;
}

.sub-dropdown-content {
    margin-left: 2rem;
    margin-top: 0.5rem;
    padding-left: 1rem;
    border-left: 2px solid rgba(251, 183, 5, 0.3);
    /* Always visible when parent dropdown is shown */
    display: block;
}

.sub-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-gray);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition-fast);
    margin-bottom: 0.25rem;
}

.sub-dropdown-item:hover {
    background: rgba(251, 183, 5, 0.1);
    color: var(--primary-blue);
    transform: translateX(3px);
}

/* Mobile Menu Button */
.mobile-menu-button {
    display: block;
    z-index: 1001;
}

@media (min-width: 1024px) {
    .mobile-menu-button {
        display: none;
    }
}

.hamburger {
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 5px;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.hamburger:hover {
    background: rgba(26, 55, 107, 0.05);
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: var(--primary-blue);
    border-radius: 1px;
    transition: var(--transition-smooth);
}

.hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Navigation */
.mobile-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(26, 55, 107, 0.1);
    box-shadow: 0 10px 30px var(--shadow-medium);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition-smooth);
    transform-origin: top;
    -webkit-overflow-scrolling: touch; /* Enable smooth scrolling on iOS */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(26, 55, 107, 0.3) transparent; /* Firefox */
    position: relative;
}

/* Scroll indicator gradient */
.mobile-nav::after {
    content: '';
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.9), transparent);
    pointer-events: none;
    z-index: 1;
}

/* Webkit scrollbar styling */
.mobile-nav::-webkit-scrollbar {
    width: 4px;
}

.mobile-nav::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-nav::-webkit-scrollbar-thumb {
    background: rgba(26, 55, 107, 0.3);
    border-radius: 2px;
}

.mobile-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 55, 107, 0.5);
}

.mobile-nav.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scaleY(0);
}

.mobile-nav-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: min-content;
    padding-bottom: 3rem; /* Add extra padding at bottom for easier scrolling */
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-gray);
    font-weight: 600;
    transition: var(--transition-smooth);
    background: transparent;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    background: rgba(26, 55, 107, 0.05);
    color: var(--primary-blue);
    transform: translateX(5px);
}

.mobile-nav-item i {
    width: 20px;
    color: var(--accent-gold);
}

.mobile-cta {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: var(--white) !important;
    margin-top: 1rem;
}

.mobile-cta:hover {
    transform: translateX(0) translateY(-2px);
    box-shadow: 0 5px 20px var(--shadow-medium);
}

/* Mobile Dropdowns */
.mobile-dropdown {
    border-radius: 12px;
    overflow: hidden;
}

.mobile-dropdown-trigger {
    justify-content: space-between;
    display: flex !important;
    align-items: center;
}

.mobile-dropdown-arrow {
    font-size: 0.8rem;
    transition: var(--transition-fast);
    margin-left: auto;
}

.mobile-dropdown-arrow.rotated {
    transform: rotate(180deg);
}

.mobile-dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: rgba(26, 55, 107, 0.02);
    margin: 0 1rem;
    border-radius: 8px;
    opacity: 0;
}

.mobile-dropdown.active .mobile-dropdown-content {
    max-height: 500px;
    padding: 0.5rem 0;
    opacity: 1;
}

.mobile-nav-subitem {
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 8px;
    color: var(--text-gray);
    text-decoration: none;
    transition: var(--transition-fast);
}

/* Interactive mobile nav subitems (anchors with mobile-sub-trigger class) */
.mobile-nav-subitem.mobile-sub-trigger:hover {
    background: rgba(26, 55, 107, 0.05);
    color: var(--primary-blue);
    transform: translateX(3px);
}

/* Special case for Solar EPC: clickable arrow but non-clickable text */
.mobile-nav-subitem.mobile-sub-trigger:has(.mobile-sub-arrow) {
    cursor: default;
}

.mobile-nav-subitem.mobile-sub-trigger:has(.mobile-sub-arrow):hover {
    background: transparent;
    color: var(--text-gray);
    transform: none;
}

.mobile-nav-subitem .mobile-sub-arrow {
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.mobile-nav-subitem .mobile-sub-arrow:hover {
    background: rgba(26, 55, 107, 0.1);
    color: var(--primary-blue);
}

/* Non-interactive mobile nav subitems (divs without mobile-sub-trigger class) */
.mobile-nav-subitem:not(.mobile-sub-trigger):not(a) {
    cursor: default;
    pointer-events: none;
    opacity: 0.8;
}

/* Ensure anchor links are always clickable */
a.mobile-nav-subitem {
    pointer-events: auto;
    cursor: pointer;
}

.mobile-sub-dropdown {
    margin-left: 1rem;
}

.mobile-sub-trigger {
    justify-content: space-between;
    display: flex !important;
    align-items: center;
}

.mobile-sub-arrow {
    font-size: 0.7rem;
    transition: var(--transition-fast);
    margin-left: auto;
}

.mobile-sub-arrow.rotated {
    transform: rotate(180deg);
}

.mobile-sub-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: rgba(251, 183, 5, 0.05);
    margin: 0.5rem 0;
    border-radius: 6px;
    opacity: 0;
}

.mobile-sub-dropdown.active .mobile-sub-content {
    max-height: 200px;
    padding: 0.25rem 0;
    opacity: 1;
}

/* Body scroll lock when mobile menu is open */
body.menu-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar-container {
        padding: 0 1rem;
    }
    
    .navbar-content {
        height: 70px;
    }
    
    .brand-name {
        font-size: 1.3rem;
    }
    
    .brand-tagline {
        font-size: 0.8rem;
    }
    
    .logo-container {
        width: 45px;
        height: 45px;
    }
    
    .navbar-logo {
        width: 28px;
        height: 28px;
    }
    
    .mobile-nav {
        max-height: calc(100vh - 70px); /* Adjust for navbar height */
    }
    
    .mobile-nav-content {
        padding: 1.5rem;
        padding-bottom: 2.5rem; /* Add extra bottom padding for scrolling */
    }
}

@media (max-width: 480px) {
    .navbar-container {
        padding: 0 0.75rem;
    }
    
    .navbar-content {
        height: 65px;
    }
    
    .brand-text {
        display: none;
    }
    
    .mobile-nav {
        max-height: calc(100vh - 65px); /* Adjust for smaller navbar height on tiny screens */
    }
    
    .mobile-nav-content {
        padding: 1.5rem;
        padding-bottom: 2rem;
        gap: 0.25rem; /* Tighter spacing on small screens */
    }
    
    .mobile-nav-item {
        padding: 0.75rem 1rem; /* Slightly smaller padding for more items to fit */
        font-size: 0.95rem;
    }
}

/* OLD CSS CLASSES FOR BACKWARDS COMPATIBILITY */

/* Keep existing classes for compatibility */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(26, 55, 107, 0.1);
    box-shadow: 0 2px 20px rgba(26, 55, 107, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid #FBB705;
    box-shadow: 0 4px 30px rgba(26, 55, 107, 0.2);
    backdrop-filter: blur(25px);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1A376B;
    text-shadow: none;
    margin: 0;
}

#navbar-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    transition: all 0.3s ease;
}

.nav-link {
    position: relative;
    transition: color 0.3s ease;
    color: #5E6D87;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-link:hover {
    color: #1A376B !important;
    background: rgba(26, 55, 107, 0.05);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background: linear-gradient(90deg, #FBB705, #ffd700);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Mobile menu animations */
#mobile-menu {
    transition: all 0.3s ease-in-out;
    transform-origin: top;
    opacity: 1;
    max-height: 1000px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
}

#mobile-menu.hidden {
    transform: scaleY(0);
    max-height: 0;
    opacity: 0;
    visibility: hidden;
}

/* Dropdown compatibility */
.dropdown {
    position: relative;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 250px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(26, 55, 107, 0.2);
    border: 1px solid rgba(26, 55, 107, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    padding: 1rem;
    margin-top: 0.5rem;
    z-index: 1000;
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sub-dropdown-content {
    margin-left: 1rem;
    margin-top: 0.5rem;
    padding-left: 1rem;
    border-left: 2px solid rgba(251, 183, 5, 0.3);
    position: relative;
}

/* Mobile dropdown styles */
.dropdown.active .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    position: static;
    box-shadow: none;
    background: rgba(26, 55, 107, 0.02);
    margin: 0.5rem 0;
}

.dropdown.active > a {
    color: #1A376B;
    font-weight: bold;
}

.sub-dropdown.active > a {
    color: #FBB705;
    font-weight: bold;
}