/* ==============================================================
   GLOBAL RESET & BASE STYLES
   ============================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f0f4ff 0%, #f7fbff 60%, #fdfdff 100%);
  color: #333;
  line-height: 1.6;
  padding-bottom: 40px;
}

/* ==============================================================
   CONTAINER WRAPPER
   ============================================================== */
.container {
  max-width: 800px;
  margin: 30px auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px 30px;
}

/* ==============================================================
   HEADINGS
   ============================================================== */
h1 {
  text-align: center;
  margin-bottom: 20px;
}
h2 {
  margin: 15px 0;
}
h3 {
  margin: 15px 0;
  font-size: 1.1rem;
}

/* ==============================================================
   LINKS & BUTTONS (GENERAL)
   ============================================================== */
a {
  text-decoration: none;
  color: #1e70bf;
}
a:hover {
  text-decoration: underline;
}

/* .btn: consistent button/anchor style outside postit tiles */
.btn {
  display: inline-block;
  background-color: #1e70bf;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  text-decoration: none;
  margin-right: 6px;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}
.btn:hover {
  background-color: #155a96;
}
.btn-block {
  width: 100%;
  text-align: center;
}
.btn-primary {
  background-color: #2563eb;
}
.btn-primary:hover {
  background-color: #1d4fd0;
}

/* Delete button variant outside postit tiles */
.delete-btn {
  background-color: #d93025;
  padding: 6px 12px;
  font-size: 0.9rem;
}
.delete-btn:hover {
  background-color: #a52714;
}

/* ==============================================================
   FORMS & INPUTS
   ============================================================== */
label {
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 1rem;
  resize: vertical;
  min-height: 50px;
}

/* Auto‐resize textareas vertically as content grows */
textarea {
  overflow-y: hidden;
}

/* Checkboxes inline with label */
.checkbox-inline {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}
.checkbox-inline input[type="checkbox"] {
  margin-right: 8px;
}

/* Error & Success Messages */
.error {
  color: #d93025;
  margin-bottom: 10px;
}
.message {
  color: #2e7d32;
  margin-bottom: 10px;
}

/* Small descriptive text */
.small-desc {
  font-size: 0.9rem;
  color: #555;
  margin: 4px 0 12px 0;
}

/* ==============================================================
   POST-IT STYLE FOR QUESTION TILES (INDEX)
   ============================================================== */
.postit {
  background-color: #FFFB9E;      /* pale yellow */
  border: 1px solid #f0e68c;      /* slightly darker yellow border */
  border-radius: 6px;
  box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.15);
  padding: 12px;
  margin-bottom: 12px;
  font-family: 'Comic Sans MS', 'Bradley Hand', cursive; /* handwritten vibe */
  position: relative;
  transition: transform 0.1s ease;
  display: flex;                       /* make the tile a flex container */
  justify-content: space-between;      /* push question text left, buttons right */
  align-items: flex-start;             /* align children at the top */
}

/* Ensure the question text takes up remaining space */
.postit > div:first-child {
  flex: 1;
  margin-right: 12px;
}

/* Slight “tilt” effect on hover to mimic a real post-it */
.postit:hover {
  transform: rotate(-1.5deg);
}

/* Ensure the post-it question text wraps and still collapses if >25 words */
.index-question-text {
  line-height: 1.6em;
  /* allow it to grow vertically */
  word-break: break-word;
}

/* ==============================================================
   POST-IT BUTTON STYLING (inside .postit tiles)
   ============================================================== */
/* Make <a class="btn"> and <button class="delete-btn"> look like small post-it notes */
.postit .btn,
.postit .delete-btn {
  background-color: #FFFB9E;       /* same pale yellow as the tile */
  border: 1px solid #f0e68c;       /* darker yellow border for definition */
  color: #333;                     /* dark text for contrast */
  font-family: 'Comic Sans MS', 'Bradley Hand', cursive; /* handwritten vibe */
  padding: 6px 10px;               /* smaller padding to fit on the post-it */
  border-radius: 4px;              /* slight rounding */
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.15); /* gentle inner shadow */
  text-decoration: none;           /* remove underline on links */
  font-size: 0.9rem;               /* match post-it text size */
  margin-right: 4px;               /* small gap between buttons */
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

/* On hover, give the mini post-its a slight lift */
.postit .btn:hover,
.postit .delete-btn:hover {
  transform: translateY(-2px);
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.25);
}

/* If a .btn is actually an <a>, force it to display inline-block */
.postit .btn {
  display: inline-block;
}

/* On mobile, make sure the buttons wrap nicely */
@media (max-width: 600px) {
  .postit .btn,
  .postit .delete-btn {
    display: block;
    margin-bottom: 6px;
  }
}

/* ==============================================================
   LOADING OVERLAY (320×180 GIF + loading bar + text)
   ============================================================== */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 9999;
  display: none; /* hidden by default */
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
#loading-overlay img {
  width: 320px;
  height: 180px;
  object-fit: cover;
}

/* Loader bar container */
#loading-overlay .loader-container {
  margin-top: 20px;
  text-align: center;
}

/* Loading text */
#loading-overlay .loading-text {
  margin-top: 10px;
  font-size: 1.1rem;
  color: #333;
}

/* Loading bar background */
#loading-overlay .loading-bar {
  width: 300px;
  height: 10px;
  background: #ddd;
  margin: 0 auto;
  border-radius: 5px;
  overflow: hidden;
}

/* Loading bar animated fill */
#loading-overlay .loading-bar div {
  width: 0;
  height: 100%;
  background: #1e70bf;
  animation: loading 2s infinite;
}

/* Keyframes for loading bar animation */
@keyframes loading {
  0% { width: 0%; }
  50% { width: 100%; }
  100% { width: 0%; }
}

/* ==============================================================
   COLLAPSIBLE TEXT (INDEX & GRADE)
   ============================================================== */
.collapse-text {
  overflow: hidden;
  max-height: 3.5em; /* ~2 lines at 1.75em line-height */
  position: relative;
  transition: max-height 0.3s ease;
}
.collapse-text.expanded {
  max-height: none;
}
.toggle-link {
  color: #1e70bf;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 4px;
  display: inline-block;
}

/* For question text in index and grade */
.index-question-text,
#question-text {
  line-height: 1.75em;
}

/* ==============================================================
   FEEDBACK BOX (GRADE)
   ============================================================== */
pre.feedback {
  background: #f9f9f9;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap; /* wrap long lines */
  word-break: break-word;
  margin-bottom: 20px;
}

/* ==============================================================
   TITLE MASCOT AT BOTTOM
   ============================================================== */
.title-mascot {
  display: block;
  margin: 20px auto 0;
  width: 150px;
  height: 150px;
  object-fit: contain;
}

/* ==============================================================
   RESPONSIVE UTILITY
   ============================================================== */
@media (max-width: 600px) {
  .container {
    padding: 15px 20px;
  }
  button, input[type="submit"], .btn, .delete-btn {
    width: 100%;
    margin-bottom: 10px;
  }
}


.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  margin-top: 1em;
  margin-bottom: .5em;
  font-weight: bold;
  color: #1e70bf;
}

.markdown-content ul,
.markdown-content ol {
  margin: 0 0 1em 2em;
}

.markdown-content strong {
  font-weight: bold;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content hr {
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
}

.markdown-content {
  background: #f9f9f9;
  padding: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  max-width: 100%;
  overflow-x: auto;
  margin-bottom: 20px;
  font-size: 1rem;
}

/* ============================================================== 
   AUTH PAGES (LOGIN/REGISTER)
   ============================================================== */
.auth-hero {
  max-width: 1100px;
  margin: 30px auto 10px;
  background: radial-gradient(circle at 20% 20%, rgba(37,99,235,0.08), transparent 45%),
              radial-gradient(circle at 80% 30%, rgba(16,185,129,0.08), transparent 40%),
              #f8fbff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.auth-hero__content {
  display: flex;
  gap: 24px;
  align-items: center;
}
.auth-title {
  font-size: 1.8rem;
  margin: 10px 0;
}
.auth-subtitle {
  color: #4a5568;
  margin-bottom: 12px;
}
.auth-bullets {
  list-style: none;
  color: #2d3748;
}
.auth-bullets li {
  margin: 6px 0;
  padding-left: 18px;
  position: relative;
}
.auth-bullets li::before {
  content: "•";
  color: #2563eb;
  font-weight: bold;
  position: absolute;
  left: 0;
}
.pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.pill--accent {
  background: #ecf2ff;
  color: #1e40af;
}
.auth-card {
  max-width: 520px;
}
.card-title {
  text-align: center;
  margin-bottom: 14px;
}
.auth-switch {
  text-align: center;
  margin-top: 10px;
}
.form-stacked .form-field {
  margin-bottom: 14px;
}
.form-stacked input {
  min-height: 52px;
}

@media (max-width: 700px) {
  .auth-hero {
    margin: 10px;
  }
  .auth-hero__content {
    flex-direction: column;
    align-items: flex-start;
  }
  .container {
    margin: 16px auto;
  }
}
