* {
    box-sizing: border-box;
}

/* Navigation Bar */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    height: 80px;
    padding: 0.5em 1em;
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 50%, #8B4513 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #FFFBE9;
    border-bottom: none;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: all 0.12s ease;
    box-shadow: 0 2px 15px rgba(139, 69, 19, 0.1);
}

.nav::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg,
        rgba(255, 215, 0, 0) 0%,
        rgba(255, 215, 0, 0.95) 18%,
        rgba(255, 244, 191, 1) 50%,
        rgba(255, 215, 0, 0.95) 82%,
        rgba(255, 215, 0, 0) 100%);
    pointer-events: none;
}

.nav.scrolled {
    background: linear-gradient(135deg, #6B4423 0%, #8B4513 50%, #6B4423 100%);
    height: 65px;
    box-shadow: 0 4px 20px rgba(139, 69, 19, 0.2);
}

.nav.scrolled::after {
    height: 2px;
    opacity: 0.95;
}

/* Left Section Container */
.nav-left {
    display: flex;
    align-items: center;
    min-width: 0;
    max-width: 35%;
}

/* Logo and School Name */
.nav .logo-container {
    height: 60px;
    width: 60px;
    flex: 0 0 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.nav .logo-container a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.nav .logo {
    width: 60px;
    height: auto;
    margin-top: 18px;
    object-fit: contain;
}

/* School Name Link */
.nav .school-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    height: 100%;
    padding: 1px 15px 1px 0;
    flex: 0 1 auto;
}

.nav .school-text {
    display: flex;
    align-items: center;
    margin-left: 15px;
    height: 100%;
}

.nav .school-name {
    font-size: min(2.5rem, calc(var(--nav-height, 80px) * 0.45));
    font-weight: 50;
    font-family: "Monotype Corsiva", cursive;
    font-style: italic;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin: 0;
    white-space: nowrap;
    line-height: 1;
    padding: 0.1em 0;
}

/* Right Section: Navigation and Hamburger */
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 6px;
    font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.nav-links li {
    display: inline-flex;
    align-items: center;
}

.nav-links a {
    color: #FFFBE9;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.nav-links a:hover {
    background-color: rgba(255, 251, 233, 0.2);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Dropdown Styles */
.dropdown {
    position: relative;
}

.dropbtn {
    background: transparent;
    border: none;
    color: inherit;
    font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    padding: 6px 10px;
    margin: 0;
    white-space: nowrap;
}

.nav .login-item {
    display: inline-flex;
    align-items: center;
}

.nav .login-button {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    background: rgba(255, 251, 233, 0.08);
    color: #FFFBE9;
    border: 1px solid rgba(255, 244, 191, 0.7);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.nav .login-button:hover,
.nav .login-button:focus-visible {
    background: rgba(255, 244, 191, 0.18);
    border-color: rgba(255, 244, 191, 0.95);
    transform: translateY(-1px);
    outline: none;
}

/* Updated Dropdown Content Styles */
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(92, 58, 0, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    min-width: 180px;
    box-shadow: 0 2px 5px rgba(139, 69, 19, 0.3);
    border-radius: 4px;
    z-index: 1000;
    border: 1px solid rgba(245, 245, 220, 0.2);
}

.dropdown-content a {
    font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    padding: 10px 15px;
    white-space: nowrap;
    display: block;
    width: 100%;
}

.dropdown-content.show {
    display: block;
}

/* Sub-dropdown Styles */
.dropdown-submenu {
    position: relative;
}

.sub-dropdown-content {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    background: rgba(92, 58, 0, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    min-width: 180px;
    box-shadow: 0 2px 5px rgba(139, 69, 19, 0.3);
    border-radius: 4px;
    z-index: 1000;
    border: 1px solid rgba(245, 245, 220, 0.2);
}

.sub-dropdown-content.show {
    display: block;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    cursor: pointer;
    width: 30px;
    height: 24px;
    flex-direction: column;
    justify-content: space-between;
    background: none;
    padding: 0;
    margin-left: 15px;
    flex-shrink: 0;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #fff4bf;
    border-radius: 3px;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .nav {
        height: 68px;
        padding: 0.45rem 0.8rem;
    }

    .nav-left {
        max-width: calc(100% - 64px);
    }

    .nav .logo-container {
        height: 50px;
        width: 50px;
        flex-basis: 50px;
    }

    .nav .logo {
        width: 50px;
        margin-top: 8px;
    }

    .nav .school-link {
        padding-right: 0;
    }

    .nav .school-text {
        margin-left: 10px;
    }

    .nav .school-name {
        font-size: 1.25rem;
        line-height: 1.05;
        letter-spacing: 0.01em;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .nav-right {
        gap: 8px;
    }

    .hamburger {
        display: flex;
        width: 34px;
        height: 26px;
        border: none;
        align-items: center;
    }

    .hamburger span {
        background-color: #fff4bf;
        height: 2.5px;
    }

    .hamburger.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 68px;
        left: 0;
        right: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 12px;
        background: linear-gradient(180deg, rgba(107, 68, 35, 0.98) 0%, rgba(80, 46, 20, 0.98) 100%);
        border-top: 1px solid rgba(255, 244, 191, 0.2);
        box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li,
    .nav .login-item {
        width: 100%;
    }

    .nav-links a,
    .nav .login-button {
        width: 100%;
        justify-content: space-between;
        padding: 12px 14px;
        border-radius: 12px;
        font-size: 0.96rem;
        line-height: 1.2;
    }

    .nav-links a {
        background: rgba(255, 251, 233, 0.06);
    }

    .nav-links a:hover,
    .nav-links a:focus-visible {
        background: rgba(255, 244, 191, 0.14);
    }

    .dropdown-content,
    .sub-dropdown-content {
        position: static;
        display: none;
        min-width: 0;
        margin-top: 8px;
        margin-left: 0;
        border-radius: 12px;
        box-shadow: none;
        border: 1px solid rgba(255, 244, 191, 0.18);
        background: rgba(53, 31, 12, 0.78);
    }

    .dropdown-content a,
    .sub-dropdown-content a {
        padding: 11px 14px;
        font-size: 0.93rem;
    }
}

@media (max-width: 480px) {
    .nav {
        height: 64px;
        padding: 0.4rem 0.7rem;
    }

    .nav .logo-container {
        height: 44px;
        width: 44px;
        flex-basis: 44px;
    }

    .nav .logo {
        width: 44px;
    }

    .nav .school-text {
        margin-left: 8px;
    }

    .nav .school-name {
        font-size: 1.08rem;
    }

    .nav-links {
        top: 64px;
        padding: 10px;
    }

    .nav-links a,
    .nav .login-button {
        padding: 11px 12px;
        font-size: 0.92rem;
    }
}
