/* ================================================ */
/* Global Reset & Base Styles */
/* ================================================ */

/* Basic reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base body styling */
body {
  font-family: 'Nunito', 'Montserrat', sans-serif;
  /* Softer pastel gradient */
  background: linear-gradient(135deg, #FEE7F6, #FCE2FA);
  min-height: 100vh;
  color: #555;
}

/* Common container */
.container {
  width: 90%;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

h3, h4 {
  margin-bottom: 1rem;
  color: #333;
}

/* Utility */
.hidden {
  display: none;
}

hr {
  height: 1px;
  background: #efefef;
  font-size: 0;
  border: 0;
  margin: 1rem 0rem;
}

/* ================================================ */
/* Header */
/* ================================================ */

.app-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.app-logo {
  margin: 0 auto;
}

.app-logo img {
  border-radius: 8px;
  max-height: 200px;
}

.app-title {
  font-size: 2rem;
  color: #333;
}

/* ================================================ */
/* Cards & General Elements */
/* ================================================ */

.card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  margin-top: 1.5rem;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: #333;
}

p {
  margin-bottom: 1rem;
}

video {
  width: 100%;
}

/* ================================================ */
/* Navigation, Tabs & Form Elements */
/* ================================================ */

/* Navigation links */
.nav-links {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Tabs */
.tab {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  color: #555;
  transition: color 0.2s ease;
}

.tab.active {
  /* Softer pastel accent */
  color: #dba8e1;
  border-bottom: 2px solid #dba8e1;
}

/* Form groups */
.form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 0.5rem;
  color: #666;
}

.form-group input {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  border-color: #dba8e1; /* Pastel focus border */
  outline: none;
}

/* ================================================ */
/* Buttons */
/* ================================================ */

/* ================================================ */
/* Buttons (Updated for more contrast) */
/* ================================================ */

/* Base button styles */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 25px;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  background: #a98ed6; /* Slightly darker pastel for more contrast */
  color: #fff;
}

.btn:hover {
  background: #967ac4; /* Darkens slightly on hover */
}

/* Disabled state */
.btn.disabled {
  background: #ccc;
  cursor: default;
}

/* Variants */
.btn-primary {
  background: #c09ccf; /* A bit more saturated for better contrast */
  color: #fff;
}

.btn-primary:hover {
  background: #b088be;
}

.btn-secondary {
  background: #a98ed6;
  color: #fff;
}

.btn-secondary:hover {
  background: #967ac4;
}

/* Button Row: Submit & Help */
.btn-submit {
  background-color: #c2a1e0; /* Slightly darker pastel purple */
  color: #fff;
  transition: background 0.3s ease;
}

.btn-submit:hover,
.btn-submit:focus {
  background-color: #af8bd2;
}

.btn-help, .btn-help:hover {
  background-color: #fff;
  color: #a98ed6;
  border: 1px solid #a98ed6;
  opacity: 0.8;
  transition: opacity 0.3s ease, border-color 0.3s ease;
}

/* ================================================ */
/* Flash Messages */
/* ================================================ */

.flash-message {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 4px;
}

.flash-message h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.flash-message p {
  margin: 0;
}

/* Keeping success/error fairly standard, or adjust if you want them more pastel */
.flash-message.success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.flash-message.error {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

/* ================================================ */
/* Loading Indicator & Spinner */
/* ================================================ */

#loading-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 1000;
}

/* Base spinner style */
.spinner {
  border: 4px solid #eee;
  border-top: 4px solid #dba8e1;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================================ */
/* Manage Topics Page */
/* ================================================ */

#userTopics,
#suggestedTopics {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

#userTopics li,
#suggestedTopics li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.remove-btn,
.add-btn {
  background: #dba8e1; /* Same pastel accent */
  color: #fff;
  text-decoration: none;
  border-radius: 25px;
  padding: 0.3rem 0.8rem;
  font-size: 0.9rem;
  transition: background 0.3s ease, transform 0.2s ease;
}

.remove-btn:hover,
.add-btn:hover {
  background: #c77ed0;
  transform: scale(1.02);
}

#addTopicForm {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

#addTopicForm .form-group {
  width: 100%;
}

#addTopicForm input[type="text"] {
  width: 100%;
  max-width: 300px;
}

/* ================================================ */
/* Lesson List & Progress Bars */
/* ================================================ */

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1rem;
}

.lesson-item {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  transition: box-shadow 0.2s ease;
  margin-bottom: 1.5rem;
}
.lesson-item  .titleImage{
    width: 100%;
    border-radius: 6px;
    height: 200px;
    object-fit: cover;
    border-radius: 6px;
    object-position: center;
    margin-bottom:1rem;
}
.lesson-item p {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.lesson-item .btn {
  margin-top: 0.5rem;
}

/* Progress container & bar */
.progress-container {
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
  height: 20px;
  margin: 0.5rem 0;
}

.progress-bar {
  /* Pastel gradient for progress */
  background: linear-gradient(90deg, #dba8e1 0%, #c77ed0 100%);
  transition: width 0.3s ease;
  height: 100%;
  line-height: 20px;
  color: #fff;
  text-align: center;
  font-size: 0.9rem;
}

/* ================================================ */
/* Quiz Page */
/* ================================================ */

#question-container {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  margin-top: 1.5rem;
  position: relative;
  transition: opacity 0.4s ease;
}

#question-text {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: #444;
  line-height: 1.4;
}

#question-learn-info {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: #555;
}

#question-image-container {
  text-align: center;
  margin-bottom: 1.5rem;
}

#question-image {
  max-width: 80%;
  height: auto;
  display: none;
  border-radius: 8px;
  margin: 0 auto;
}

.quiz-option {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  transition: transform 0.2s ease;
}

.quiz-option:hover {
  transform: translateY(-2px);
}

.quiz-option input[type="radio"] {
  margin-top: 0.2rem;
  margin-right: 0.5rem;
}

.quiz-option label {
  flex: 1;
  font-size: 1rem;
  color: #333;
  cursor: pointer;
  line-height: 1.4;
}

.option-image img {
  max-width: 60px;
  border-radius: 4px;
}

/* ================================================ */
/* Dashboard & Category Cards */
/* ================================================ */

.dashboard-section {
  margin: 2rem 0;
  padding: 1rem 0;
  border-top: 1px solid #eee;
}

.dashboard-section:first-of-type {
  border-top: none;
  margin-top: 0;
}

.dashboard-section h3 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.topic-header {
  margin-bottom: 1rem;
}

.topic-progress {
  margin-top: 0.5rem;
}

.lesson-list.dashboard {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.lesson-item.dashboard {
  flex: 1 1 45%;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem;
}

.lesson-item.dashboard h4 {
  margin-top: 0;
}

.view-more-btn {
  margin-top: 1rem;
  display: block;
  text-align: center;
}

/* Horizontal Category Cards */
.category-cards {
  display: flex;
  overflow-x: auto;
  margin-bottom: 1rem;
  gap: 1rem;
}

.category-card {
  flex: 0 0 auto;
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  min-width: 120px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.3s ease;
  border: 2px solid #fbe4ff; /* Already quite pastel */
}

.category-card:hover {
  border: 2px solid #eddcf5; /* Slightly darker pastel border */
}

.category-card.active {
  border: 2px solid #dba8e1;
}

.category-card h4 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.category-card .progress-container {
  margin-top: 0.5rem;
  height: 8px;
}

.category-card .progress-bar {
  height: 100%;
  background-color: #dba8e1;
}

/* ================================================ */
/* Collapsible (Accordion) Lessons */
/* ================================================ */

.lesson-section {
  padding: 1rem 0rem;
}

.collapsible {
  position: relative;
  border: 1px solid #eee;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.collapsible-header h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.collapsible-header h4::before {
  content: "▶";
  font-size: 0.9rem;
  display: inline-block;
  transition: transform 0.2s ease;
  margin-right: 0.3rem;
}

.collapsible.active .collapsible-header h4::before {
  transform: rotate(90deg);
}

/* Status chip variants */
.status-chip {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  color: #fff;
}

.status-not-started {
  background-color: #cfd8dc;
}

/* Softer pastel for in-progress and finished */
.status-in-progress {
  background-color: #ffeebb;
}

.status-finished {
  background-color: #b2e2b9;
}

/* Collapsible content */
.content {
  display: none;
  overflow: hidden;
  background: #fff;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  transition: max-height 0.3s ease;
}

.topic-lessons .titleImage{
    width: 100%;
    border-radius: 6px;
    height: 200px;
    object-fit: cover;
    border-radius: 6px;
    object-position: center;
}


.collapsible.active .content {
  display: block;
}

/* ================================================ */
/* Tutorial & Slides */
/* ================================================ */

.tutorial-container {
  width: 100%;
  max-width: 500px;
  margin: 2rem auto;
  text-align: center;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1.5rem;
}

.tutorial-container h3 {
  margin-top: 0;
  color: #333;
}

/* Slides */
.slides {
  position: relative;
  width: 100%;
  height: 350px;
  margin-top: 1rem;
  overflow: hidden;
}

.slide {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeSlide 9s infinite;
}

.slide:nth-of-type(1) { animation-delay: 0s; }
.slide:nth-of-type(2) { animation-delay: 3s; }
.slide:nth-of-type(3) { animation-delay: 6s; }

@keyframes fadeSlide {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  33%  { opacity: 1; }
  43%  { opacity: 0; }
  100% { opacity: 0; }
}

.slide p {
  font-size: 1rem;
  color: #555;
  margin: 0.5rem 0;
}

.slide img {
  width: 100%;
  margin-top: 0.5rem;
}

.tutorial-video {
  width: 100%;
  margin-top: 0.5rem;
}

/* ================================================ */
/* Drag-and-Drop Matching / Ordering */
/* ================================================ */

.drag-container {
  margin: 1rem 0;
}

.draggable-item {
  padding: 0.5rem 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  margin-bottom: 0.5rem;
  cursor: grab;
  user-select: none;
}

.drop-zone {
  border: 2px dashed #ccc;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  min-height: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ================================================ */
/* Context & Help Info */
/* ================================================ */

#question-context {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  background: #faf5ff;
  border: 1px solid #e4d8f7;
  border-radius: 8px;
  color: #333;
  font-size: 0.95rem;
}

#question-context h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #dba8e1; /* Pastel accent */
  font-weight: 600;
}

#question-context p {
  margin: 0;
  line-height: 1.5;
}

/* Lighter help info */
#help-info {
  display: none;
  margin: 1rem 0;
  padding: 1rem;
  background: #fef9e9;
  border: 1px solid #ffeeba;
  border-radius: 4px;
  color: #997a4a;
}

/* ================================================ */
/* Button Row: Submit & Help */
/* ================================================ */

.button-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* ================================================ */
/* Completion, Badges & Next Actions */
/* ================================================ */

.completion-message {
  text-align: center;
  margin-top: 2rem;
}

.badges {
  margin-top: 20px;
}

.badges h3 {
  margin-bottom: 15px;
  color: #333;
}

.badge {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}

.badge img {
  max-width: 50px;
  margin-right: 15px;
}

.badge-info h4 {
  margin: 0;
  font-size: 20px;
  color: #333;
}

.badge-info p {
  margin: 5px 0 0;
  font-size: 14px;
  color: #666;
}

.next-actions {
  text-align: center;
  margin-top: 2rem;
}

.continue-link {
  display: block;
  margin: 2rem 0;
  text-align: center;
}

/* ================================================ */
/* iOS Install Tip & Install Button */
/* ================================================ */

#iosInstallTip .install-instructions {
  background-color: #fdf8ff;
  border: 1px dashed #d2b6fa;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  margin: 1.5rem auto;
  font-size: 0.95rem;
  color: #333;
}

#iosInstallTip .install-instructions strong {
  color: #d2b6fa;
}

#installButton {
  display: none;
  padding: 0.75rem 1.5rem;
  /* Pastel gradient for install button */
  background: linear-gradient(90deg, #dba8e1, #c77ed0);
  border: none;
  border-radius: 25px;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.3s ease, transform 0.2s ease;
}

#installButton:hover {
  background: linear-gradient(90deg, #c77ed0, #b66fc5);
  transform: scale(1.02);
}

footer {
  text-align: center;
  margin-top: 2rem;
  padding: 1rem;
  background: #fff;
  border-top: 1px solid #ddd;
  border-radius: 12px;
}

footer label {
  margin-right: 0.5rem;
}

/* Example: Loader spinner on a button when in a loading state */
.btn.loading {
  position: relative;
  pointer-events: none; /* Prevent further clicks */
  opacity: 0.8;        /* Visual cue that the button is busy */
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.badges-section {
  padding: 1rem;
  border-radius: 10px;
}

.badges-row {
  display: flex;
  align-items: center;
  justify-content: left;
  flex-wrap: wrap;
  gap: 1rem;
}

.badge-summary {
  display: flex;
  align-items: center;
  gap: 0.3rem 1rem;
  flex-direction: row;
  flex-wrap: wrap;
}

/* Individual badge “pill” container */
.badge-item {
  display: inline-flex;
  align-items: center;
  background-color: #f3f3f3;
  border-radius: 20px;
  padding: 0.4rem 0.8rem;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #333;
}

.badge-item .badge-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.badge-item .badge-name {
  font-weight: 500;
}

/* "All Badges" button */
.badges-row .all-badges-btn {
  white-space: nowrap;
  margin-top: 0;
}

/* Lesson Streak Styling */
.lesson-streak {
  border-radius: 8px;
  padding: 1rem 0rem;
  font-size: 1.1rem;
  text-align: center;
}

.lesson-streak .streak-text {
  font-weight: bold;
  margin-right: 5px;
}

/* Softer blue for the streak number */
.lesson-streak .streak-number {
  font-size: 1.3rem;
  color: #82c0ff;
}

.lesson-streak .streak-days {
  margin-left: 5px;
}
