/* Main content layout with sidebar - Overridden by main.css */
main {
    padding: 100px 20px 20px 20px; /* Consistent padding */
    min-height: 100vh;
    background: #f9f9f9;
    width: 100%;
    transition: margin-left 0.3s ease;
    margin-left: 0; /* Default state: no margin */
}

/* When sidebar is open, add margin */
body.sidebar-open main {
    margin-left: 200px; /* Push content when sidebar is open */
}

@media (max-width: 700px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        box-shadow: none;
        display: none;
    }

    main {
        padding: 80px 10px 10px 10px; /* Adjusted padding for mobile */
    }

    /* No margin on mobile even when sidebar is open */
    body.sidebar-open main {
        margin-left: 0;
    }
}

/* Side navigation styles */
.sidenav {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 999; /* Adjusted to be below header */
    top: 60px; /* Start below header */
    left: 0;
    background-color: #111;
    overflow-x: hidden;
    padding-top: 20px; /* Reduced since we moved below header */
    transition: 0.5s;
    bottom: 0; /* Ensure it extends to bottom */
}

.sidenav a {
    padding: 8px 8px 8px 32px;
    text-decoration: none;
    font-size: 25px;
    color: #818181;
    display: block;
    transition: 0.3s;
}

.sidenav a:hover {
    color: #f1f1f1;
}

.sidenav .closebtn {
    position: absolute;
    top: 70px; /* move down below the fixed header */
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
    z-index: 1200; /* ensure it's above the header */
    pointer-events: auto;
}

.open-nav-btn {
    font-size: 20px;
    cursor: pointer;
    background-color: #111;
    color: white;
    padding: 10px 15px;
    border: none;
    position: fixed;
    top: 70px; /* Below header */
    left: 20px;
    z-index: 1003; /* Higher than both header and sidenav */
    display: none;
}

/* Main content area */
#main {
    transition: margin-left .5s;
    padding: 20px;
}

/* When sidebar is open, shift main content */
.sidenav-open #main {
    margin-left: 250px;
}

/* Responsive adjustments */
@media screen and (max-height: 450px) {
    .sidenav {padding-top: 15px;}
    .sidenav a {font-size: 18px;}
}

@media (max-width: 700px) {
    .open-nav-btn {
        display: block;
    }
    .sidenav-open #main {
        margin-left: 0;
    }
}

/* Header styles */
.main-header {
    background-color: var(--dark-bg);
    padding: 0 2%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900; /* Lower than sidebar */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    width: 100%;
    height: 60px;
    display: flex;
}

.navbar {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Menu toggle button moved to the left */
.menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #6c5ce7; /* Purple-blue color */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 15px;
    height: 60px; /* Match header height for vertical centering */
    transition: color 0.3s;
    order: -1;/* This makes it appear before other flex items */
    position: relative;
    right: -2px; /* Move it 5px to the right */
}

.menu-toggle-btn:hover {
    color: #8e44ad; /* Darker purple on hover */
    text-shadow: 0 0 10px rgba(108, 92, 231, 0.5); /* Add glow effect on hover */
}

.nav-menu {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
    flex: 1;
    justify-content: center; /* Center the nav menu items */
}

.nav-menu li {
    margin: 0; /* Remove left margin */
}

.nav-menu a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s, text-shadow 0.3s;
    display: block;
    padding: 0 1rem; /* Add padding for better touch target */
    text-align: center; /* Center text within the link */
}

/* Site logo styling */
.site-logo {
    height: 44px;
    max-width: 180px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 10px var(--accent-purple));
    margin-left: 15px; /* Add margin to position logo to the right */
    vertical-align: middle; /* Better vertical alignment */
}

@media (max-width: 1024px) {
    .site-logo {
        height: 36px;
        max-width: 120px;
        margin-left: 8px; /* Slightly reduced margin for smaller screens */
    }
}
@media (max-width: 700px) {
    .site-logo {
        height: 30px;
        max-width: 110px;
        margin-left: 5px; /* Even smaller margin for mobile */
    }
}

/* Page title styles */
.page-title {
    margin-top: 0;
    padding-top: 20px;
    color: #2c3e50;
    font-size: 2.5rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 30px;
}

/* Loading animation */
.loading {
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    color: #666;
}

/* Floating close button shown when sidenav is open (fallback) */
.sidenav-close-floating {
  position: fixed;
  top: 14px;
  left: 220px; /* sits to the right of the opened sidenav (250px width) */
  z-index: 1205;
  display: none; /* toggled by JS */
  background: transparent;
  color: white;
  border: none;
  font-size: 28px;
  cursor: pointer;
  padding: 6px 8px;
}

@media (max-width: 700px) {
  .sidenav-close-floating {
    left: 12px; /* small screens: place near left edge */
    top: 74px;
  }
}
