/* --- Google Font Import --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- Reset & Base Styles --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  background-color: #f3f4f6; /* bg-gray-100 */
  color: #1f2937; /* text-gray-800 */
  display: flex; /* Use flex to ensure footer stays at bottom */
  flex-direction: column;
  min-height: 100vh;
}

/* Style for hiding body during auth check */
body.auth-loading {
  display: none;
}

/* --- Layout --- */
.container {
  width: 90%;
  max-width: 1100px; /* Adjust as needed */
  margin: 30px auto; /* Add top/bottom margin */
  padding: 2rem; /* p-8 */
  background-color: #ffffff;
  border-radius: 0.75rem; /* rounded-xl */
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); /* shadow-lg */
  flex-grow: 1; /* Allow container to grow */
}

/* --- Header & Navigation --- */
header {
  background-color: #ffffff;
  color: #1f2937;
  padding: 1rem 2rem; /* p-4 sm:px-6 lg:px-8 */
  border-bottom: 1px solid #e5e7eb; /* border-gray-200 */
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); /* shadow-sm */
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* space-x-3 */
}

.logo-container img {
  height: 40px; /* h-10 */
  width: auto;
}

.logo-container h1 {
  font-size: 1.25rem; /* text-xl */
  font-weight: 700; /* font-bold */
  color: #4f46e5; /* text-indigo-700 */
}

header nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.25rem; /* space-x-1 */
}

header nav li {
  margin: 0; /* Reset margin */
}

header nav a {
  color: #6b7280; /* text-gray-500 */
  text-decoration: none;
  font-weight: 500; /* font-medium */
  font-size: 0.875rem; /* text-sm */
  padding: 0.5rem 0.75rem; /* px-3 py-2 */
  border-radius: 0.375rem; /* rounded-md */
  transition: background-color 0.2s ease, color 0.2s ease;
}

header nav a:hover {
  background-color: #f3f4f6; /* hover:bg-gray-100 */
  color: #374151; /* hover:text-gray-700 */
}

header nav a.active {
  background-color: #e0e7ff; /* bg-indigo-100 */
  color: #4338ca; /* text-indigo-700 */
  font-weight: 600;
}

#logout-button {
  background-color: #dc2626; /* bg-red-600 */
  color: white;
  border: none;
  padding: 0.5rem 0.75rem; /* px-3 py-2 */
  border-radius: 0.375rem; /* rounded-md */
  font-weight: 500; /* font-medium */
  font-size: 0.875rem; /* text-sm */
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-left: 0.75rem; /* ml-3 */
}

#logout-button:hover {
  background-color: #b91c1c; /* hover:bg-red-700 */
}

/* --- Main Content Typography & Elements --- */
h2 {
  font-size: 1.875rem; /* text-3xl */
  font-weight: 700; /* font-bold */
  color: #111827; /* text-gray-900 */
  margin-bottom: 1rem; /* mb-4 */
  padding-bottom: 0.5rem; /* pb-2 */
  border-bottom: 1px solid #e5e7eb; /* border-gray-200 */
}

h3 {
  font-size: 1.25rem; /* text-xl */
  font-weight: 600; /* font-semibold */
  color: #111827; /* text-gray-900 */
  margin-top: 1.5rem; /* mt-6 */
  margin-bottom: 0.75rem; /* mb-3 */
}

h4 {
 font-size: 1.125rem; /* text-lg */
 font-weight: 600;
 color: #374151; /* text-gray-700 */
 margin-top: 1rem;
 margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem; /* mb-4 */
  color: #374151; /* text-gray-700 */
}

ul {
  list-style: disc;
  margin-left: 1.5rem; /* ml-6 */
  margin-bottom: 1rem; /* mb-4 */
  color: #374151; /* text-gray-700 */
}

li {
  margin-bottom: 0.5rem; /* mb-2 */
}

a {
  color: #4f46e5; /* text-indigo-600 */
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #3730a3; /* hover:text-indigo-800 */
  text-decoration: underline;
}

strong {
  font-weight: 600;
  color: #111827;
}

code {
  background-color: #eef2ff; /* bg-indigo-50 */
  color: #4338ca; /* text-indigo-700 */
  padding: 0.125rem 0.375rem; /* px-1.5 py-0.5 */
  border-radius: 0.25rem; /* rounded */
  font-family: monospace;
  font-size: 0.875em;
}

/* --- Forms --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  display: block;
  width: 100%;
  padding: 0.75rem; /* p-3 */
  border: 1px solid #d1d5db; /* border-gray-300 */
  border-radius: 0.375rem; /* rounded-md */
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); /* shadow-sm */
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #6366f1; /* focus:border-indigo-500 */
  box-shadow: 0 0 0 3px rgb(165 180 252 / 50%); /* focus:ring focus:ring-indigo-200 focus:ring-opacity-50 */
}

textarea {
  min-height: 80px;
}

label {
  display: block;
  margin-bottom: 0.5rem; /* mb-2 */
  font-weight: 500; /* font-medium */
  color: #374151; /* text-gray-700 */
}

button[type="submit"],
.button-primary {
  display: inline-block;
  padding: 0.75rem 1.5rem; /* py-3 px-6 */
  background-color: #4f46e5; /* bg-indigo-600 */
  color: white;
  border: none;
  border-radius: 0.375rem; /* rounded-md */
  font-size: 1rem; /* text-base */
  font-weight: 600; /* font-semibold */
  cursor: pointer;
  transition: background-color 0.3s ease;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); /* shadow-sm */
}

button[type="submit"]:hover,
.button-primary:hover {
  background-color: #4338ca; /* hover:bg-indigo-700 */
}

button:disabled {
  background-color: #9ca3af; /* bg-gray-400 */
  cursor: not-allowed;
}

/* --- Lesson List Specific --- */
.lesson-list ul {
  list-style: none;
  padding-left: 0;
}

.lesson-list li {
  margin-bottom: 1rem; /* Increased spacing */
  font-size: 1rem;
  padding: 0.75rem 1rem; /* Add padding */
  background-color: #f9fafb; /* bg-gray-50 */
  border: 1px solid #e5e7eb; /* border-gray-200 */
  border-radius: 0.5rem; /* rounded-lg */
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.lesson-list li:hover {
  background-color: #f3f4f6; /* hover:bg-gray-100 */
  border-color: #d1d5db; /* hover:border-gray-300 */
}

.lesson-list a {
  font-weight: 500;
  color: #374151; /* text-gray-700 */
}
.lesson-list a:hover {
  color: #111827; /* text-gray-900 */
  text-decoration: none; /* Keep consistent */
}

/* --- Tool Iframes --- */
.tool-container {
  margin-top: 2rem; /* mt-8 */
  margin-bottom: 2rem; /* mb-8 */
}

.tool-iframe {
  width: 100%;
  height: 75vh; /* Increased height */
  border: 1px solid #d1d5db; /* border-gray-300 */
  border-radius: 0.5rem; /* rounded-lg */
  background-color: #f9fafb; /* bg-gray-50 */
}

/* --- Footer --- */
footer {
  text-align: center;
  margin-top: auto; /* Push footer to bottom */
  padding: 1.5rem; /* p-6 */
  color: #6b7280; /* text-gray-500 */
  font-size: 0.875rem; /* text-sm */
  background-color: #f9fafb; /* bg-gray-50 slightly different for contrast */
  border-top: 1px solid #e5e7eb; /* border-gray-200 */
}

/* --- Login Page Specific Styles --- */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #f3f4f6; /* bg-gray-100 */
}

.login-container {
  width: 100%;
  max-width: 420px; /* Slightly wider */
  padding: 2.5rem; /* p-10 */
  background-color: #ffffff;
  border-radius: 0.75rem; /* rounded-xl */
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); /* shadow-xl */
  text-align: center;
}

.login-logo {
  height: 80px; /* Increased height - ADJUST AS NEEDED */
  width: auto; /* Maintain aspect ratio */
  margin-bottom: 1.5rem; /* mb-6 */
}

.login-container h1 {
  font-size: 1.5rem; /* text-2xl */
  font-weight: 700; /* font-bold */
  color: #111827; /* text-gray-900 */
  margin-bottom: 0.5rem; /* mb-2 */
}

.login-container p {
  margin-bottom: 1.5rem; /* mb-6 */
  color: #4b5563; /* text-gray-600 */
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem; /* space-y-4 */
  margin-top: 1.5rem; /* mt-6 */
}

/* Specific button styles for Login */
#loginButton {
  background-color: #4f46e5; /* bg-indigo-600 */
  padding-top: 0.75rem; /* py-3 */
  padding-bottom: 0.75rem; /* py-3 */
}
#loginButton:hover {
  background-color: #4338ca; /* hover:bg-indigo-700 */
}
/* Signup button styles removed */

/* Updated Message Area Styling */
#messageArea {
  /* Default hidden */
  display: none;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  text-align: left;
  font-size: 0.875rem;
  border: 1px solid transparent;
}
/* Error Message */
#messageArea.errorMessage {
  color: #991b1b; /* text-red-800 */
  background-color: #fee2e2; /* bg-red-100 */
  border-color: #fecaca; /* border-red-200 */
}
/* Success Message */
#messageArea.successMessage {
  color: #047857; /* text-green-700 */
  background-color: #d1fae5; /* bg-green-100 */
  border-color: #a7f3d0; /* border-green-200 */
}

/* --- Dashboard Table Styles --- */
.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem; /* mt-6 */
  font-size: 0.875rem; /* text-sm */
}
.dashboard-table th,
.dashboard-table td {
  border: 1px solid #e5e7eb; /* border-gray-200 */
  padding: 0.75rem 1rem; /* px-4 py-3 */
  text-align: left;
  vertical-align: top;
}
.dashboard-table th {
  background-color: #f9fafb; /* bg-gray-50 */
  font-weight: 600; /* font-semibold */
  color: #374151; /* text-gray-700 */
}
.dashboard-table tr:nth-child(even) {
  background-color: #f9fafb; /* bg-gray-50 */
}
.user-email {
  font-weight: 500;
  color: #1f2937; /* text-gray-800 */
}
.quiz-score.pass {
  color: #059669; /* text-green-600 */
  font-weight: 600;
}
.quiz-score.fail {
  color: #dc2626; /* text-red-600 */
  font-weight: 600;
}
#dashboard-loading {
  text-align: center;
  padding: 1.5rem;
  color: #6b7280; /* text-gray-500 */
}

/* --- Video/Quiz Specific Styles --- */
.video-quiz-section {
  background-color: #fff;
  border: 1px solid #e5e7eb; /* border-gray-200 */
  border-radius: 0.75rem; /* rounded-xl */
  padding: 1.5rem; /* p-6 */
  margin-top: 2rem; /* mt-8 */
  scroll-margin-top: 80px;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); /* shadow-sm */
}
.quiz-question {
  margin-bottom: 1.5rem; /* mb-6 */
}
.quiz-question fieldset {
  border: none;
  padding: 0;
  margin: 0;
}
.quiz-question legend,
.quiz-question label.block-label { /* Add class for block labels like textarea */
  display: block;
  margin-bottom: 0.5rem; /* mb-2 */
  font-weight: 600; /* font-semibold */
  color: #374151; /* text-gray-700 */
}
.quiz-option {
  display: block;
  margin-bottom: 0.75rem; /* mb-3 */
  cursor: pointer;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease;
}
.quiz-option:hover {
  background-color: #f9fafb;
}
.quiz-option input[type="radio"],
.quiz-option input[type="checkbox"] {
  margin-right: 0.5rem; /* mr-2 */
  vertical-align: middle;
  height: 1rem; /* h-4 */
  width: 1rem; /* w-4 */
  color: #4f46e5; /* text-indigo-600 */
  border-color: #9ca3af; /* border-gray-400 */
}
.quiz-submit { /* Inherits from .button-primary */
  margin-top: 1rem; /* mt-4 */
}
.quiz-result {
  margin-top: 1rem; /* mt-4 */
  font-weight: 600;
  padding: 0.75rem 1rem; /* px-4 py-3 */
  border-radius: 0.375rem; /* rounded-md */
  display: none; /* Hidden by default */
  border: 1px solid transparent;
}
.quiz-result.success {
  color: #047857; /* text-green-700 */
  background-color: #d1fae5; /* bg-green-100 */
  border-color: #a7f3d0; /* border-green-200 */
}
.quiz-result.error {
  color: #991b1b; /* text-red-800 */
  background-color: #fee2e2; /* bg-red-100 */
  border-color: #fecaca; /* border-red-200 */
}
.video-embed-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  background: #e5e7eb; /* bg-gray-200 */
  border-radius: 0.5rem; /* rounded-lg */
  margin-bottom: 1.5rem; /* mb-6 */
  border: 1px solid #d1d5db; /* border-gray-300 */
}
.video-embed-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* --- Slideshow Styles (Interactive Lessons) --- */
.slideshow-container {
  position: relative;
  background-color: #fff;
  border: 1px solid #d1d5db; /* border-gray-300 */
  border-radius: 0.75rem; /* rounded-xl */
  padding: 2rem; /* p-8 */
  margin-top: 1.5rem; /* mt-6 */
  min-height: 500px; /* Adjust height */
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); /* shadow-lg */
}
.slide {
  display: none;
  flex-grow: 1;
  line-height: 1.7;
}
.slide.active {
  display: block;
}
.slide h3 {
  margin-top: 0;
  margin-bottom: 1rem;
}
.slide p {
  margin-bottom: 1rem;
}
.slide strong {
  color: #4f46e5; /* text-indigo-600 */
  font-weight: 600;
}
.example-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem; /* mt-6 */
  font-size: 0.95rem;
}
.example-table th,
.example-table td {
  border: 1px solid #e5e7eb; /* border-gray-200 */
  padding: 0.75rem 1rem; /* px-4 py-3 */
  text-align: left;
  vertical-align: top;
}
.example-table th {
  background-color: #f9fafb; /* bg-gray-50 */
  font-weight: 600;
}
.example-table td code {
  font-size: 1rem; /* Slightly larger code in table */
  padding: 0.25rem 0.5rem;
}
.example-table td span.word {
  display: inline-block;
  margin-right: 0.75rem;
  margin-bottom: 0.25rem;
}
.audio-button {
  background: none;
  border: none;
  padding: 0 0.25rem;
  margin: 0;
  cursor: pointer;
  vertical-align: middle;
  font-size: 1.1rem;
  color: #4f46e5;
  display: inline-flex; /* Use flex for icon alignment */
  align-items: center;
}
.audio-button:hover {
  color: #3730a3;
}
.audio-button svg {
  width: 1.1em;
  height: 1.1em;
  fill: currentColor;
}
.slide-nav {
  margin-top: 1.5rem; /* mt-6 */
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #e5e7eb; /* border-gray-200 */
  padding-top: 1rem; /* pt-4 */
}
.slide-nav button,
.slide-nav a.button-link { /* Style link like a button */
  padding: 0.625rem 1.125rem; /* py-2.5 px-4.5 */
  background-color: #4f46e5;
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem; /* text-sm */
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  text-decoration: none;
  text-align: center;
}
.slide-nav button:hover,
.slide-nav a.button-link:hover {
  background-color: #4338ca;
}
.slide-nav button:disabled {
  background-color: #9ca3af; /* bg-gray-400 */
  cursor: not-allowed;
}
.slide-nav span {
  font-size: 0.875rem; /* text-sm */
  color: #6b7280; /* text-gray-500 */
}
/* Link button specific */
.slide-nav a.button-link {
  background-color: #059669; /* bg-green-600 */
}
.slide-nav a.button-link:hover {
  background-color: #047857; /* bg-green-700 */
}

/* Ensure header doesn't overlap content when jumping to ID */
html {
  scroll-padding-top: 80px; /* Adjust based on your header height */
}

