/* ====== CUSTOM CSS FOR HEADER ====== */

/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    color: #333;
    line-height: 1.6;
}

/* Micro Header Styles */
.micro-header {
    background: #2c3e50;
    color: #fff;
    padding: 8px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.micro-contact .micro-link {
    color: #ecf0f1;
    text-decoration: none;
    margin-right: 10px;
    transition: color 0.3s ease;
}

.micro-contact .micro-link:hover {
    color: #3498db;
}

.micro-contact .separator {
    color: #7f8c8d;
    margin: 0 10px;
}

.micro-contact .micro-link i {
    margin-right: 5px;
    font-size: 0.8rem;
}

.micro-social {
    text-align: right;
}

.social-icons {
    display: inline-flex;
    gap: 12px;
}

.social-icon {
    color: #ecf0f1;
    background: rgba(255, 255, 255, 0.1);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.social-icon:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
}

/* Main Header Styles */
.main-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.main-header.sticky-top {
    position: sticky;
    top: 0;
    z-index: 1020;
}

.navbar {
    padding: 8px 0;
}

/* Logo Styles */
.logo-container {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.7rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    line-height: 1;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: #3498db;
}

.logo-tagline {
    font-size: 0.65rem;
    color: #7f8c8d;
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Navigation Menu Styles */
.navbar-nav .nav-link {
    font-weight: 500;
    color: #2c3e50;
    padding: 6px 12px;
    margin: 0 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: #3498db;
    background: rgba(52, 152, 219, 0.05);
}

/* Dropdown Arrow */
.nav-link.dropdown-toggle::after {
    display: inline-block;
    margin-left: 0.255em;
    vertical-align: 0.255em;
    content: "";
    border-top: 0.25em solid;
    border-right: 0.25em solid transparent;
    border-bottom: 0;
    border-left: 0.25em solid transparent;
}

/* ====== DESKTOP MEGA MENU STYLES ====== */
@media (min-width: 992px) {
    .mega-menu {
        position: static !important;
    }
    
    .mega-menu .dropdown-menu {
        width: 1050px;
        max-width: 90vw;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        padding: 0;
        border: none;
        border-radius: 8px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
        margin-top: 8px !important; /* REDUCED GAP */
        border-top: 4px solid #3498db !important;
        overflow: hidden;
    }
    
    /* Add invisible buffer above dropdown to prevent immediate closing */
    .mega-menu .dropdown-menu::before {
        content: '';
        position: absolute;
        top: -15px; /* Reduced buffer zone */
        left: 0;
        width: 100%;
        height: 15px;
        background: transparent;
        z-index: 1;
    }
    
    /* Add padding to top of dropdown to create gap */
    .mega-menu-content {
        padding: 5px 0 0 0; /* Reduced top padding */
        background: white;
        position: relative;
    }
    
    .mega-menu-content .container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .mega-menu-content .row {
        display: flex;
        flex-wrap: nowrap;
        margin: 0;
        padding-top: 5px; /* Reduced padding */
    }
    
    .mega-menu-content .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
        padding: 25px 20px;
        position: relative;
    }
    
    /* Column separator lines */
    .mega-menu-content .col-lg-4:not(:last-child)::after {
        content: '';
        position: absolute;
        right: 0;
        top: 25px;
        bottom: 25px;
        width: 1px;
        background: linear-gradient(to bottom, 
            transparent 0%, 
            #e0e0e0 10%, 
            #e0e0e0 90%, 
            transparent 100%);
    }
    
    /* Dropdown hover effect for desktop */
    .mega-menu:hover .dropdown-menu,
    .mega-menu .dropdown-menu:hover {
        display: block !important;
    }
    
    .dropdown-menu {
        display: none;
    }
    
    .dropdown-menu.show {
        display: block !important;
    }
    
    /* Remove the extra after pseudo element as it was causing issues */
    .mega-menu::after {
        display: none;
    }
}

/* Mega Menu Title with bottom separator */
.mega-menu-title {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    position: relative;
}

/* Add decorative element to title */
.mega-menu-title::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 40px;
    height: 2px;
    background: #3498db;
}

.mega-menu-content .dropdown-item {
    padding: 8px 0;
    color: #555;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    white-space: nowrap;
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 4px;
    margin-bottom: 2px;
}

.mega-menu-content .dropdown-item i {
    margin-right: 10px;
    color: #3498db;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.mega-menu-content .dropdown-item:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.05);
    padding-left: 8px;
}

.mega-menu-content .dropdown-item:hover i {
    transform: translateX(3px);
}

/* Call to Action Button */
.cta-button .btn {
    background: linear-gradient(135deg, #3498db, #2c3e50);
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 10px;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: 0.9rem;
}

.cta-button .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

/* ====== MOBILE STYLES ====== */
@media (max-width: 991.98px) {
    /* Micro Header Mobile */
    .micro-header {
        text-align: center;
    }
    
    .micro-contact, .micro-social {
        text-align: center !important;
        margin-bottom: 5px;
    }
    
    .micro-contact .separator {
        display: none;
    }
    
    .micro-contact .micro-link {
        display: block;
        margin: 5px 0;
    }
    
    .social-icons {
        justify-content: center;
    }
    
    /* Mobile Mega Menu */
    .mega-menu .dropdown-menu {
        position: static !important;
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        left: 0 !important;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1) !important;
        border: 1px solid #eee !important;
        margin-top: 10px !important; /* Normal gap */
        margin-bottom: 10px !important;
        border-radius: 8px !important;
        border-top: 4px solid #3498db !important;
        padding: 0 !important;
    }
    
    /* Ensure Bootstrap can show/hide it */
    .mega-menu .dropdown-menu {
        display: none;
    }
    
    .mega-menu .dropdown-menu.show {
        display: block !important;
    }
    
    /* FIX: Add left/right padding to mobile mega menu */
    .mega-menu-content {
        padding: 20px 15px !important; /* Added left/right padding */
    }
    
    .mega-menu-content .row {
        display: block !important;
        padding-top: 0 !important;
        margin: 0 -5px !important; /* Compensate for column padding */
    }
    
    .mega-menu-content .col-lg-4 {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 25px !important;
        padding: 0 5px !important; /* Added horizontal padding */
        position: relative;
    }
    
    /* Mobile column separators */
    .mega-menu-content .col-lg-4:not(:last-child)::after {
        content: '';
        position: absolute;
        bottom: -15px;
        left: 5px; /* Adjusted for padding */
        right: 5px; /* Adjusted for padding */
        height: 1px;
        background: linear-gradient(to right, 
            transparent 0%, 
            #e0e0e0 20%, 
            #e0e0e0 80%, 
            transparent 100%);
    }
    
    .mega-menu-content .col-lg-4:last-child {
        margin-bottom: 0 !important;
    }
    
    .mega-menu-content .dropdown-item {
        white-space: normal !important;
        font-size: 0.9rem !important;
        padding: 10px 5px !important; /* Added horizontal padding */
        display: block !important;
        width: 100% !important;
        border-bottom: 1px solid #f5f5f5 !important;
    }
    
    .mega-menu-content .dropdown-item:last-child {
        border-bottom: none !important;
    }
    
    .mega-menu-content .dropdown-item i {
        margin-right: 10px !important;
        width: 20px !important;
        text-align: center !important;
    }
    
    .mega-menu-title {
        font-size: 0.95rem !important;
        margin-top: 0 !important;
        margin-bottom: 15px !important;
        padding-bottom: 10px !important;
        border-bottom: 2px solid #3498db !important;
        padding-left: 5px; /* Added left padding */
    }
    
    /* Mobile title decorative element */
    .mega-menu-title::before {
        width: 30px;
        left: 5px; /* Adjusted for padding */
    }
    
    /* Mobile Navigation Menu */
    .navbar-collapse {
        background: white;
        padding: 15px !important; /* Ensured padding on all sides */
        border-radius: 8px;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        margin-top: 10px;
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* FIX: Ensure nav items have proper left/right spacing */
    .navbar-nav {
        padding: 0 5px; /* Added left/right padding */
    }
    
    .cta-button {
        margin-top: 15px;
        text-align: center;
        padding: 0 5px; /* Added left/right padding */
    }
    
    .cta-button .btn {
        margin-left: 0;
        width: 100%;
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .navbar-nav .nav-link {
        margin: 5px 0;
        padding: 10px 15px !important; /* Ensured padding */
        font-size: 0.95rem;
        width: 100%;
        text-align: left;
    }
    
    /* Fix dropdown toggle arrow on mobile */
    .mega-menu .dropdown-toggle::after {
        float: right;
        margin-top: 8px;
        transition: transform 0.3s ease;
    }
    
    .mega-menu.show .dropdown-toggle::after {
        transform: rotate(180deg);
    }
}

@media (max-width: 768px) {
    .logo-text {
        font-size: 1.5rem;
    }
    
    .logo-tagline {
        font-size: 0.65rem;
    }
    
    .mega-menu-title {
        font-size: 0.9rem;
    }
    
    .mega-menu-content .dropdown-item {
        font-size: 0.9rem;
    }
    
    .navbar-nav .nav-link {
        margin: 5px 0;
        padding: 10px 12px !important;
    }
    
    /* Adjust mobile mega menu padding */
    .mega-menu-content {
        padding: 15px 12px !important;
    }
    
    .mega-menu-content .col-lg-4 {
        padding: 0 3px !important;
    }
    
    .mega-menu-content .dropdown-item {
        padding: 10px 3px !important;
    }
    
    .mega-menu-title {
        padding-left: 3px;
    }
    
    .mega-menu-title::before {
        left: 3px;
    }
    
    .navbar-nav {
        padding: 0 3px;
    }
    
    .cta-button {
        padding: 0 3px;
    }
}

@media (max-width: 576px) {
    .micro-header {
        font-size: 0.8rem;
        padding: 5px 0;
    }
    
    .social-icon {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
    
    .logo-text {
        font-size: 1.3rem;
    }
    
    .mega-menu-content {
        padding: 12px 10px !important;
    }
    
    .mega-menu-title {
        font-size: 0.85rem;
        margin-top: 0 !important;
        padding-left: 0;
    }
    
    .mega-menu-content .dropdown-item {
        font-size: 0.85rem;
        padding: 8px 0 !important;
    }
    
    /* Smaller title decorative element on mobile */
    .mega-menu-title::before {
        width: 25px;
        left: 0;
    }
    
    .navbar-nav .nav-link {
        margin: 4px 0;
        padding: 8px 10px !important;
    }
    
    /* Even smaller screens get less padding */
    .navbar-collapse {
        padding: 10px 8px !important;
    }
    
    .navbar-nav {
        padding: 0 2px;
    }
    
    .cta-button {
        padding: 0 2px;
    }
}

/* Animation for header on scroll */
.header-scrolled {
    padding: 5px 0;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

/* Dropdown animation */
.dropdown-menu {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure proper spacing for main content */
main {
    padding-top: 20px;
    min-height: calc(100vh - 200px);
}

/* Add margin/padding above mega menu titles on mobile */
@media (max-width: 991.98px) {
    .mega-menu-title {
        margin-top: 20px !important; /* Add space above heading */
        padding-top: 10px !important; /* Optional: add padding inside */
    }
    
    /* Remove top margin from first heading in each column */
    .mega-menu-content .col-lg-3:first-child .mega-menu-title {
        margin-top: 10px !important; /* Less space for first one */
    }
}