/* Prevent layout shift from scrollbar hide/show */
html {
    scrollbar-gutter: stable;
}

/* Add padding to body for spacing from screen edges */
body {
    margin: 0;
    padding: 20px;
}

/* Base navbar styles */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #333;
    color: #fff;
    position: relative;
    margin: -20px -20px 0 -20px;
}

/* Logo styles */
.navbar .logo {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Navigation links container */
.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    margin: 0 1rem;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    text-decoration: underline;
    color: #ddd;
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none !important;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1003;
    visibility: hidden;
    position: relative;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
}

/* Hamburger lines */
.hamburger-line {
    width: 28px;
    height: 3px;
    background-color: #fff;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* Hamburger animation when active */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Mobile styles */
@media screen and (max-width: 768px) {
    .navbar {
        padding: 15px 20px;
        flex-shrink: 0;
        margin: -20px -20px 0 -20px;
    }

    .mobile-menu-toggle {
        display: flex !important;
        visibility: visible;
        background-color: #333;
        border-radius: 4px;
    }

    .mobile-menu-toggle.active {
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 1004;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 100%;
        background-color: #333;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.3s ease;
        z-index: 1001;
        overflow: hidden;
        overscroll-behavior: contain;
        touch-action: none;
    }

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

    .nav-links a {
        margin: 1.5rem 0;
        font-size: 1.5rem;
        text-align: center;
        width: 100%;
        padding: 1rem;
        border-bottom: 1px solid #555;
        opacity: 0;
        transform: translateX(30px);
        transition:
            opacity 0.3s ease 0.15s,
            transform 0.3s ease 0.15s;
    }

    .nav-links.active a {
        opacity: 1;
        transform: translateX(0);
    }

    .nav-links a:last-child {
        border-bottom: none;
    }

    .nav-links a:hover {
        background-color: #555;
        text-decoration: none;
    }

    /* Ensure navbar content doesn't get covered */
    .navbar {
        position: relative;
        z-index: 1002;
        background-color: #333;
        justify-content: space-between;
        align-items: center;
    }
}

/* Desktop styles -Tablet styles */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    .navbar {
        padding: 0.75rem;
    }

    .nav-links a {
        margin: 0 0.75rem;
        font-size: 0.95rem;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    .navbar {
        padding: 0.75rem;
    }

    .navbar .logo {
        font-size: 1.1rem;
    }

    .nav-links a {
        font-size: 1.3rem;
        margin: 1rem 0;
    }
}
