/* Reset margins and padding for the entire page */
body, html {
    margin: 0;
    padding: 0; /* Corrected padding */
    /* box-sizing will be handled globally in Hii.css */
}

/* Navigation Bar Styles */
nav {
    background-color: var(--dark-bg-secondary); /* Applied dark theme */
    padding: 10px 20px; /* Adjusted padding */
    border-radius: 8px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: space-between; /* Changed */
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease; /* For sliding effect */
}

.nav-cipher-title {
    font-size: 1.4em;
    color: var(--dark-text-primary);
    font-weight: bold;
    margin-right: auto; /* Pushes other items to the right if needed, or rely on space-between */
}

/* Centering the links inside the nav */
nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
}

/* Individual list items and links */
nav li {
    margin-right: 10px;
}

nav a {
    color: var(--dark-text-primary); /* Applied dark theme */
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

nav a:hover {
    background-color: var(--dark-accent-hover); /* Applied dark theme */
}

nav a.active {
    background-color: var(--dark-accent-primary); /* Applied dark theme */
}

/* Hamburger menu button (hidden on large screens) */
.menu-btn {
    display: none;
    background-color: transparent;
    border: none;
    color: var(--dark-text-primary); /* Applied dark theme */
    font-size: 30px;
    cursor: pointer;
    position: absolute;
    top: 10px;
    left: 10px;
}

/* Sidebar styles for mobile view */
.sidebar {
    position: fixed;
    top: 0;
    left: 0; /* Start at the edge for transform to work as expected */
    transform: translateX(-100%); /* Initially hidden */
    width: 250px;
    height: 100%;
    background-color: var(--dark-bg-secondary); /* Applied dark theme */
    padding-top: 60px; /* To avoid overlap with the menu button */
    z-index: 1000;
    transition: transform 0.3s ease; /* Slide-out effect */
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
}

/* Sidebar ul and links */
.sidebar ul {
    display: block;
    flex-direction: column;
    align-items: start;
    padding-left: 20px;
}

.sidebar li {
    margin: 10px 0;
}

.sidebar a {
    display: block;
    padding: 10px;
    color: var(--dark-text-primary); /* Applied dark theme */
    text-decoration: none;
}

.sidebar a:hover {
    background-color: var(--dark-accent-hover); /* Applied dark theme */
}

.sidebar a.active {
    background-color: var(--dark-accent-primary); /* Applied dark theme */
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    nav {
        /* justify-content: space-between; already set, title on left, menu button on right */
    }
    .nav-cipher-title {
        font-size: 1.2em; /* Slightly smaller on mobile */
    }
    /* Hide horizontal navbar, show hamburger menu */
    nav ul {
        display: none;
    }

    .menu-btn {
        display: block; /* Show the menu button */
        position: static; /* Remove absolute positioning to let flexbox handle it */
        order: 3; /* Ensure it's on the far right if title and links were grouped */
    }

    .sidebar {
        display: block; /* Make sidebar visible */
    }
}

/* Open sidebar (when the menu button is clicked) */
.sidebar.open {
    transform: translateX(0); /* Slide the sidebar in */
}
/* Style for the hamburger menu button */
/* Style for the hamburger menu button */
.menu-btn {
    display: none; /* Hidden by default */
    background-color: var(--dark-bg-secondary); /* Applied dark theme */
    border: none; /* Remove default border */
    color: var(--dark-text-primary); /* Applied dark theme */
    font-size: 30px; /* Size of the hamburger icon */
    cursor: pointer; /* Pointer cursor */
    padding: 2px; /* Add padding for touch area */
    border-radius: 5px; /* Rounded corners */
    transition: background-color 0.3s ease; /* Smooth hover effect */
    position: absolute; /* Place it on the top */
    top: 10px; /* Adjust top position */
    right: 10px; /* Adjust right position if not using flex order */
}

.menu-btn:hover {
    background-color: var(--dark-accent-hover); /* Applied dark theme */
}

/* Show the button on small screens */
@media (max-width: 768px) {
    .menu-btn {
        display: block; /* Show the button on small screens */
         /* position: static; /* Already set above */
    }
}

/* Style for the menu (initially hidden) */
nav ul {
    display: flex; /* Default behavior */
    flex-direction: row; /* Horizontal layout */
    margin-left: auto; /* Pushes links to the right of the title */
}

@media (max-width: 768px) {
    nav ul {
        display: none; /* Hide the menu by default on small screens */
        flex-direction: column; /* Vertical layout for small screens */
        position: absolute; /* Position relative to the button */
        top: 50px; /* Place below the button */
        right: 0;
        background-color: var(--dark-bg-secondary); /* Applied dark theme */
        width: 200px; /* Menu width */
        border-radius: 0 0 8px 8px; /* Rounded corners at the bottom */
        box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2); /* Add shadow */
    }

    /* Show the menu when active */
    nav ul.active {
        display: flex;
    }
}
