/* ============================
    Root Variables & Reset
============================ */
:root {
  --color-primary: #212121;
  --color-secondary: #FFFFFF;
  --color-hover: #909090;
  --color-unchange: #eee;
  --text-color: #111827;
  --background: #F4F7F6;
  --card-bg: #ffffff;
  --input-border: #d1d5db;
  --input-focus: #2563eb;
  --error-color: #dc2626;
  --success-color: #065f46;
  --success-bg: #d1fae5;
  --placeholder-color: #6b7280;
  --border-radius: 4px;
  --header-height: 60px; /* used to be 60px */
  --footer-height: 80px;
  --transition-speed: 0s;
  --sidebar-width: 75px; /*used to be 200px */
  --sub-sidebar-width: 400px;
  --sub-sidebar-color: #F7F7F7;
  --mobile-sidebar-width: 20vw; /* New: Sidebar size on mobile */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  display: flex;
  flex-direction: column;
  font-family: Arial, sans-serif;
  background: var(--background);
  color: var(--text-color);
}

/* ============================
    Base / Global Styles
============================ */
body {
  margin: 0;
  padding: 0;
  padding-top: var(--header-height);
  /* padding-left for desktop handled in media query */
}

/* ADD Media Query for Desktop Body Padding */
@media (min-width: 769px) {
  body {
    padding-left: var(--sidebar-width);
  }
}

h1, h2, h3 {
  text-align: center;
  margin-top: 1.5rem;
}

p {
  padding-bottom: 20px;
  font-size: 12pt;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

a:hover,
a:focus {
  text-decoration: underline;
  color: var(--color-hover);
}

a:focus {
  outline: 2px solid var(--color-secondary);
}

/* ============================
    Header & Navigation
============================ */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: var(--header-height);
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
}

/* Header text/logo and links container */
.header_container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

header .header_container nav {
    margin-left: auto;
}

header h1,
header .logo {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    flex-shrink: 0;
}

/* Header links */
#header-links,
.nav-list {
    display: flex;
    gap: 15px;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

#header-links a,
.nav-list li a {
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
    color: var(--text-color);
    transition: color var(--transition-speed);
}

#header-links a:hover,
.nav-list li a:hover {
    color: var(--primary-color);
}

/* Mobile menu button (FIXED POSITIONING) */
#menuButton {
    display: block; /* Visible by default on mobile */
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    padding: 5px 10px;
    
    /* MODIFIED: Use fixed position relative to the viewport */
    position: fixed; 
    
    /* Ensure it's at the top left of the entire viewport */
    left: 10px; 
    top: 0; 
    transform: translateY(10px); /* Nudge it down slightly for padding/centering */
    
    z-index: 1001; 
}

#edit-form {
    margin: auto;
    width: 70vh;
}

/* Hide menu button on desktop */
@media (min-width: 769px) {
  #menuButton {
    display: none;
/*    display: block; */
  }
}

.nav-list li:last-child {
  margin-left: auto;
}

.nav-list li a,
header nav ul li a {
  font-weight: 600;
  padding: 0.5rem 0.5rem;
  text-decoration: none;
  color: #333333;
  transition: background-color var(--transition-speed) ease;
}

.nav-list li a:hover,
.dropdown-menu li a:hover,
.site-footer nav a:hover {
  background-color: var(--color-hover);
  border-radius: var(--border-radius);
  color: var(--color-secondary);
}

/* ============================
    Menu & Dropdown
============================ */
.menu-wrapper {
  position: relative;
  display: inline-block;
  margin: auto;
}

.menu-wrapper.open .dropdown-menu {
  display: block;
}

.btn {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  margin: auto;
  justify-content: center;
  background-color: var(--color-primary);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background-color var(--transition-speed) ease;
}

.btn:hover {
  background-color: var(--color-hover);
}

.icon svg {
  width: 30px;
  height: 30px;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background-color: var(--color-primary);
  color: var(--color-secondary);
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  border-radius: var(--border-radius);
  min-width: 150px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.dropdown-menu li {
  padding: 0;
}

.dropdown-menu li a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--color-secondary);
  text-decoration: none;
}

/* ============================
    Sidebar (Mobile Toggable)
============================ */
.site-sidebar {
  position: fixed;
  top: 0; /* Mobile-First: Start at top */
  left: calc(-1 * var(--mobile-sidebar-width)); /* Mobile-First: Start off-screen */
  width: var(--mobile-sidebar-width);
  height: 100vh; /* Mobile-First: Full viewport height */
  background: #ffffff;
  color: #1a1a1a;
  font-size: .88em;
  text-align: center;
  padding-left: 0px;
  padding-top: var(--header-height); /* Ensure content starts below header */
  overflow-y: auto;
  box-shadow: none;
  z-index: 1000;
  transition: var(--transition-speed) ease;
}

/* Class to open sidebar (added via JS to <body>) */
.sidebar-open .site-sidebar {
  transform: translateX(var(--mobile-sidebar-width));
  box-shadow: 2px 0 5px rgba(0,0,0,0.3);
}

.sidebar-container h2 {
  font-size: 1.2em;
  margin-bottom: 10px;
  color: #3F66D1;
}

.sidebar-list {
  list-style: none;
  padding-top: 20px;
}

.sidebar-list li {
  margin: 24px 0;
}

.sidebar-list a {
  color: #1a1a1a;
  padding-top: 20px;
  text-decoration: none;
  transition: var(--transition-speed) ease;
}

.sidebar-list a:hover {
  color: #2A56AB;
}

/* Desktop Sidebar Reset */
@media (min-width: 769px) {
  .site-sidebar {
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    top: var(--header-height);
    transform: none; /* No transform needed */
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    padding-top: 0;
  }
}

/* ============================
    Main Layout & Sticky Footer
============================ */
main {
  flex: 1 0 auto;
  width: 100%;
  margin: auto;
  line-height: 2.5rem;
}

.li {
  padding: 20px;
}

.main-content {
  display: flex;
  width: 100%;
  padding: 0 20px;
}

footer,
.site-footer {
  flex-shrink: 0;
  background-color: var(--color-primary);
  color: var(--color-secondary);
  padding: 1rem;
  text-align: center;
  width: 100%;
  height: var(--footer-height);
}

.site-footer .footer-container {
  justify-content: center;
  align-items: center;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

.site-footer nav {
  margin-top: 0px;
}

.site-footer nav a {
  color: var(--color-secondary);
  margin: 0 10px;
  text-decoration: underline;
}

/* ============================
    Buttons & Inputs
============================ */
button,
input[type=submit] {
  padding: 0.625rem 1rem;
  font-size: 1rem;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background-color var(--transition-speed) ease;
}

button {
  background-color: var(--color-primary);
  color: var(--color-secondary);
  margin-bottom: 20px;
}

button:hover {
  background-color: var(--color-hover);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.3125rem;
  margin-bottom: 0.625rem;
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius);
  font-size: 1rem;
}

input::placeholder {
  color: var(--placeholder-color);
}

input:focus,
textarea:focus {
  border-color: var(--input-focus);
  outline: none;
}

/* ============================
    Sections & Cards
============================ */
section {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: var(--border-radius);
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

ul {
  list-style: none;
  padding-left: 0;
}

ul.note-list li {
  background: var(--color-secondary);
  border: 1px solid var(--color-primary);
  border-radius: var(--border-radius);
  height: 20px;
  padding: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 10pt;
}

/* ============================
    Profile Page
============================ */
.profile-page {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  background-color: var(--color-secondary);
}

.profile-page h2 {
  margin-bottom: 1rem;
  text-align: center;
  color: var(--color-primary);
}

.profile-page form {
  max-width: 500px;
  margin: 0 auto;
  background-color: var(--card-bg);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.profile-page input[disabled] {
  background-color: var(--color-unchange);
  color: var(--color-primary);
}

.profile-page input[type="checkbox"] {
  transform: scale(1.2);
  margin-top: 0.5rem;
}

.profile-page img {
  display: block;
  margin: 0.5rem 0 1rem 0;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-primary);
  max-width: 100%;
}

.profile-page button:hover {
  background-color: var(--color-hover);
}

.profile-page .message {
  text-align: center;
  font-weight: bold;
  margin-bottom: 1rem;
  padding: 0.5rem;
  border-radius: var(--border-radius);
}

.profile-page .message.success {
  background-color: var(--color-primary);
  color: #2e7d32;
  border: 1px solid var(--color-primary);
}

.profile-page .message.error {
  background-color: var(--color-secondary);
  color: var(--color-primary);
  border: 1px solid var(--color-secondary);
}

/* ============================
    Auth Pages
============================ */
.auth-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: var(--background);
  color: var(--text-color);
}

.login-container {
  /* On desktop, sidebar width is compensated for in the margin, which we remove on mobile */
  margin-left: 0;
  background-color: var(--card-bg);
  padding: 2.5rem;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

/* Desktop-only adjustment for login to center it despite the sidebar */
@media (min-width: 769px) {
    .login-container {
        margin-left: calc(var(--sidebar-width) * -1);
    }
}

.login-container h2 {
  text-align: center;
  margin-bottom: 1rem;
}

.login-container form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-container button {
  width: 100%;
  background-color: var(--color-primary);
}

.login-container button:hover {
  background-color: var(--color-hover);
}

.error-message,
.success-message {
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.error-message {
  background-color: var(--color-secondary);
  color: var(--error-color);
}

.success-message {
  background-color: var(--success-bg);
  color: var(--success-color);
}

/* ============================
    Responsive Styles
============================ */
@media (max-width: 768px) {
  
  /* Reset Body Padding for Mobile */
  body {
    padding-left: 0;
  }

  /* Dim the screen/main content when the sidebar is open to create a backdrop effect */
  .sidebar-open main {
    pointer-events: none; /* Disables interaction with content underneath */
    opacity: 0.5;
    transition: var(--transition-speed) ease;
  }
  
  /* Header and Navigation */
  header {
    padding: 0 10px; /* Reduced padding */
  }

  .header_container {
    justify-content: flex-end; 
  }
  
  /* Hide desktop links/nav bar */
  #header-links,
  .nav-list {
    display: none;
  }
  
  header h1, header .logo {
    /* Center the logo */
    position: absolute;
    left: 50%;
    transform: translate(-50%, 0);
  }
  
  /* Main Content Padding */
  .main-content {
    padding: 0 15px;
  }
  
  /* Login Container (Ensure full width) */
  .login-container {
    max-width: 90%;
    padding: 1.5rem;
  }
  
  /* Profile Page Layout */
  .profile-page {
    padding: 1rem;
  }
}

.edit-btn {
  background: #ffc107;
  color: #212529;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition-speed) ease;
  margin-right: 5px;
}

.edit-btn:hover {
  background: #e0a800;
}

.cancel-edit {
  display: inline-block;
  margin-top: 10px;
  color: var(--danger-color);
  text-decoration: none;
  font-weight: 500;
}
.cancel-edit:hover {
  text-decoration: underline;
}

/* Dropdown Container */
.dropdown {
  position: relative;
}

/* Main button for dropdown */
.dropbtn {
  cursor: pointer;
  display: inline-block;
  font-weight: 600;
  padding: 0.5rem 0.5rem;
  color: #333333;
  text-decoration: none;
}

/* Dropdown content (hidden by default) */
.dropdown-content {
  display: none;
  position: absolute;
  top: 100%; /* Position directly below the link */
  left: auto;
  right: 0;
  background-color: #ffffff;
  min-width: 160px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  border-radius: var(--border-radius);
  z-index: 1000;
  padding: 0.5rem 0;
}

/* Dropdown links */
.dropdown-content li {
  list-style: none;
}

.dropdown-content li a {
  color: #333333;
  padding: 0.5rem 1rem;
  display: block;
  text-decoration: none;
}

.dropdown-content li a:hover {
  background-color: var(--color-hover);
  color: var(--color-secondary);
  border-radius: var(--border-radius);
}

/* Show the dropdown on hover (desktop) */
.dropdown:hover .dropdown-content {
  display: block;
}

/* Optional: arrow hover color change */
.dropdown:hover .dropbtn {
  color: var(--color-hover);
}

