/* ============================================
   RIVER BLUE SERVICES - NAVIGATION
   Clean Mobile-First Implementation
   ============================================ */

/* Reset & Base Header */
#header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

/* Logo */
#logo img {
    max-height: 80px;
    width: auto;
    display: block;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #333;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease;
}

.mobile-menu-toggle:hover {
    color: #00A8E8;
}

.mobile-menu-toggle i {
    display: block;
}

/* ============================================
   DESKTOP NAVIGATION (Default)
   ============================================ */

#nav {
    display: block;
}

#nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#nav > ul > li {
    position: relative;
    margin: 0;
    padding: 0;
}

#nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    white-space: nowrap;
}

#nav > ul > li > a:hover,
#nav > ul > li > a.active {
    color: #00A8E8;
}

/* Dropdown Styles - Desktop */
.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    border-radius: 8px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    z-index: 9999;
}

/* Click-based dropdown for touch devices and tablets */
.has-dropdown.open .dropdown {
    display: block !important;
}

/* Desktop hover - only for large non-touch screens */
@media (min-width: 1367px) and (hover: hover) and (pointer: fine) {
    .has-dropdown:hover .dropdown {
        display: block;
    }
}

.dropdown li {
    margin: 0;
    padding: 0;
}

.dropdown a {
    padding: 0.75rem 1.5rem;
    color: #333;
    text-align: center;
}

.dropdown a:hover {
    background: rgba(0, 168, 232, 0.08);
    color: #00A8E8;
}

/* Phone Button */
.nav-phone {
    background: linear-gradient(135deg, #00A8E8 0%, #0088BB 100%);
    color: white !important;
    border-radius: 25px;
    padding: 0.75rem 1.5rem !important;
    transition: all 0.2s ease;
}

.nav-phone:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 168, 232, 0.3);
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

@media (max-width: 767px) {

    /* Show hamburger */
    .mobile-menu-toggle {
        display: block;
    }

    /* Logo size */
    #logo img {
        max-height: 60px;
    }

    /* Mobile menu container */
    #nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        transition: right 0.3s ease;
        padding-top: 80px;
    }

    #nav.active {
        right: 0;
    }

    /* Stack menu vertically */
    #nav ul {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    #nav > ul > li {
        width: 100%;
        border-bottom: 1px solid #eee;
    }

    #nav > ul > li:last-child {
        border-bottom: none;
    }

    #nav a {
        padding: 1rem 1.5rem;
        text-align: left;
        width: 100%;
    }

    /* Dropdown parent toggle */
    .has-dropdown > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .has-dropdown > a::after {
        content: '\f078';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        font-size: 0.75rem;
        transition: transform 0.3s ease;
        opacity: 0.7;
    }

    .has-dropdown.open > a::after {
        transform: rotate(180deg);
    }

    /* Mobile dropdown - override all other rules */
    #nav .dropdown {
        display: none !important;
        position: static !important;
        transform: none !important;
        box-shadow: none !important;
        background: #f8f8f8 !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        min-width: auto !important;
        left: auto !important;
        top: auto !important;
    }

    #nav .has-dropdown.open .dropdown {
        display: block !important;
    }

    .dropdown a {
        padding: 0.875rem 1.5rem 0.875rem 3rem;
        text-align: left;
        font-size: 0.95rem;
    }

    .dropdown a:hover {
        background: rgba(0, 168, 232, 0.1);
    }

    /* Phone button mobile */
    .nav-phone {
        border-radius: 8px;
        margin: 0.5rem 1rem;
        text-align: center;
        justify-content: center;
    }

    .nav-phone i {
        margin-right: 0.5rem;
    }

    /* Overlay */
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        animation: fadeIn 0.3s ease;
    }

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

    /* Prevent scroll when menu open */
    body.menu-open {
        overflow: hidden;
    }

    /* Scrollbar for menu */
    #nav::-webkit-scrollbar {
        width: 4px;
    }

    #nav::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    #nav::-webkit-scrollbar-thumb {
        background: #00A8E8;
        border-radius: 2px;
    }
}

/* Tablet adjustments (including iPads) */
@media (min-width: 768px) and (max-width: 1366px) {
    #nav a {
        padding: 0.75rem 0.875rem;
        font-size: 0.95rem;
    }

    /* Dropdown parent toggle */
    .has-dropdown > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .has-dropdown > a::after {
        content: '\f078';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        font-size: 0.75rem;
        margin-left: 0.5rem;
        transition: transform 0.3s ease;
        opacity: 0.7;
    }

    .has-dropdown.open > a::after {
        transform: rotate(180deg);
    }

    /* Tablet dropdown - click to toggle */
    .dropdown {
        display: none !important;
        position: absolute;
        min-width: 220px;
    }

    .has-dropdown.open .dropdown {
        display: block !important;
    }
}
