/* ====================================
   DigiQLabs Interactive Navigation Styles
   ==================================== */

/* Header Styles */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
}

/* Logo/Branding */
.site-branding {
    display: flex;
    align-items: center;
    z-index: 1001;
}

.site-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff; /* Changed from #2c3e50 to white */
}

.site-title a {
    text-decoration: none;
    color: #ffffff; /* Changed from inherit to white */
    transition: color 0.3s ease;
}

.site-title a:hover {
    color: #3498db;
}

.site-logo img {
    max-height: 50px;
    width: auto;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1002;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background: #2c3e50;
    margin: 3px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

.menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Navigation Container */
.main-navigation {
    position: relative;
}

.nav-menu-wrapper {
    display: flex;
    align-items: center;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Menu */
.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    transition: none;
}

.nav-menu > li {
    position: relative;
    margin: 0 8px;
}

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: #ffffff; /* Changed from #2c3e50 to white */
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

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

.nav-menu a:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.05);
    transform: translateY(-1px);
}

/* Dropdown Indicator */
.dropdown-indicator {
    margin-left: 8px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
}

.has-dropdown:hover .dropdown-indicator {
    transform: rotate(180deg);
}

/* Dropdown Menus */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    list-style: none;
    margin: 0;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
}

.has-dropdown:hover > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-menu li {
    position: relative;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #2c3e50;
    font-size: 0.9rem;
    border-radius: 0;
    margin: 0 8px;
    transition: all 0.2s ease;
}

.dropdown-menu a:hover {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
    transform: translateX(4px);
}

/* Multi-level Dropdowns */
.dropdown-submenu {
    position: absolute;
    top: -8px;
    left: 100%;
    margin-left: 8px;
}

.dropdown-submenu::before {
    left: -8px;
    top: 20px;
}

/* Hover Effects with Delays */
.has-dropdown {
    transition: all 0.2s ease;
}

.has-dropdown:hover {
    background: rgba(52, 152, 219, 0.02);
}

/* Active/Current Menu Item */
.current-menu-item > a,
.current-menu-parent > a,
.current-menu-ancestor > a {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

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

.dropdown-menu li {
    animation: fadeInUp 0.3s ease forwards;
}

.dropdown-menu li:nth-child(1) { animation-delay: 0s; }
.dropdown-menu li:nth-child(2) { animation-delay: 0.05s; }
.dropdown-menu li:nth-child(3) { animation-delay: 0.1s; }
.dropdown-menu li:nth-child(4) { animation-delay: 0.15s; }
.dropdown-menu li:nth-child(5) { animation-delay: 0.2s; }

/* Mobile Styles - Updated for specific device resolutions */
@media (max-width: 1100px) {
    .site-header {
        height: 70px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
    }
    
    .header-container {
        height: 70px;
        padding: 0 15px;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    /* Ensure hamburger menu is always visible in mobile mode regardless of device */
    .menu-toggle {
        display: flex !important; /* Force display regardless of other rules */
        position: relative;
        z-index: 10001;
        background: none;
        border: none;
        cursor: pointer;
        padding: 10px;
        flex-direction: column;
        order: 3; /* Ensure it appears after navigation */
    }
    
    .site-branding {
        order: 1;
        z-index: 10001;
    }
    
    .main-navigation {
        order: 2;
        flex: 1;
        display: flex;
        justify-content: flex-end;
    }
    
    .hamburger-line {
        width: 25px;
        height: 3px;
        background: #2c3e50;
        margin: 3px 0;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 2px;
    }
    
    .menu-toggle.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .menu-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }
    
    .menu-toggle.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* Mobile navigation overlay - FIXED POSITIONING */
    .nav-menu-wrapper {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100vw;
        height: calc(100vh - 70px);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        display: flex;
        flex-direction: column;
        padding: 20px 0;
        /* CHANGED: Start visible but off-screen, not opacity 0 */
        visibility: hidden;
        transform: translateX(-100%);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 10000;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .nav-menu-wrapper.active {
        visibility: visible;
        transform: translateX(0);
    }
    
    /* Ensure mobile menu appears above everything */
    body.menu-open .nav-menu-wrapper {
        visibility: visible !important;
        transform: translateX(0) !important;
    }
    
    /* Mobile menu styling */
    .nav-menu {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
        max-width: none;
        transition: none;
        padding: 0 20px;
        margin: 0;
        list-style: none;
        position: relative;
    }
    
    .nav-menu > li {
        display: block !important;
        margin: 0;
        width: 100%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        position: relative;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .nav-menu > li:last-child {
        border-bottom: none;
    }
    
    .nav-menu a {
        display: block !important;
        font-size: 1.1rem;
        padding: 18px 0;
        width: 100%;
        color: #2c3e50;
        font-weight: 500;
        border-radius: 0;
        text-align: left;
        position: relative;
        transition: all 0.3s ease;
        text-decoration: none;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .nav-menu a:hover,
    .nav-menu a:focus {
        background: rgba(52, 152, 219, 0.1);
        color: #3498db;
        transform: none;
    }
    
    /* Hide dropdown indicators on mobile by default */
    .dropdown-indicator {
        display: none;
    }
    
    /* Mobile dropdown styling */
    .dropdown-menu {
        position: static !important;
        top: auto !important;
        left: auto !important;
        box-shadow: none !important;
        border: none !important;
        background: rgba(52, 152, 219, 0.05) !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease !important;
        width: 100% !important;
        display: block !important;
    }
    
    .has-dropdown.mobile-dropdown-open .dropdown-menu {
        max-height: 500px !important;
    }
    
    .dropdown-menu::before {
        display: none !important;
    }
    
    .dropdown-menu li {
        display: block !important;
        position: relative !important;
        margin: 0 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .dropdown-menu a {
        display: block !important;
        font-size: 1rem !important;
        padding: 15px 20px !important;
        color: #666 !important;
        background: transparent !important;
        text-align: left !important;
        margin: 0 !important;
        border-radius: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .dropdown-menu a:hover,
    .dropdown-menu a:focus {
        background: rgba(52, 152, 219, 0.15) !important;
        color: #3498db !important;
        transform: none !important;
    }
    
    .dropdown-submenu {
        position: static !important;
        top: auto !important;
        left: auto !important;
        margin: 0 !important;
    }
    
    .dropdown-submenu::before {
        display: none !important;
    }
    
    /* Mobile dropdown toggle button */
    .has-dropdown > a {
        position: relative;
    }
    
    .has-dropdown > a::after {
        content: '+';
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
        font-weight: bold;
        transition: transform 0.3s ease;
        width: 30px;
        text-align: center;
    }
    
    .has-dropdown.mobile-dropdown-open > a::after {
        content: '−';
        transform: translateY(-50%) rotate(180deg);
    }
    
    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        top: 0;
        left: 0;
    }
    
    /* Force all menu items to be visible */
    .nav-menu,
    .nav-menu li,
    .nav-menu li a {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Override WordPress hiding styles */
    .menu-item {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .menu-item a {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* Ensure current menu items are visible */
    .current-menu-item,
    .current-menu-parent,
    .current-menu-ancestor {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .current-menu-item > a,
    .current-menu-parent > a,
    .current-menu-ancestor > a {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        color: #3498db !important;
        background: rgba(52, 152, 219, 0.1) !important;
    }
    
    /* If no menu is assigned, show fallback */
    .nav-menu:empty::after {
        content: "No menu assigned. Please assign a menu in WordPress Admin > Appearance > Menus";
        padding: 20px;
        text-align: center;
        color: #666;
        font-style: italic;
        display: block;
    }
}

/* Special handling for HiDPI devices with specific resolutions */
@media (min-width: 800px) and (max-width: 1100px) and (min-resolution: 192dpi),
       (min-width: 800px) and (max-width: 1100px) and (-webkit-min-device-pixel-ratio: 2) {
    .menu-toggle {
        display: flex !important; /* Ensure hamburger menu is visible on HiDPI screens */
    }
    
    .nav-menu-wrapper {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100vw;
        visibility: hidden;
        transform: translateX(-100%);
    }
}

/* Comprehensive fix for problematic mid-size device resolutions */
@media (min-width: 850px) and (max-width: 1100px),
       (width: 900px), (width: 950px), (width: 853px) {
    /* Force display hamburger menu for tablet and problematic resolutions */
    .menu-toggle {
        display: flex !important;
        position: relative;
        z-index: 10001;
        background: none;
        border: none;
        cursor: pointer;
        padding: 10px;
        flex-direction: column;
        order: 3;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
    
    /* Ensure site header has correct position and style */
    .site-header {
        height: 70px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9999;
    }
    
    /* Fix menu wrapper positioning */
    .nav-menu-wrapper {
        position: fixed !important;
        top: 70px !important;
        left: 0 !important;
        width: 100vw !important;
        height: calc(100vh - 70px) !important;
        visibility: hidden !important;
        transform: translateX(-100%) !important;
        z-index: 9999 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Fix menu activation */
    .nav-menu-wrapper.active,
    body.menu-open .nav-menu-wrapper {
        visibility: visible !important;
        transform: translateX(0) !important;
        opacity: 1 !important;
    }
    
    /* Ensure hamburger lines are visible */
    .hamburger-line {
        background: #2c3e50 !important;
        width: 25px !important;
        height: 3px !important;
        opacity: 1 !important;
    }
    
    /* Mobile dropdown toggle must be shown */
    .has-dropdown > a::after {
        content: '+' !important;
        position: absolute !important;
        right: 0 !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        font-size: 1.5rem !important;
        font-weight: bold !important;
        width: 30px !important;
        text-align: center !important;
    }
    
    /* Make mobile dropdown work */
    .dropdown-menu {
        max-height: 0 !important;
        overflow: hidden !important;
        transition: max-height 0.3s ease !important;
    }
    
    .has-dropdown.mobile-dropdown-open .dropdown-menu {
        max-height: 500px !important;
    }
}

/* Dedicated fixes for the three specific devices */
@media screen and (width: 900px) and (height: 1440px),
       screen and (width: 950px) and (height: 1280px),
       screen and (width: 853px) and (height: 1280px) {
    /* Ensure hamburger menu is always visible and in right position */
    .menu-toggle {
        display: flex !important;
        position: relative;
        z-index: 10001;
        background: none;
        border: none;
        cursor: pointer;
        padding: 10px;
        flex-direction: column;
        order: 3;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
    
    /* Ensure header has correct height */
    .site-header,
    .header-container {
        height: 70px !important;
    }
    
    /* Specific menu wrapper setup for these devices */
    .nav-menu-wrapper {
        position: fixed !important;
        top: 70px !important;
        left: 0 !important;
        width: 100vw !important;
        height: calc(100vh - 70px) !important;
        max-height: calc(100vh - 70px) !important;
        visibility: hidden !important;
        transform: translateX(-100%) !important;
        z-index: 9999 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    /* Make active menu visible */
    .nav-menu-wrapper.active,
    body.menu-open .nav-menu-wrapper,
    .menu-toggle.active + .nav-menu-wrapper,
    .main-navigation.toggled .nav-menu-wrapper {
        visibility: visible !important;
        transform: translateX(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    /* Force mobile dropdown behavior */
    .dropdown-menu {
        max-height: 0 !important;
        overflow: hidden !important;
        transition: max-height 0.3s ease !important;
    }
    
    .has-dropdown.mobile-dropdown-open .dropdown-menu {
        max-height: 500px !important;
    }
    
    /* Ensure mobile dropdown toggle works */
    .has-dropdown > a::after {
        content: '+' !important;
        position: absolute !important;
        right: 0 !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        font-size: 1.5rem !important;
        font-weight: bold !important;
        width: 30px !important;
        text-align: center !important;
    }
    
    .has-dropdown.mobile-dropdown-open > a::after {
        content: '−' !important;
        transform: translateY(-50%) !important;
    }
    
    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }
}

/* Laptop with HiDpi Screen : 900x1440 specific tweaks */
@media screen and (width: 900px) and (height: 1440px) {
    .nav-menu-wrapper {
        max-height: calc(100vh - 70px) !important;
    }
    
    /* Ensure hamburger lines have good contrast */
    .hamburger-line {
        background: #2c3e50 !important;
        width: 25px !important;
        height: 3px !important;
    }
}

/* Laptop with touch: 950x1280 specific tweaks */
@media screen and (width: 950px) and (height: 1280px) {
    .nav-menu-wrapper {
        max-height: calc(100vh - 70px) !important;
    }
}

/* Asus Zenbook Fold: 853x1280 specific tweaks */
@media screen and (width: 853px) and (height: 1280px) {
    .nav-menu-wrapper {
        max-height: calc(100vh - 70px) !important;
        width: 100% !important;
    }
}

/* High-resolution displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .site-header {
        border-bottom-width: 0.5px;
    }
}

/* Hide mobile dropdown toggle on desktop */
@media (min-width: 1101px) {
    .mobile-dropdown-toggle {
        display: none !important;
    }
}

/* Desktop only styles - place this AFTER all mobile specific styles */
@media (min-width: 1101px) {
    .menu-toggle {
        display: none !important;
    }
    
    .nav-menu-wrapper {
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        transform: none;
        visibility: visible;
        padding: 0;
        overflow: visible;
    }
    
    .nav-menu {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0;
        padding: 0;
    }
    
    .nav-menu > li {
        display: block;
        width: auto;
        border-bottom: none;
        margin: 0 8px;
    }
    
    .nav-menu a {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        font-size: 0.95rem;
        border-radius: 8px;
        width: auto;
        color: #ffffff !important; /* Ensuring menu text is white in desktop view */
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .site-header {
        background: rgba(26, 32, 44, 0.95);
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .site-title {
        color: #ffffff;
    }
    
    .hamburger-line {
        background: #ffffff;
    }
    
    .nav-menu a {
        color: #e2e8f0;
    }
    
    .nav-menu a:hover {
        color: #63b3ed;
        background: rgba(99, 179, 237, 0.1);
    }
    
    .dropdown-menu {
        background: #2d3748;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .dropdown-menu::before {
        background: #2d3748;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .dropdown-menu a {
        color: #e2e8f0;
    }
    
    .dropdown-menu a:hover {
        background: rgba(99, 179, 237, 0.2);
        color: #63b3ed;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

