/**
 * Multi-Level Navigation Menu CSS
 * Supports nested dropdowns for Education and Health categories
 */

/* ===================================================================
   Base Navigation Styles
   =================================================================== */

.navbar {
    background: linear-gradient(to right, #f8fafc, #f1f5f9);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.nav-container {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.nav-brand {
    flex-shrink: 0;
}

.logo-placeholder {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1e40af, #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

/* ===================================================================
   Navigation Menu
   =================================================================== */

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 5px;
}

.nav-menu > li {
    position: relative;
}

.nav-link {
    display: block;
    padding: 0.75rem 1.25rem;
    color: #1f2937;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    background: #dbeafe;
    color: #1e40af;
}

/* Dropdown Arrow */
.dropdown-arrow {
    font-size: 0.7em;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.nav-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* ===================================================================
   First Level Dropdown Menu
   =================================================================== */

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 220px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    list-style: none;
    margin: 0;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

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

.dropdown-menu li {
    position: relative;
}

.dropdown-menu li a {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.85rem;
}

.dropdown-menu li a:hover {
    background-color: #f9fafb;
    color: #1e40af;
    padding-left: 25px;
}

/* ===================================================================
   Nested Dropdown (Second Level)
   =================================================================== */

.nav-dropdown-nested {
    position: relative;
}

.nested-arrow {
    float: right;
    margin-left: 10px;
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.nav-dropdown-nested:hover .nested-arrow {
    transform: translateX(3px);
}

.nested-dropdown-menu {
    position: absolute;
    top: 0;
    left: 100%;
    background: white;
    min-width: 220px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    list-style: none;
    margin: 0;
    margin-left: 5px;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.nav-dropdown-nested:hover > .nested-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nested-dropdown-menu li a {
    display: block;
    padding: 10px 20px;
    color: #555;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.nested-dropdown-menu li a:hover {
    background-color: #f8f8f8;
    color: #1e40af;
    padding-left: 25px;
}

/* ===================================================================
   Mobile Navigation Toggle
   =================================================================== */

.nav-toggle {
    display: none;
    flex-direction: column;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.nav-toggle span {
    width: 1.5rem;
    height: 2px;
    background: #1f2937;
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 3px;
}

/* ===================================================================
   Active States
   =================================================================== */

.nav-link.active {
    background: #dbeafe;
    color: #1e40af;
}

/* ===================================================================
   Hover Effects
   =================================================================== */

.has-nested > .dropdown-menu {
    padding: 5px 0;
}

.nav-dropdown-nested > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===================================================================
   Mobile Responsive Styles
   =================================================================== */

@media screen and (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: white;
        flex-direction: column;
        align-items: flex-start;
        padding: 5rem 2rem 2rem;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        overflow-y: auto;
        gap: 0;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-menu > li {
        width: 100%;
    }

    .nav-link {
        padding: 0.75rem 1.25rem;
        width: 100%;
    }

    /* Mobile Dropdown Styles */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #f9fafb;
        border-radius: 0.375rem;
        margin-left: 1rem;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        padding: 0;
        border: none;
    }

    .nav-dropdown.active > .dropdown-menu {
        max-height: 1000px;
        padding: 10px 0;
    }

    .dropdown-menu li a {
        color: #1f2937;
        padding-left: 1.25rem;
    }

    .dropdown-menu li a:hover {
        background-color: #f3f4f6;
        color: #1e40af;
    }

    /* Mobile Nested Dropdown */
    .nested-dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #e0f2fe;
        border-radius: 0.375rem;
        margin-left: 1rem;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        padding: 0;
    }

    .nav-dropdown-nested.active > .nested-dropdown-menu {
        max-height: 500px;
        padding: 5px 0;
    }

    .nested-dropdown-menu li a {
        padding-left: 1.25rem;
        color: #1f2937;
        font-size: 0.9rem;
    }

    .nested-dropdown-menu li a:hover {
        background-color: #bfdbfe;
        color: #1e40af;
    }

    .dropdown-arrow,
    .nested-arrow {
        float: right;
    }

    /* Mobile Toggle Animation */
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
}

/* ===================================================================
   Tablet Responsive Styles
   =================================================================== */

@media screen and (max-width: 1024px) and (min-width: 769px) {
    .nav-link {
        padding: 1rem 1.2rem;
        font-size: 0.95rem;
    }

    .dropdown-menu,
    .nested-dropdown-menu {
        min-width: 200px;
    }
}

/* ===================================================================
   Accessibility
   =================================================================== */

.nav-link:focus,
.dropdown-menu li a:focus,
.nested-dropdown-menu li a:focus {
    outline: 2px solid #1e40af;
    outline-offset: 2px;
}

/* Skip to content link for screen readers */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}
