/* 
* ZoeyComm Construction - Header & Navigation Styles
* Fixed version for mobile menu
*/

/* ===== HEADER VARIABLES ===== */
:root {
    --header-bg-color: #0f75bd;
    --header-text-color: #ffffff;
    --header-hover-bg: rgba(255, 255, 255, 0.1);
    --header-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    --button-color: #0a5285;
    --button-hover-color: #083f66;
    --transition-speed: 0.3s;
    --mobile-breakpoint: 768px;
    --header-height-desktop: 90px;
    --header-height-mobile: 70px;
    --dropdown-bg: #0f75bd;
    --dropdown-hover: rgba(255, 255, 255, 0.2);
    --dropdown-border: rgba(255, 255, 255, 0.1);
}

/* ===== ACCESSIBILITY SKIP LINK ===== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--button-color);
    color: var(--header-text-color);
    padding: 8px 12px;
    z-index: 10000;
    transition: top 0.3s;
    font-weight: bold;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #FFD700;
}

/* ===== HEADER STRUCTURE ===== */
header {
    background-color: var(--header-bg-color);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: var(--header-shadow);
    height: var(--header-height-desktop);
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    height: 100%;
}

/* ===== LOGO ===== */
.logo img {
    height: 60px;
    width: 125px;
    display: block;
}

/* ===== NAVIGATION LINKS ===== */
.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 20px;
    height: 60px;
    padding: 0;
    margin: 0;
}

.nav-links li a {
    color: var(--header-text-color);
    text-decoration: none;
    font-weight: bold;
    padding: 10px 15px;
    display: block;
    transition: background-color var(--transition-speed);
    border-radius: 4px;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.nav-links li a:hover {
    background: var(--header-hover-bg);
}

/* ===== CALL BUTTON ===== */
.call-button {
    background-color: var(--button-color);
    color: var(--header-text-color);
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    transition: background-color var(--transition-speed);
}

.call-button:hover {
    background-color: var(--button-hover-color);
}

/* ===== DROPDOWN MENU ===== */
.dropdown {
    position: relative;
}

/* Make dropdown toggle more visible as a clickable element */
.dropdown-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    padding-right: 25px; /* Space for the arrow */
}

.dropdown-arrow {
    font-size: 0.7rem;
    margin-left: 5px;
    transition: transform var(--transition-speed);
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--dropdown-bg);
    min-width: 250px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 0 0 5px 5px;
    z-index: 1001;
    display: none;
    padding: 5px 0;
    list-style: none;
}

.dropdown-menu li {
    width: 100%;
    margin: 0;
}

.dropdown-menu li a {
    padding: 12px 20px;
    border-radius: 0;
    color: var(--header-text-color);
    border-bottom: 1px solid var(--dropdown-border);
    text-align: left;
    display: block;
    white-space: normal;
    line-height: 1.4;
}

.dropdown-menu li:last-child a {
    border-bottom: none;
}

.dropdown-menu li a:hover {
    background-color: var(--dropdown-hover);
}

/* ===== MOBILE MENU TOGGLE ===== */
#menuToggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 50px;
    height: 40px;
    padding: 10px;
    z-index: 1002;
    position: relative;
    touch-action: manipulation;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

#menuToggle .bar {
    display: block;
    width: 30px;
    height: 3px;
    margin: 6px auto;
    background-color: var(--header-text-color);
    transition: transform var(--transition-speed), opacity var(--transition-speed);
    transform-origin: center;
}

/* ===== DESKTOP BEHAVIOR ===== */
@media (min-width: 769px) {
    /* Desktop navigation displayed horizontally */
    .nav-links {
        display: flex;
        flex-direction: row;
        position: static;
        width: auto;
        background: transparent;
        box-shadow: none;
        padding: 0;
    }

    .nav-links li {
        width: auto;
    }

    /* Desktop dropdown hover */
    .dropdown:hover .dropdown-menu {
        display: block;
        opacity: 1;
        visibility: visible;
        max-height: none;
    }
    
    .dropdown:hover .dropdown-arrow {
        transform: rotate(180deg);
    }
    
    /* Ensure dropdown menu appears below the link */
    .dropdown-menu {
        position: absolute;
        top: 100%;
        left: 0;
        min-width: 250px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    /* Hide the menu toggle button on desktop */
    #menuToggle {
        display: none;
    }
}

/* ===== MOBILE BEHAVIOR ===== */
@media (max-width: 768px) {
    /* Mobile Header Adjustments */
    header {
        height: var(--header-height-mobile);
    }
    
    .main-nav {
        padding: 10px 15px;
    }
    
    .logo img {
        height: 50px;
        width: 104px;
    }
    
    /* Mobile Menu Toggle - FIXED */
    #menuToggle {
        display: block;
        z-index: 1002; /* Ensure it's above other elements */
    }
    
    #menuToggle.active .bar:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    
    #menuToggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    #menuToggle.active .bar:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
    
    /* Mobile Nav Links - FIXED */
    .nav-links {
        position: fixed;
        left: -100%;
        top: var(--header-height-mobile);
        flex-direction: column;
        background-color: var(--header-bg-color);
        width: 100%;
        text-align: center;
        transition: left var(--transition-speed);
        box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        padding: 20px 0;
        z-index: 999;
        height: auto;
        align-items: center;
        display: flex; /* Ensure it's always displayed */
    }
    
    .nav-links.active {
        left: 0;
    }
    
    .nav-links li {
        width: 100%;
        margin: 5px 0;
    }
    
    .nav-links li a {
        padding: 12px 20px;
        width: 100%;
        text-align: center;
        display: block;
    }
    
    /* Mobile Dropdown - FIXED */
    .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        display: none;
        background-color: rgba(0, 0, 0, 0.2);
        border-radius: 0;
        padding: 0;
        margin: 0;
    }
    
    .dropdown.active .dropdown-menu {
        display: block;
    }
    
    .dropdown.active .dropdown-arrow {
        transform: rotate(180deg);
    }
    
    .dropdown-menu li a {
        padding: 12px 15px;
        text-align: center;
    }
    
    /* Make the dropdown toggle more visible on mobile */
    .dropdown-toggle {
        justify-content: center;
        width: 100%;
        padding: 12px 20px !important;
    }
    
    /* Position the arrow for better visibility */
    .dropdown-toggle .dropdown-arrow {
        position: absolute;
        right: 25px;
        top: 50%;
        transform: translateY(-50%);
    }
}