/* ===========================
   ROOT VARIABLES
   =========================== */
:root {
  --bg-color: #f4f4f9;
  --text-color: #333333;
  --box-bg: #ffffff;
  --box-border: #cce0ff;
  --link-color: #0077cc;
  --link-hover: #0055aa;
  --choice-bg: #eaf3fb;

  --bar-bg: #ffffff;
  --bar-text: #0055aa;
  --sidebar-bg: #f0f8ff;
  --sidebar-text: #003366;

  --hover-light: rgba(0, 123, 255, 0.12);
  --hover-dark: #3a3a3a;
  --hover-bg: var(--hover-light);
}

/* ===========================
   DARK MODE VARIABLES
   =========================== */
.dark-mode {
  --bg-color: #1a1a1a;
  --text-color: #f0f0f0;
  --box-bg: #222222;
  --box-border: #444444;
  --link-color: #66b2ff;
  --link-hover: #99ccff;
  --choice-bg: #2c313a;

  --bar-bg: #222222;
  --bar-text: #f0f0f0;
  --sidebar-bg: #333333;
  --sidebar-text: #f0f0f0;
  --hover-bg: var(--hover-dark);
}

/* ===========================
   GLOBAL ELEMENTS
   =========================== */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', sans-serif;
  margin: 0;
  padding-top: 60px; /* Matches .top-bar height */
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Responsive font size for mobile */
@media (max-width: 600px) {
  body {
    font-size: 18px;
    padding: 1rem;
  }
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

/* ===========================
   LINK STYLES
   =========================== */
a {
  text-decoration: none;
  color: var(--link-color);
  font-weight: bold;
}
a:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

/* ===========================
   CONTAINER STYLES
   =========================== */
.container, .quiz-container {
  max-width: 100%;
  width: 100%;
  padding: 1rem;
  box-sizing: border-box;
}

.container {
  max-width: 800px;
  margin: auto;
}

/* ===========================
   BOXES & COMMON COMPONENTS
   =========================== */
.box, .notes-box, .quiz-box, .question-box, .subunit-header, .subunit-content {
  background-color: var(--box-bg);
  color: var(--bar-text);
  border-color: var(--box-border);
}

.box {
  border: 2px solid var(--box-border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
@media (max-width: 600px) {
  .box {
    padding: 1.5rem;
    gap: 10px;
    margin-top: 60px;
  }
}

/* ===========================
   HEADERS
   =========================== */
h1, h2, h3 {
  color: var(--bar-text);
}
/* ===========================
   LISTS
   =========================== */
ul {
  list-style: none;
  padding-left: 0;
}

li {
  margin: 0.5rem 0;
}
ul.custom-block-list {
  list-style: none; /* Remove default bullets */
  padding-left: 0;
}

ul.custom-block-list li {
  position: relative;
  padding-left: 1.5em;
}

ul.custom-block-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.6em;
  height: 0.6em;
  background-color: var(--bar-text); 
  border-radius: 2px; 
}

/* ===========================
   COUNTDOWN TIMER
   =========================== */
.countdown {
  font-size: 1.2rem;
  text-align: center;
  color: var(--bar-text);
}

/* ===========================
   SUBUNIT STYLES
   =========================== */
.subunit-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-top: 20px;
  padding-left: 8px;
  padding-right: 8px;
}
@media (max-width: 600px) {
  .subunit-container {
    padding: 0;
    gap: 10px;
    margin-top: 60px;
  }
}
.subunit {
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--box-bg);
}
/* Spacing for first subunit 
.subunit:first-child {
  margin-top: 80px;
} */
/* Subunit header (collapsible) */
.subunit-header {
  background: none;
  color: var(--bar-text);
  border: none;
  font-size: 1.2rem;
  padding: 10px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
  position: relative;
}
.subunit-header.active {
  background-color: #007BFF;
  color: #fff;
}
body.dark-mode .subunit-header.active {
  background-color: #fff;
  color: #111;
}
/* Arrow indicator */
.subunit-header::after {
  content: ' ▾';
  display: inline-block;
  transition: transform 0.3s ease;
}
.subunit-header.active::after {
  transform: rotate(180deg);
}
/* Subunit header hover */
.subunit-header:hover {
  background-color: var(--hover-bg);
}

/* Collapsible content */
.subunit-content {
  display: none;
  padding: 10px 15px;
  background-color: var(--box-bg);
  color: var(--text-color);
  position: relative;
  z-index: 1;
}
.subunit-header.active + .subunit-content {
  display: block;
}

/* ===========================
   QUIZ BOX & QUESTIONS
   =========================== */
.quiz-box {
  background-color: var(--box-bg);
  border: 1px solid var(--box-border);
  padding: 15px;
  border-radius: 8px;
  margin-top: 30px;
}

.quiz-container {
  max-width: 600px;
  margin: 0 auto;
  font-family: 'Segoe UI', sans-serif;
}

.question-box {
  background-color: var(--choice-bg);
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.question-text {
  font-size: 18px;
  margin-bottom: 16px;
  font-weight: 600;
}

/* ===========================
   QUIZ ANSWER & FEEDBACK
   =========================== */
.answer-options button, .choices li {
  display: block;
  width: 100%;
  margin: 8px 0;
  padding: 12px 8px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

/* Button hover */
.answer-options button:hover {
  background-color: #4a4a4a;
}

/* Correct/Incorrect styles */
.answer-options button.correct,
.choices li.correct {
  background-color: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}
.answer-options button.incorrect,
.choices li.incorrect {
  background-color: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

/* Feedback text */
.feedback, .feedback-text {
  margin-top: 12px;
  font-style: italic;
  color: var(--bar-text);
}

/* ===========================
   NOTES BOX
   =========================== */
.notes-box {
  background-color: var(--box-bg);
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
  font-family: 'Segoe UI', sans-serif;
}

.notes-box h2 {
  color: var(--bar-text);
  margin-bottom: 12px;
}

.notes-box ul {
  padding-left: 20px;
  margin: 10px 0;
}

.notes-box li {
  margin-bottom: 6px;
}

/* ===========================
   CHEMISTRY TABLE
   =========================== */
.chem-table {
  width: 80%;
  margin: 30px auto;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: 'Segoe UI', sans-serif;
  border: 2px solid #333;
}

.chem-table td {
  border: 2px solid #333;
  padding: 16px;
  text-align: center;
  vertical-align: middle;
  background-color: #fefefe;
  color: #222;
  font-size: 1rem;
  letter-spacing: 0.5px;
  word-wrap: break-word;
}

/* Table header row */
.chem-table tr:first-child td {
  background-color: var(--hover-bg);
  font-weight: bold;
  color: var(--bar-text);
}

/* ===========================
   SECTION DIVIDER
   =========================== */
.section-divider {
  text-align: center;
  margin: 40px 0 20px;
}

.section-divider hr {
  border: none;
  border-top: 2px solid #ccc;
  margin-bottom: 10px;
}

.section-divider h3 {
  font-size: 1.4rem;
  color: var(--bar-text);
  margin-bottom: 8px;
}

.section-divider p {
  font-size: 1rem;
  color: var(--text-color);
}

/* ===========================
   TOP BAR
   =========================== */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 60px;
  background-color: var(--bar-bg);
  color: var(--bar-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* ===========================
   TITLE IN TOP BAR
   =========================== */
.unit-title {
  margin: 0;
  font-size: 1.2rem;
  flex-grow: 1;
  text-align: center;
  color: var(--bar-text);
}

/* ===========================
   ICONS IN TOP BAR
   =========================== */
.menu-icon,
.theme-toggle {
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.theme-toggle:hover {
  outline: 2px solid var(--hover-bg);
  outline-offset: 2px;
}
.menu-icon:hover {
  outline: 2px solid var(--hover-bg);
  outline-offset: 2px;
}

/* ===========================
   SIDEBAR NAVIGATION
   =========================== */
.sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  width: 250px;
  height: calc(100% - 60px);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 999;
  background-color: var(--sidebar-bg);
  color: var(--link-color); /* text */
  padding: 20px;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
}
.sidebar.visible {
  transform: translateX(0);
}
.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar li {
  margin: 12px 0;
  padding: 0;
}
.sidebar li:first-child {
  margin-top: -4px;
}
.sidebar a {
  display: block;
  padding: 12px 16px;
  background-color: var(--box-bg);
  border-radius: 8px;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: 1rem;
  line-height: 1.5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.sidebar a:hover,
.sidebar a:focus {
  background-color: var(--hover-bg);
  transform: translateX(2px);
}
.sidebar a.active {
  background-color: var(--hover-bg);
  font-weight: bold;
  border-left: 4px solid var(--hover-bg);
}
/* === OVERLAY STYLES =========================== */
#sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px); /* Optional*/
}
.sidebar.visible + #sidebar-overlay {
  opacity: 1;
  visibility: visible;
}
/* === SIGN IN =========================== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.6); /* Dim background */
}

.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 2rem;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

.close {
  float: right;
  font-size: 1.5rem;
  cursor: pointer;
}
/* ===========================
   END OF FILE
   =========================== */
