/* ------------------------------------------------------ */
/* NAV BAR                                                 */
/* ------------------------------------------------------ */

.navbar {
    height: 120px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 20px;
    box-sizing: border-box;

    background-image: url('images/LightModeNavBar.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

body.dark .navbar {
    background-image: url('images/DarkModeNavBar.png');
}


/* ------------------------------------------------------ */
/* NAV LINKS                                               */
/* ------------------------------------------------------ */

.nav-links {
    list-style: none;
    display: flex;
    gap: 25px;
    margin-left: -10px;
}

.navbar,
.nav-links a,
.dropdown-menu li a {
    font-family: 'Gochi Hand', cursive;
    font-weight: 700;
    line-height: 1.1;
}

.nav-links a {
    color: black;
}

body.dark .nav-links a {
    color: white;
}


/* ------------------------------------------------------ */
/* UNDERLINE (2px + wiggle animation)                      */
/* ------------------------------------------------------ */

.nav-links a,
.dropdown-menu li a {
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size 0.25s ease;
}

@keyframes wiggleUnderline {
    0% { background-position: 0 100%; }
    25% { background-position: 2px 100%; }
    50% { background-position: -2px 100%; }
    75% { background-position: 2px 100%; }
    100% { background-position: 0 100%; }
}

.nav-links a:hover,
.dropdown-menu li a:hover {
    background-size: 100% 2px;
    animation: wiggleUnderline 0.25s ease;
}


/* ------------------------------------------------------ */
/* DROPDOWN MENUS                                          */
/* ------------------------------------------------------ */

.dropdown {
    position: relative;
    padding-bottom: 5px;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% - 5px);
    left: 0;
    min-width: 180px;
    padding: 12px 0;
    list-style: none;
    background: #aedb78;
    border-radius: 8px;
    display: none;
    z-index: 10;
}

.dropdown-menu li a {
    color: black;
}

body.dark .dropdown-menu {
    background: #602aac;
}

body.dark .dropdown-menu li a {
    color: white;
}

.nav-links > li:last-child .dropdown-menu {
    right: 0;
    left: auto;
}

.dropdown-menu li {
    padding: 10px 20px;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

@keyframes dropdownBounce {
    0% { opacity: 0; transform: translateY(10px) scale(0.98); }
    60% { opacity: 1; transform: translateY(0) scale(1.03); }
    100% { transform: translateY(0) scale(1); }
}

.dropdown:hover .dropdown-menu {
    display: block;
    animation: dropdownBounce 0.35s ease;
}


/* ------------------------------------------------------ */
/* DARK MODE SWITCH (SUN LEFT / MOON RIGHT)                */
/* ------------------------------------------------------ */

/* DARK MODE SWITCH (MOON LEFT / SUN RIGHT, OUTSIDE KNOB) */
.dark-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    border-radius: 30px;
    border: none;
    cursor: pointer;
    background-color: #a8d8ff; /* light mode */
    transition: background 0.3s ease;
}

/* Moon on the LEFT, outside the track */
.icon-moon {
    position: absolute;
    left: 0px;
    top: 40%;
    transform: translateY(-50%);
    font-size: 18px;
    opacity: 0;          /* hidden in light mode */
    pointer-events: none;
}

/* Sun on the RIGHT, outside the track */
.icon-sun {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    opacity: 1;          /* visible in light mode */
    pointer-events: none;
}

/* Dark mode background */
body.dark .dark-toggle {
    background-color: #c9a8ff;
}

/* Swap visibility in dark mode */
body.dark .icon-moon {
    opacity: 1;
}

body.dark .icon-sun {
    opacity: 0;
}

/* Knob inside the track */
.dark-toggle::before {
    content: "";
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: white;
    left: 2px;  /* starts on left */
    top: 2px;
    transition: transform 0.3s ease;
}

/* Knob slides right in dark mode */
body.dark .dark-toggle::before {
    transform: translateX(30px);
}

/* ------------------------------------------------------ */
/* MOBILE RESPONSIVE                                       */
/* ------------------------------------------------------ */

@media (max-width: 768px) {

    .navbar {
        height: 140px;
        background-image: url('images/navbar-mobile-light.png');
    }

    body.dark .navbar {
        background-image: url('images/navbar-mobile-dark.png');
    }

    .nav-links {
        flex-direction: column;
        gap: 10px;
        margin-left: 0;
    }

    .dropdown-menu {
        position: static;
        background: #aedb78;
        padding-left: 20px;
        display: none;
    }

    body.dark .dropdown-menu {
        background: #602aac;
    }

    .dropdown-menu li a {
        color: black;
    }

    body.dark .dropdown-menu li a {
        color: white;
    }

    .dropdown:active .dropdown-menu,
    .dropdown:focus-within .dropdown-menu {
        display: block;
    }

    .nav-links a {
        padding: 12px 0;
    }
}
