:root {
  --color-primary: #00a2be;
  --color-text: #404040;
  --color-border: #808080;
  --color-light-neutral: #c0c0c0;
  --color-canvas: #ffffff;
}

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

body {
  font-family: Arial, sans-serif;
  color: var(--color-text);
  background-color: var(--color-canvas);
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Toggle Menu Button Styled to Match .btn Components */
.menu-toggle.btn {
  grid-column: 1;
  justify-self: start;
  position: relative;
  z-index: 1002;
  margin-bottom: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* App Body Wrapper to contain header, sidebar-content area, and footer */
.app-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 100vh;
  width: 100%;
}

/* Middle wrapper holding both the sidebar and main content */
.content-wrapper {
  display: flex;
  flex-grow: 1;
  position: relative;
  overflow: hidden;
}

/* Collapsible Left-Side Menu (positioned between header and footer) */
.sidebar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 260px;
  max-width: 80vw;
  background-color: #fff;
  border-right: 1px solid var(--color-light-neutral);
  padding: 20px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1001;
}

.sidebar.open {
  transform: translateX(0);
}

/* Backdrop shown behind the open drawer; click it to dismiss */
.sidebar-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

.quiz-menu-list {
  list-style: none;
  margin-top: 16px;
}

.quiz-menu-list li {
  margin-bottom: 12px;
}

.quiz-menu-list a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 400;
}

.quiz-menu-list a:hover {
  color: var(--color-primary);
}

/* Main Layout Structure */
.main-layout {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Centered Header & Logo Placeholder */
.site-header {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--color-light-neutral);
  background-color: var(--color-canvas);
  z-index: 1003;
}

.logo {
  grid-column: 2;
  justify-self: center;
  padding: 10px 20px;
  font-weight: bold;
}

.logo img {
  max-height: 60px; /* Controls the max height of the logo */
  width: auto;      /* Maintains aspect ratio */
  display: block;   /* Removes inline gaps */
}

/* Content Area */
.content-area {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.quiz-container {
  width: 100%;
  max-width: 600px;
  background-color: var(--color-canvas);
  padding: 32px;
  border: none;
  box-shadow: none;
}

/* Dedicated Quiz Content Area */
.quiz-content-area {
  width: 100%;
  min-height: 250px;
  margin-bottom: 24px;
  position: relative;
}

.quiz-progress,
.quiz-status {
  color: var(--color-border);
  font-size: 14px;
  margin-bottom: 16px;
}

.quiz-feedback {
  font-weight: 700;
  margin-top: 8px;
  margin-bottom: 16px;
}

.quiz-link.disabled {
  display: block;
  color: var(--color-light-neutral);
  cursor: default;
}

/* Single-Line Centered Footer with No Background */
.site-footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--color-light-neutral);
  background-color: transparent;
  white-space: nowrap;
  z-index: 1003;
}

.site-footer p {
  margin-bottom: 0;
}

.site-footer a, 
.site-footer a:visited {
  color: var(--color-text);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--color-primary);
}

h1 {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 16px;
}

h3 {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
}

h2 {
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 16px;
}

/* Button Component */
.btn {
  display: inline-block;
  width: 100%;
  padding: 12px 24px;
  background-color: var(--color-canvas);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: 0px;
  font-family: Arial, sans-serif;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  cursor: pointer;
  transition: none;
  margin-bottom: 12px;
}

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

/* Option List Styling */
.options-list {
  list-style: none;
  margin-bottom: 24px;
}

.options-list .option-btn:disabled {
  cursor: default;
  opacity: 1;
}

/* Wider variant of .quiz-container for simulation/interactive quizzes
   that need more horizontal room than a plain question card. */
.quiz-container.wide {
  max-width: 800px;
}

/* Simulation canvas frame */
.sim-container {
  position: relative;
  width: 100%;
  height: 350px;
  background-color: var(--color-canvas);
  border: 1px solid var(--color-light-neutral);
  overflow: hidden;
  margin-bottom: 20px;
}

.sim-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.canvas-instruction {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-canvas);
  padding: 7px 18px;
  border: 1px solid var(--color-light-neutral);
  font-size: 0.8rem;
  pointer-events: none;
  color: var(--color-text);
  white-space: nowrap;
  transition: opacity 0.3s ease;
  max-width: 90%;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stat cards, e.g. showing a measured/derived value alongside a constant */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card {
  background-color: var(--color-canvas);
  padding: 12px 15px;
  border: 1px solid var(--color-light-neutral);
  border-left: 4px solid var(--color-primary);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--color-border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 4px;
  color: var(--color-text);
}

/* Formula reference box */
.formula-box {
  padding: 16px;
  margin-bottom: 20px;
  text-align: center;
  border: 1px dashed var(--color-light-neutral);
  overflow-x: auto;
}

.formula-box h3 {
  margin: 0 0 8px 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.formula {
  font-family: 'Consolas', monospace;
  font-size: 1.1rem;
  color: var(--color-text);
  white-space: nowrap;
}

/* Numeric input styling, kept flat/square to match .btn */
input[type="number"] {
  flex: 1;
  min-width: 180px;
  background-color: var(--color-canvas);
  border: 1px solid var(--color-border);
  border-radius: 0;
  padding: 12px 14px;
  color: var(--color-text);
  font-family: Arial, sans-serif;
  font-size: 1rem;
  outline: none;
}

input[type="number"]:focus {
  border-color: var(--color-primary);
}

input[type="number"]:disabled {
  background-color: #f5f5f5;
  color: var(--color-border);
}

.input-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.input-group .btn {
  width: auto;
  flex: 0 0 auto;
  margin-bottom: 0;
}

/* Quiz feedback state colors, layered on top of .quiz-feedback */
.quiz-feedback.success { color: #1e8e3e; }
.quiz-feedback.error { color: #c62828; }

/* Responsive adjustments for Mobile View */
@media (max-width: 768px) {
  .site-footer {
    white-space: normal;
  }

  .sim-container {
    height: 280px;
  }

  .input-group {
    flex-direction: column;
  }

  .input-group input[type="number"],
  .input-group .btn {
    width: 100%;
  }
}
