@font-face { font-family: 'Roboto'; src: url('/fonts/roboto-400.woff2') format('woff2'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Roboto'; src: url('/fonts/roboto-700.woff2') format('woff2'); font-weight: 700; font-style: normal; }
@font-face { font-family: 'Oxygen'; src: url('/fonts/oxygen-400.woff2') format('woff2'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Shrikhand'; src: url('/fonts/shrikhand-400.woff2') format('woff2'); font-weight: 400; font-style: normal; }

:root {
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --heading-color: #ffffff;
  --header-bar: #1A57E5;
  --sidebar-bg: #121212;
  
  /* Color Palette */
  --card-l1-bg: #1e1e1e;   /* Guide Container */
  --card-l2-bg: #2d2d2d;   /* Module Item */
  
  --link-color: #1ABDE5;
  --link-hover: #1AE5A8;
  --bmc-bg: #FFDD00;
  --bmc-text: #121212;
  --theme-toggle-bg: #ffffff;
  --shadow-resting: 0 2px 5px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.6);
}

html.light-theme, body.light-theme {
  --bg-color: #f5f5f5;
  --text-color: #333333;
  --heading-color: #000000;
  --sidebar-bg: #ffffff;
  --card-l1-bg: #eeeeee;
  --card-l2-bg: #ffffff;
  --theme-toggle-bg: #2a2a2a;
  --shadow-resting: 0 2px 4px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; }
body { margin: 0; padding: 0; background-color: var(--bg-color); color: var(--text-color); font-family: 'Oxygen', sans-serif; line-height: 1.6; }
h1, h2, h3, h4, h5, h6 { font-family: 'Roboto', sans-serif; color: var(--heading-color); margin-top: 1.5em; margin-bottom: 0.2em; line-height: 1.2; }
h1:first-child, h2:first-child { margin-top: 0; }
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
.site-title { font-family: 'Shrikhand', cursive; margin: 0; font-size: 1.5rem; font-weight: 400; color: #ffffff; letter-spacing: 0.05em; }
a { color: var(--link-color); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--link-hover); }
.back-link { display: inline-block; margin-bottom: 0.2em; font-weight: 700; font-size: 1.15rem; }

#master-menu-toggle { display: none; }
.layout-wrapper { display: flex; flex-direction: column; min-height: 100vh; padding-top: 60px; }
.mobile-header { position: fixed; top: 0; left: 0; width: 100%; height: 60px; background-color: var(--header-bar); display: flex; align-items: center; justify-content: center; z-index: 1000; box-shadow: var(--shadow-resting); }
.mobile-header .site-title { margin-top: 1px; font-size: 1.65rem;  width: 100%; text-align: center;}
.mobile-header label { position: absolute; left: 15px; cursor: pointer; color: #ffffff; font-size: 1.5rem; font-weight: 400;  z-index: 10;}
.desktop-hamburger { display: none; }
#sidebar { display: flex; position: fixed; top: 60px; left: 0; width: 100%; height: calc(100vh - 60px); z-index: 999; overflow-y: auto; background-color: var(--sidebar-bg); flex-direction: column; box-shadow: var(--shadow-resting); transform: translateY(-120%); opacity: 0; visibility: hidden; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, visibility 0.4s; }
#master-menu-toggle:checked ~ .layout-wrapper #sidebar { transform: translateY(0); opacity: 1; visibility: visible; }
main { width: 100%; padding: 20px 20px 100px; }
.sidebar-inner { display: flex; flex-direction: column; min-height: 100%; padding: 20px 10px; }


/* --- MATERIAL CONTAINER LOGIC --- */

.nav-menu { list-style: none; padding: 0; margin: 0; }
.sub-menu { list-style: none; padding: 0; margin: 0; max-height: 0; opacity: 0; overflow: hidden; visibility: hidden; transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, padding 0.4s ease, visibility 0.4s; }
.nav-menu li.has-children.expanded > .sub-menu { max-height: 1500px; opacity: 1; visibility: visible; }
.nav-menu li.has-children > a::before { content: '▶ '; font-size: 0.8em; display: inline-block; margin-right: 8px; opacity: 0.7; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.nav-menu li.has-children.expanded > a::before { transform: rotate(90deg); }

/* LEVEL 1: GUIDE (The Wrapper Card) */
/* The styling goes on the LI so it wraps everything */
.nav-menu > li {
  background-color: var(--card-l1-bg);
  border-radius: 8px;
  box-shadow: var(--shadow-resting);
  margin-bottom: 12px;
  overflow: hidden; /* Ensures corners stay rounded */
  transition: box-shadow 0.2s ease;
}
/* The link itself is just a transparent block inside the wrapper */
.nav-menu > li > a {
  font-family: 'Roboto', sans-serif;
  display: block;
  padding: 14px 16px;
  color: var(--text-color);
  font-weight: 700;
  font-size: 1.1em;
  background-color: transparent; /* Transparent so LI color shows */
}
.nav-menu > li > a:hover {
  background-color: rgba(255, 255, 255, 0.05); /* Subtle highlight */
}

/* LEVEL 2: MODULES (The Inner Blocks) */
.nav-menu > li > .sub-menu {
  padding: 0 10px 10px 10px; /* Padding inside the expanded guide */
}
.nav-menu > li > .sub-menu > li > a {
  font-family: 'Roboto', sans-serif;
  display: block;
  padding: 10px 12px;
  color: var(--text-color);
  background-color: var(--card-l2-bg); /* Lighter contrast */
  margin-top: 6px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95em;
  border-left: 3px solid var(--header-bar); /* Accent strip */
}
.nav-menu > li > .sub-menu > li > a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateX(2px);
}

/* LEVEL 3: PAGES (The Flat List) */
.nav-menu > li > .sub-menu > li > .sub-menu {
  padding-left: 12px;
  padding-bottom: 6px;
  background-color: var(--card-l2-bg); /* Match Level 2 background */
  margin-top: -4px; /* Connect visually */
  border-radius: 0 0 6px 6px;
}
.nav-menu > li > .sub-menu > li > .sub-menu > li > a {
  padding: 6px 0 6px 10px;
  margin: 0;
  font-size: 0.9em;
  color: var(--text-color);
  opacity: 0.8;
  background-color: transparent;
  border: none;
}
.nav-menu > li > .sub-menu > li > .sub-menu > li > a:hover {
  color: var(--link-hover);
  opacity: 1;
}

/* --- ACTIONS --- */
.sidebar-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 32px; width: 100%; flex-shrink: 0; padding-bottom: 20px; }
.action-btn { font-family: 'Roboto', sans-serif; text-transform: uppercase; font-weight: 700; width: 100%; border: none; border-radius: 6px; cursor: pointer; display: flex; align-items: center; padding: 0 15px; box-shadow: var(--shadow-resting); }
.download-wrapper { display: flex; gap: 10px; width: 100%; }
.btn-download { background-color: var(--card-l1-bg); color: var(--text-color); height: 40px; justify-content: center; flex: 1; }
.btn-delete { background-color: var(--card-l1-bg); color: var(--text-color); height: 40px; width: 40px; justify-content: center; padding: 0; flex-shrink: 0; font-size: 1.2rem; }
.btn-bmc { background-color: var(--bmc-bg); color: var(--bmc-text); height: 52px; justify-content: center; } .btn-emoji { margin-right: 10px; }
.theme-toggle { position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px; border-radius: 50%; border: none; background-color: var(--theme-toggle-bg); box-shadow: var(--shadow-resting); transition: transform 0.2s ease, box-shadow 0.2s ease; cursor: pointer; font-size: 1.5rem; font-weight: 400; display: flex; align-items: center; justify-content: center; z-index: 900; }
.theme-toggle:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
@media (min-width: 768px) {
  .mobile-header { display: none; }
  .layout-wrapper { flex-direction: row; padding-top: 0; padding-left: 300px; transition: padding-left 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
  .desktop-hamburger { display: flex; position: fixed; top: 10px; left: 15px; cursor: pointer; z-index: 1001; font-size: 1.5rem; font-weight: 400; color: var(--text-color); width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 50%; background-color: var(--sidebar-bg); box-shadow: var(--shadow-resting); transition: transform 0.2s ease; }
  #sidebar { display: flex; flex-direction: column; width: 300px; height: 100vh; position: fixed; top: 0; left: 0; z-index: 999; flex-shrink: 0; margin-left: 0; box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15); overflow-y: auto; transform: translateX(0); opacity: 1; visibility: visible; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
  #master-menu-toggle:checked ~ .layout-wrapper { padding-left: 0; }
  #master-menu-toggle:checked ~ .layout-wrapper #sidebar { transform: translateX(-100%); margin-left: 0; }
  main { max-width: 800px; margin: 0 auto; padding: 40px 20px 100px; }
  .sidebar-inner .site-title { display: block; color: var(--heading-color); text-align: center; margin-bottom: 20px; margin-top: 4px; padding-left: 40px; }
}

/* Buy Me a Coffee Hover State */
.btn-bmc { transition: background-color 0.2s ease; }
.btn-bmc:hover { background-color: var(--link-hover); color: var(--bmc-text); }

/* Site Title Wave Effect */
.site-title a { display: inline-block; }
.site-title a span { display: inline-block; position: relative; margin-right: 0.04em; }
.site-title a:hover span { animation: titleWave 1.5s ease-in-out infinite; animation-delay: calc(var(--i) * 0.08s); }
@keyframes titleWave { 
  0%, 100% { transform: translateY(0); } 
  50% { transform: translateY(-6px); } 
}
/* Responsive Title Spacing */
.title-space { display: inline-block; width: 0.32em; flex-shrink: 0; }
@media (min-width: 768px) { .title-space { display: inline-block; width: 0.16em; } }

/* Standalone Utility Links (Home, Legal) */
.nav-menu > li.nav-utility {
  margin-bottom: 8px;
}
.nav-menu > li.nav-utility > a {
  height: 40px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  color: var(--text-color);
  opacity: 0.85;
}
.nav-menu > li.nav-utility > a:hover {
  opacity: 1;
  color: var(--link-hover);
}

/* Content Footer */
.content-footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--card-l1-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  opacity: 0.6;
}
.content-footer a {
  color: inherit;
  text-decoration: none;
  margin-left: 1.5rem;
  transition: opacity 0.2s ease, text-decoration 0.2s ease;
}
.content-footer a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* --- CUSTOM SCROLLBARS --- */
:root {
  --scroll-thumb-main: #333333;
  --scroll-thumb-side: #444444;
}
html.light-theme, body.light-theme {
  --scroll-thumb-main: #cccccc;
  --scroll-thumb-side: #bbbbbb;
}

/* 1. Firefox Global (Chunky) */
html {
  scrollbar-width: auto;
  scrollbar-color: var(--scroll-thumb-main) var(--bg-color);
}
/* 2. WebKit Global (Chunky with padding trick) */
::-webkit-scrollbar {
  width: 18px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background-color: var(--scroll-thumb-main);
  border-radius: 10px;
  border: 4px solid var(--bg-color);
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--header-bar);
}

/* 3. Firefox Sidebar (Thin) */
#sidebar {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb-side) transparent;
}
/* 4. WebKit Sidebar (Thin) */
#sidebar::-webkit-scrollbar {
  width: 6px;
}
#sidebar::-webkit-scrollbar-track {
  background: transparent;
}
#sidebar::-webkit-scrollbar-thumb {
  background-color: var(--scroll-thumb-side);
  border-radius: 10px;
}
#sidebar::-webkit-scrollbar-thumb:hover {
  background-color: var(--header-bar);
}

/* --- DESKTOP SIDEBAR HEADER --- */
.sidebar-inner .site-title {
  display: none; /* Defaults to hidden on mobile to prevent doubling up */
}

@media (min-width: 769px) {
  .sidebar-inner .site-title {
    display: block;
    background-color: var(--header-bar);
    margin: -20px -10px 20px -10px;
    padding: 18px 45px 18px 10px;
    position: sticky;
    top: 0;
    z-index: 100;
    text-align: right;
    box-shadow: var(--shadow-resting);
  }
  .sidebar-inner .site-title a, 
  .sidebar-inner .site-title a:visited, 
  .sidebar-inner .site-title a:hover {
    color: #ffffff !important;
  }
}
/* --- OFFLINE STATE MODIFIERS --- */
.offline-disabled {
  background: #333333 !important;
  color: #777777 !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}
.offline-disabled .btn-emoji {
  filter: grayscale(100%);
  opacity: 0.5;
}
