/* _base.css - Resets and variables */
:root {
  --light-blue: #e6f0fa;
  --dark-blue: #003d82;
  --soft-yellow: #fff9e6;

  --text-dark: #1a1a1a;
  --text-medium: #333;
  --text-light: #666;
  --white: #ffffff;

  --charcoal: #263238; /* text */

  --stanford-falu-red: #8c1515; /* Stanford red */
  --stanford-tan: #d2c295; /* Stanford tan */
  --stanford-pine-tree: #2e2d29; /* Stanford pine tree */

  --shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);

  --container-bg: var(--white);
  --container-radius: 0.75rem;
  --container-shadow: var(--shadow);
}

/* ===== Base Reset ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(to right, var(--light-blue), var(--white));
  color: var(--text-dark);
  line-height: 1.6;
  padding: 1.25 rem 0.75rem;
  text-align: center;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  text-size-adjust: 100%;
}

.hidden {
  display: none !important;
}

/* _typography.css */
h2 {
  font-size: 2rem;
  color: var(--stanford-falu-red);
  margin: 0.625rem 0;
}

h3 {
  font-size: 1.5rem;
  color: var(--charcoal);
  margin: 0.25rem 0;
  font-weight: 600;
}

h4 {
  font-size: 1.125rem;
  color: var(--charcoal);
  margin: 0.25rem 0;
  font-weight: 400;
}

.styled-question-number {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--stanford-falu-red);
  margin-bottom: 0.2rem;
  text-align: center;
}

.set-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--stanford-falu-red);
}

.question-num {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark-blue);
}

#vignette {
  font-size: 1rem;
  line-height: 1.8;
  margin: 1.25rem 0 0.9375rem;
}

#lead-in {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
  font-weight: 400;
  color: var(--stanford-falu-red);
}

#lecturer-display {
  font-style: normal;
  color: var(--charcoal);
  padding-top: 0.625rem;
  margin-top: 0.3125rem;
  border-bottom: 1px dashed rgba(0, 87, 183, 0.3);
  text-align: center;
  width: 100%;
  font-size: 0.8rem;
}

/* _components.css */
.logo-container,
#university-info,
.password-container,
#set-selection {
  text-align: center;
  margin: 1.25rem auto;
}

.center-logo {
  max-width: 18.75rem;
  height: auto;
  display: block;
  margin: 0 auto;
}

.text-box,
#quiz-container {
  background: var(--container-bg);
  padding: 0.75rem;
  border-radius: var(--container-radius);
  box-shadow: var(--container-shadow);
  max-width: 95%;
  margin: 1.25rem auto;
  text-align: left;
}

#result-container {
  background: var(--container-bg);
  padding: 0.9375rem;
  border-radius: var(--container-radius);
  box-shadow: var(--container-shadow);
  max-width: 95%;
  margin: 0.5rem auto;
  max-height: 80vh;
  overflow-y: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.error-message {
  background: var(--container-bg);
  padding: 1.25rem;
  margin: 1.25rem auto;
  border-radius: 0.25rem;
  max-width: 31.25rem;
  text-align: center;
}

.error-detail {
  color: var(--text-light);
  font-size: 0.9rem;
}

.admin-alert {
  background: var(--container-bg);
  padding: 0.5rem;
  border-bottom: 0.125rem solid #ffcc00;
  font-size: 0.9rem;
}

.result-summary {
  background-color: var(--soft-yellow);
  padding: 0.9375rem 1.25rem;
  border-radius: 0.5rem;
  max-width: 18.75rem;
  box-shadow: 0 0.125rem 0.3125rem rgba(0, 0, 0, 0.1); /* subtle shadow */
  margin-bottom: 1.25rem;
  text-align: center;
}

.result-correct {
  color: green;
  font-weight: 600;
}

.result-incorrect {
  color: red;
  font-weight: 600;
}

.result-skipped {
  color: var(--stanford-tan);
  font-weight: 600;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.25rem 0.625rem;
  background: linear-gradient(to right, var(--light-blue), var(--white));
  color: var(--text-dark);
  border-top: 1px solid rgba(0, 87, 183, 0.2);
  margin-top: auto;
}

footer .footer-content {
  max-width: 37.5rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.9375rem;
}

footer .footer-badge {
  background: rgba(140, 21, 21, 0.1);
  padding: 0.625rem 0.625rem;
  border-radius: 1.25rem;
  display: inline-block;
  margin-bottom: 0.3125rem;
  font-size: 0.8rem;
}

footer strong {
  font-weight: 400;
  color: var(--stanford-falu-red);
  letter-spacing: 0.03125rem;
}

footer a {
  color: var(--stanford-falu-red);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
}

footer a::after {
  content: "↗";
  font-size: 0.8rem;
}

footer a:hover {
  color: var(--dark-blue);
  text-decoration: underline;
  animation: fadeIn 0.3s ease;
}

footer .footer-copyright {
  font-size: 0.625rem;
  color: var(--charcoal);
  padding-top: 0.625rem;
  border-top: 1px solid rgba(0, 87, 183, 0.1);
}

/* _forms.css */

.password-input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  width: 15.625rem;
  max-width: 80%;
  margin: 0.625rem auto;
}

#passwordInput {
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--charcoal);
  border-radius: 0.5rem;
  width: 15.625rem;
  max-width: 80%;
  margin: 0.625rem auto;
  text-align: center;
}

.password-input-group button {
  width: 7.5rem;
  height: 3rem;
}

#passwordInput::placeholder {
  color: #aaa;
  opacity: 1;
  font-style: normal;
}

/* _buttons.css */
button {
  font-family: inherit;
  background: var(--stanford-tan);
  color: var(--stanford-pine-tree);
  padding: 0;
  border: none;
  border-radius: 0.625rem;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);

  width: 6.25rem;
  height: 3rem;

  display: inline-block;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-top: 1.875rem;
  margin-bottom: 0.625rem;

  box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.15);
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.2);
}

button:active {
  transform: scale(0.98);
}

#submit-btn,
#next-btn {
  background: var(--stanford-falu-red);
  color: var(--stanford-tan);
}

#skip-btn {
  background-color: var(--stanford-tan);
  color: var(--stanford-falu-red);
}

#skip-btn:hover {
  background-color: var(--stanford-tan);
  transform: scale(1.05);
}

.home-btn {
  background: var(--stanford-pine-tree);
  color: var(--stanford-tan);
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  cursor: pointer;
  min-width: 6.25rem;
  text-align: center;
  display: block;
  text-align: center;
}

.home-btn:hover {
  background-color: var(--stanford-pine-tree);
}

.review-actions,
.button-group,
.next-question-wrapper {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
  text-align: center;
  box-shadow: none;
}

.review-actions button,
.button-group button,
.next-question-wrapper button {
  min-width: 6.25rem;
  max-width: 7.5rem;
  text-align: center;
  flex: 0 1 auto;
}

.action-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
  text-align: center;
  box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.15);
}

.action-buttons button {
  min-width: 6.25rem;
  max-width: 7.5rem;
  text-align: center;
  flex: 0 1 auto;
}

.action-buttons,
.next-question-wrapper,
.review-actions,
.button-group {
  display: flex;
  gap: 1rem; /* Consistent spacing between buttons in a pair */
  justify-content: center;
  width: 100%;
}

.error-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  text-align: center;
  box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.15);
}

.error-actions button {
  background: var(--stanford-falu-red);
  color: var(--stanford-tan);
  min-width: 6.25rem;
  max-width: 7.5rem;
  text-align: center;
  flex: 0 1 auto;
}

.error-actions button:first-child {
  background: var(--stanford-pine-tree);
  color: var(--stanford-tan);
}

.error-actions button:last-child {
  background: var(--stanford-falu-red);
}

/* Display Styles for Errors in File Loading */
.error-container {
  max-width: 37.5rem;
  width: 100%;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: 20%;
  text-align: center;
  padding: 2rem;
  border-radius: 8px;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  max-width: 95%;
  width: 400px;
}

.error-title {
  margin-top: 0;
  color: var(--stanford-pine-tree);
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.error-message {
  margin-top: 0;
  color: var(--stanford-falu-red);
  font-size: 1rem;
}

.error-home-btn {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  padding: 0.5rem 0.5rem;
  background: var(--stanford-falu-red);
  color: var(--stanford-tan);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

.error-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh; /* Full viewport height */
  padding: 20px;
  box-sizing: border-box;
}

/* _quiz-components.css */
/* Options */
#options input[type="radio"] {
  margin-right: 0.625rem;
  transform: scale(1.2);
  accent-color: var(--charcoal);
}

#options {
  margin: 0.9375rem 0;
}

#options label.option {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0.625rem 0;
  padding: 0.625rem;
  background: var(--white);
  font-weight: normal;
  border-radius: 0.5rem;
  border: 1px solid var(--charcoal);
  cursor: pointer;
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

#set-dropdown {
  padding: 0.75rem;
  font-size: 0.875rem;
  border: 0.125rem solid var(--stanford-falu-red);
  border-radius: 0.5rem;
  text-align: left;
  margin: 0.625rem auto;
}

#set-dropdown option[disabled] {
  color: var(--stanford-falu-red);
  font-weight: bold;
  text-align: left;
}

#options label.option input[type="radio"] {
  margin-right: 0.75rem;
  transform: scale(1.3);
  accent-color: var(--stanford-falu-red);
  vertical-align: middle;
}

#options label.option:hover,
#options label.option:focus-within,
#options label.option:active,
#options label.option.active {
  background: var(--soft-yellow);
  border-color: var(--charcoal);
  outline: none;
}

#options label.option:focus-visible {
  box-shadow: 0 0 0 2px var(--stanford-falu-red);
}

#options label.option:active {
  transform: scale(0.98);
}

#options label.option.active {
  transform: scale(0.98);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#feedback {
  font-weight: bold;
  font-size: 1.5rem;
  padding: 0.9375rem;

  margin: 1.25rem auto;
  text-align: center;
}

#explanation {
  background: var(--soft-yellow);
  padding: 1.25rem;
  border-radius: 0.625rem;
  margin: 1.25rem 0;
  font-style: italic;
}

#explanation p {
  margin: 0.625rem 0;
  line-height: 1.6;
}

/* Review Section */
/* Base nav container */
.review-nav {
  margin-bottom: 1rem;
}

/* Question number buttons */
.review-nav-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.review-nav button {
  font-size: 0.9rem;
  min-width: 1.875rem;
  max-width: 3.125rem;
  padding: 0.5rem 0.5rem;
  border-radius: 1.875rem;
  box-shadow: var(--shadow);
}

/* Color variants */
.review-nav .correct-btn {
  background: #4caf50;
}
.review-nav .skipped-btn {
  background: #ffeb3b;
}
.review-nav .incorrect-btn {
  background: #f44336;
}

/* Action buttons */

.home-btn,
.review-btn,
.skip-btn,
.submit-btn,
.next-btn {
  padding: 0.625rem 1.25rem; /* Make padding consistent */
  min-width: 6.25rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
}

/* Optional: Add hover effect */
.review-actions button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.review-btn {
  background: var(--stanford-tan);
  box-shadow: var(--shadow);
}

.home-btn {
  background: var(--stanford-pine-tree);
  color: var(--stanford-tan);
}

.skipped-questions-section {
  margin-top: 1.25rem;
  padding: 0.625rem;
  background-color: #f8f9fa;
  border-radius: 0.3125rem;
}

.skipped-list {
  color: #6c757d;
}

.review-heading {
  font-size: 2rem;
  font-weight: bold;
  color: var(--stanford-falu-red);
  text-align: center;
  margin-bottom: 0.75rem;
}

.review-subheading {
  font-size: 1rem;
  color: var(--charcoal);
  text-align: center;
  margin-bottom: 1rem;
  font-weight: normal;
}

.congrats-message {
  font-size: 1.125rem;
  font-weight: normal;
  color: #4caf50;
  text-align: center;
  margin: 1.25rem 0;
  text-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
}

/* _animations.css */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-0.3125rem);
  }
  40%,
  80% {
    transform: translateX(0.3125rem);
  }
}

.shake {
  animation: shake 0.5s;
  border-color: #ff4444;
}

@keyframes pop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  70% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.animate-pop {
  animation: pop 0.5s ease both;
  transform-origin: center;
}

@keyframes fadeIn {
  from {
    opacity: 0.8;
  }
  to {
    opacity: 1;
  }
}

/* _responsive.css */
@media (max-width: 48rem) {
  body {
    padding: 1.25rem 0.5rem;
  }

  .text-box,
  #quiz-container {
    max-width: 97%;
    padding: 1.25rem 0.75rem;
  }

  #options label.option {
    padding: 0.625rem 0.5rem;
    margin: 0.75rem 0;
  }

  #options label.option input[type="radio"] {
    transform: scale(1.4);
  }

  .center-logo {
    max-width: 12.5rem; /* 200px */
  }

  #question-number {
    font-size: 1.1rem;
  }

  button {
    padding: 0.625rem 1.25rem; /* 10px 20px */
    width: 6.25rem; /* 100px */
    height: 2.75rem; /* 44px */
    font-size: 0.9rem;
  }

  #button-container {
    display: flex;
    flex-direction: column;
    align-items: center; /* center inner groups horizontally */
    gap: 2rem;
    margin-top: 2rem;
  }

  footer {
    padding: 1.875rem 0.9375rem; /* 30px 15px */
  }

  footer .footer-badge {
    padding: 0.375rem 0.9375rem; /* 6px 15px */
    font-size: 0.9rem;
  }
}

@media screen and (max-width: 48rem) and (orientation: landscape) {
  body {
    padding: 1.25rem 0.25rem;
  }
  .styled-question-number {
    font-size: 1.1rem;
  }
  .set-name,
  .question-num {
    font-size: 1rem;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    font-size: 1rem; /* Force consistent base size */
    line-height: 1.5;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  h4 {
    font-size: 1.1rem;
  }

  #vignette,
  #lead-in,
  #options label.option {
    font-size: 1rem;
  }

  button {
    font-size: 0.9rem;
  }

  /* Prevent zooming on input focus */
  input,
  select,
  textarea {
    font-size: 1rem !important;
  }
}

/* ===== Mobile Landscape Consistency Fixes ===== */
@media screen and (max-width: 48rem) and (orientation: landscape) {
  /* Base reset for all mobile browsers */
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    height: 100%;
  }

  body {
    font-size: 16px; /* Base anchor size */
    line-height: 1.4;
    /* Prevent text inflation */
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  /* Typography hierarchy */
  h2 {
    font-size: 1.5rem;
  }
  h3 {
    font-size: 1.25rem;
  }
  h4 {
    font-size: 1.1rem;
  }

  /* Interactive elements */
  button,
  input,
  select,
  textarea {
    font-size: 1rem !important;
    min-height: 44px; /* Minimum touch target */
  }

  /* Quiz-specific elements */
  #vignette,
  #lead-in {
    font-size: 1rem;
    line-height: 1.4;
  }

  #options label.option {
    font-size: 1rem;
    padding: 12px 15px;
  }

  /* Layout containers */
  .text-box,
  #quiz-container {
    max-height: 80vh;
    overflow-y: auto;
  }

  /* Prevent zoom on focus */
  input[type="text"],
  input[type="password"],
  textarea {
    font-size: 1rem !important;
  }
}

@supports (-webkit-tap-highlight-color: rgba(0, 0, 0, 0)) {
  @media screen and (max-width: 48rem) and (orientation: landscape) {
    body {
      font-size: 15px; /* Android renders slightly larger */
    }
  }
}

@supports (-ms-ime-align: auto) {
  @media screen and (max-width: 48rem) and (orientation: landscape) {
    html {
      overflow-x: hidden;
    }
  }
}
