/* =================================================================
   SELF-HELP ASSESSMENT PAGE STYLES
   =================================================================
   
   FILE PURPOSE:
   Styles for the self-help assessment page including quiz interface,
   assessment cards, results display, and responsive layouts.
   
   MAIN SECTIONS:
   1. Quiz Container - Gradient background, centered layout
   2. Question Cards - White cards with questions and options
   3. Options Grid - 2-column checkbox-style layout
   4. Navigation - Back button and submit button
   5. Progress Bar - Visual progress indicator
   6. Results Table - Score display with status indicators
   7. Assessment Grid - Staggered card layout
   8. Responsive Styles - Mobile and tablet optimizations
   
   KEY FEATURES:
   - Gradient background (cyan → purple → yellow)
   - Centered white card for questions
   - 2-column grid layout for options (single column on mobile)
   - Checkbox-style selection with checkmarks
   - Auto-advance functionality (600ms delay)
   - Progress bar below quiz card
   - Right-aligned status column in results
   - Staggered assessment cards (desktop only)
   - Load more button after 5 cards
   - Fully responsive design
   
   FIXES IMPLEMENTED:
   - HTML tag rendering in questions (handles <p>, <strong>, etc.)
   - Auto-advance jump prevention with isNavigating flag
   - Retake button removed from results
   - Status column aligned to right
   - Mobile responsive optimizations
   
   ================================================================= */

/* =================================================================
   MAIN QUIZ CONTAINER
   ================================================================= 
   Full-screen container with gradient background
*/
.assessment-quiz-container {
  background: linear-gradient(135deg, #E0F7FA 0%, #F3E5F5 50%, #FFF9C4 100%);
  min-height: 100vh;
  padding: 2rem 0;
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* =================================================================
   QUIZ CONTAINER
   ================================================================= 
   Main container that holds all quiz elements
   Uses flexbox to control element ordering
*/
.assessment-quiz-container .container {
  max-width: 1200px;
  width: 100%;
  height: auto;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  position: relative;
  background: transparent;
  box-shadow: none;
}

/* Order the elements: form first, then progress, then results */
.assessment-form {
  order: 1;
}

.progress-container {
  order: 2;
}

.assessment-result {
  order: 3;
}

.loading-text {
  font-family: 'Georgia', serif;
  font-size: 18px;
  color: var(--gray-text);
  text-align: center;
  padding: 4rem;
}

.back-btn {
  background: transparent;
  color: #00BCD4;
  padding: 0.5rem 0;
  box-shadow: none;
  font-family: 'Georgia', serif;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 2rem;
  align-self: flex-start;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.back-btn:hover {
  color: #00ACC1;
  text-decoration: none;
}

.quiz-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 32px;
  color: #1671B0;
  text-align: center;
  margin-bottom: 3rem;
  display: none;
}

/* Assessment Form - Updated for single question display */
.assessment-form {
  width: 100%;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.question-group {
  display: none;
  /* Hide all groups by default */
  margin-bottom: 0;
  border: none;
  padding: 0;
  flex-grow: 1;
  width: 100%;
}

.question-group.active {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* =================================================================
   SUB-CATEGORY TITLE
   ================================================================= 
   Displays the name of the current sub-category (e.g., "Anxiety Stress")
   Shows above questions to indicate which category user is in
*/
.question-group-title {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 20px;
  color: #00BCD4;
  margin-top: 0;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #E0F7FA;
  text-align: center;
  display: block;
  /* Changed from none to block to show sub-category name */
}

.question-item {
  display: none;
  /* Hide all questions by default */
  flex-direction: column;
  justify-content: flex-start;
  padding: 3rem;
  background: #FFFFFF;
  border-radius: 24px;
  border: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  min-height: 320px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.question-item.active {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* =================================================================
   QUESTION TEXT
   ================================================================= 
   Displays the question - handles both plain text and HTML content
*/
.question-text {
  font-family: 'Georgia', serif;
  font-weight: 600;
  font-size: 18px;
  color: #333;
  margin-bottom: 2rem;
  margin-top: 0;
  padding-top: 0;
  line-height: 1.6;
  text-align: left;
}

/* Handle HTML paragraph tags within question text */
.question-text p {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  line-height: inherit;
}

.options-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 0;
  margin-top: 0;
  padding-top: 0;
  width: 100%;
}

.option-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: #FFFFFF;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Georgia', serif;
  font-size: 15px;
  color: #555;
  margin-bottom: 0;
  min-height: 50px;
}

.option-label:hover {
  background: #F5F5F5;
  border-color: #00BCD4;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 188, 212, 0.2);
}

.option-label input[type="radio"] {
  display: none;
}

/* Custom Checkbox Style */
.option-label .custom-radio {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid #B0B0B0;
  border-radius: 4px;
  background: #fff;
  transition: all 0.3s ease;
  position: relative;
}

.option-label input[type="radio"]:checked+.custom-radio {
  background: #00BCD4;
  border-color: #00BCD4;
}

.option-label input[type="radio"]:checked+.custom-radio::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
}

.option-label input[type="radio"]:checked~.option-text {
  font-weight: 600;
  color: #00BCD4;
}

/* =================================================================
   NAVIGATION BUTTONS CONTAINER
   ================================================================= 
   Contains the back button and submit button side by side
*/
.quiz-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 0;
  border-top: none;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.nav-btn {
  padding: 0.875rem 3rem;
  font-size: 16px;
  font-family: 'Georgia', serif;
  font-weight: 600;
  background: #00BCD4;
  color: #FFFFFF;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.nav-btn:hover {
  background: #00ACC1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3);
}

.nav-btn:disabled {
  background: #B0B0B0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.nav-btn.prev-btn {
  background: #00BCD4;
  color: #FFFFFF;
  border: none;
}

.nav-btn.prev-btn:hover {
  background: #00ACC1;
}

.nav-btn.prev-btn:disabled {
  background: #B0B0B0;
  color: #FFFFFF;
  border: none;
}

/* =================================================================
   SUBMIT BUTTON - APPEARS BESIDE BACK BUTTON ON LAST QUESTION
   ================================================================= 
   "See Results" button shown when user reaches final question
*/
.submit-btn {
  display: none;
  /* Hidden by default, shown on last question */
  padding: 0.875rem 3rem;
  font-size: 16px;
  font-family: 'Georgia', serif;
  font-weight: 600;
  background: #00BCD4;
  color: #FFFFFF;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 140px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.submit-btn:hover {
  background: #00ACC1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3);
}

.submit-btn:disabled {
  background: #B0B0B0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* =================================================================
   PROGRESS BAR - POSITIONED BELOW QUIZ CARD, ABOVE NAVIGATION
   ================================================================= 
   Shows visual progress through the assessment
*/
.progress-container {
  margin-top: 0;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  order: 2;
  /* Ensures it appears after the form */
}

.progress-label {
  font-family: 'Georgia', serif;
  font-size: 18px;
  color: #333;
  text-align: left;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.progress-bar-outer {
  width: 100%;
  height: 10px;
  background: #E0E0E0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-inner {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00BCD4 0%, #00ACC1 100%);
  border-radius: 10px;
  transition: width 0.5s ease-in-out;
}

/* Load More Button Style */
#load-more-btn {
  display: block;
  margin: 2rem auto 0 auto;
  background-color: #1671B0;
  color: #fff;
  max-width: 200px;
  font-family: 'Georgia', serif;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
}

#load-more-btn:hover {
  background: #105a8d;
  transform: translateY(-2px);
}

#load-more-btn:disabled {
  background: #B0B0B0;
  cursor: not-allowed;
}

/* Result Styles */
.assessment-result {
  text-align: left;
  padding: 0;
  border: none;
  background: transparent;
}

.result-table-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 28px;
  color: #333;
  margin-bottom: 1.5rem;
  text-align: center;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

/* =================================================================
   RESULT TABLE CELLS
   ================================================================= 
   Table headers and data cells styling
*/
.result-table th,
.result-table td {
  padding: 1rem 1.25rem;
  text-align: left;
  font-family: 'Georgia', serif;
  border-bottom: 1px solid #EAEAEA;
}

/* Status column aligned to the right */
.result-table th:last-child,
.result-table td:last-child {
  text-align: right;
}

.result-table th {
  font-weight: 700;
  font-size: 16px;
  color: #6B54A6;
  background: #F8F7FF;
}

.result-table td {
  font-size: 16px;
  color: #333;
}

.result-table tr:last-child td {
  border-bottom: none;
}

.status-passed {
  color: #28a745;
  font-weight: 600;
}

.status-failed {
  color: #dc3545;
  font-weight: 600;
}

.status-other {
  color: #333;
  font-weight: 600;
}

.overall-result {
  background: #fff;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

/* MODIFICATION: Hiding the overall score row */
.overall-score {
  display: none;
}

.overall-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Georgia', serif;
  font-size: 18px;
  color: #333;
  padding: 0.75rem 0;
}

.overall-score strong,
.overall-status strong {
  font-weight: 700;
  color: #000;
}

.overall-score span,
.overall-status span {
  font-weight: 600;
}

.result-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.result-buttons .btn {
  background: #1671B0;
  color: #fff;
  font-family: 'Georgia', serif;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
}

.result-buttons .btn:hover {
  transform: translateY(-2px);
}

/* Back to Home button - outlined style */
.result-buttons .btn#restart-full-btn {
  background: #fff;
  color: #1671B0;
  border: 1px solid #1671B0;
}

.result-buttons .btn#restart-full-btn:hover {
  background: #f8f7ff;
}

/* Retake Assessment button - primary style */
.result-buttons .btn#retake-quiz-btn {
  background: #00BCD4;
  color: #fff;
  border: none;
}

.result-buttons .btn#retake-quiz-btn:hover {
  background: #00ACC1;
}

/* =================================================================
   RESPONSIVE STYLES - MOBILE OPTIMIZATION
   ================================================================= 
   Ensures perfect display on tablets and mobile devices
*/

/* Tablet and below (768px) */
@media (max-width: 768px) {

  /* Quiz container adjustments */
  .assessment-quiz-container .container {
    padding: 1rem;
  }

  /* Question card - smaller padding on mobile */
  .question-item {
    padding: 2rem 1.5rem;
    min-height: 300px;
  }

  /* Question text - smaller font on mobile */
  .question-text {
    font-size: 16px;
    margin-bottom: 1.5rem;
  }

  /* Options - single column on mobile */
  .options-container {
    grid-template-columns: 1fr;
  }

  /* Navigation buttons - side by side on mobile */
  .quiz-navigation {
    flex-direction: row;
    width: 100%;
    gap: 0.75rem;
  }

  .nav-btn {
    flex: 1;
    min-width: auto;
    padding: 0.75rem 1.5rem;
    font-size: 14px;
  }

  .submit-btn {
    padding: 0.75rem 1.5rem;
    font-size: 14px;
  }

  /* Assessment grid - single column on mobile */
  .assess-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
  }

  /* Remove staggered layout on mobile */
  .assess-grid .assess:nth-child(even) {
    margin-top: 0 !important;
  }

  .assess.card {
    margin-top: 0 !important;
  }

  /* Responsive icon sizing for mobile */
  .assess-icon {
    width: 85px;
    height: 85px;
    border-radius: 50%;
  }

  .assess-icon img {
    width: 85%;
    height: 85%;
    border-radius: 50%;
  }

  /* Result table - responsive */
  .result-table {
    font-size: 14px;
  }

  .result-table th,
  .result-table td {
    padding: 0.75rem 1rem;
  }

  .result-table-title {
    font-size: 24px;
  }

  /* Overall status - stack on mobile */
  .overall-status {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Result buttons - stack on mobile */
  .result-buttons {
    flex-direction: column;
  }

  .result-buttons .btn {
    width: 100%;
  }

  /* Hero section adjustments */
  .selfhelp-hero .hero-title {
    font-size: 32px;
    line-height: 40px;
  }

  .selfhelp-hero .hero-subtitle {
    font-size: 18px;
    line-height: 28px;
  }
}

/* Small mobile devices (480px) */
@media (max-width: 480px) {

  /* Even smaller padding */
  .question-item {
    padding: 1.5rem 1rem;
  }

  /* Smaller text */
  .question-text {
    font-size: 15px;
  }

  .option-label {
    font-size: 14px;
    padding: 0.875rem 1rem;
  }

  /* Progress bar */
  .progress-label {
    font-size: 16px;
  }

  /* Navigation */
  .nav-btn {
    padding: 0.625rem 1rem;
    font-size: 13px;
  }

  /* Hero */
  .selfhelp-hero .hero-title {
    font-size: 28px;
    line-height: 36px;
  }

  .selfhelp-hero .hero-subtitle {
    font-size: 16px;
    line-height: 24px;
  }

  /* Assessment cards */
  .assess.card h3 {
    font-size: 16px;
  }

  .assess.card p {
    font-size: 14px;
  }

  /* Smaller icon for small mobile */
  .assess-icon {
    width: 75px;
    height: 75px;
    border-radius: 50%;
  }

  .assess-icon img {
    width: 85%;
    height: 85%;
    border-radius: 50%;
  }
}



/* ========================= SELF-HELP PAGE STYLES ========================= */

body.selfhelp-page {
  background-color: #D2C1FE;
  /* UPDATED */
  overflow-x: hidden;
}

.selfhelp-hero {
  background: transparent;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 2rem 0;
  margin-bottom: -80px;
  overflow: hidden;
}

.hero-bg-blob {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}

.selfhelp-hero .container {
  position: relative;
  z-index: 2;
}

.selfhelp-hero .hero-title {
  font-family: 'Playfair Display', serif;
  /* UPDATED */
  font-weight: 700;
  /* UPDATED */
  font-size: 40px;
  line-height: 50px;
  color: #1671B0;
  /* UPDATED */
  text-align: center;
  margin-top: -5rem;
  margin-bottom: 2rem;
}

.selfhelp-hero .hero-subtitle {
  font-family: 'Georgia', serif;
  /* UPDATED */
  font-weight: 500;
  font-size: 20px;
  line-height: 32px;
  color: #6B54A6;
  /* UPDATED */
  opacity: 0.8;
  text-align: center;
  max-width: 100%;
}

.hero-flower {
  position: absolute;
  z-index: 1;
  max-width: 60px;
  height: auto;
}

#flower1 {
  top: 30%;
  left: 15%;
  width: clamp(30px, 4vw, 40px);
}

#flower2 {
  top: 20%;
  right: 15%;
  width: clamp(35px, 5vw, 50px);
}

#flower3 {
  top: 55%;
  left: 48%;
  width: clamp(25px, 3vw, 30px);
}

#flower4 {
  top: 70%;
  right: 12%;
  width: clamp(30px, 4vw, 45px);
}

.selfhelp-assessments {
  position: relative;
  padding: 0;
  background: transparent;
  z-index: 2;
}

.selfhelp-assessments .container {
  padding-top: 5rem;
  padding-bottom: 3rem;
}

/* =================================================================
   ASSESSMENT GRID - STEPPED/STAGGERED LAYOUT
   ================================================================= 
   2-column grid with alternating vertical positions for visual interest
*/
.assess-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem 4rem;
  align-items: start;
  padding: 0 clamp(2rem, 8vw, 4rem);
}

/* Staggered layout: even cards are pushed down */
.assess-grid .assess:nth-child(even) {
  margin-top: 4rem;
}

/* =================================================================
   ASSESSMENT CARD
   ================================================================= 
   Individual assessment card with icon, title, description, and button
*/
.assess.card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  padding-bottom: 3.5rem;
  background: #FFFFFF;
  border: 1px solid #EAEAEA;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-xl);
  position: relative;
  margin-top: -3rem;
  /* Default negative margin, overridden by even cards */
  z-index: 10;
}

.assess-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  background: url('assets/Vector.png') no-repeat center center;
  background-size: contain;
  border-radius: 50%;
  overflow: hidden;
}

.assess-icon img {
  width: 85%;
  height: 85%;
  border-radius: 50%;
  object-fit: cover;
}

.assess-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.assess.card h3 {
  font-family: 'Playfair Display', serif;
  /* UPDATED */
  font-weight: 700;
  font-size: 18px;
  line-height: 1.4;
  color: #000;
  margin: 0 0 0.5rem 0;
}

.assess-description-wrapper {
  font-family: 'Georgia', serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray-text);
  margin: 0;
}

.assess.card p {
  font-family: inherit;
  font-weight: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0;
  display: inline;
}

.assess.card p.truncated {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assess.card p.expanded {
  display: inline;
}

.read-more-btn {
  background: none;
  border: none;
  color: #1671B0;
  font-family: 'Georgia', serif;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  margin: 0 0 0 0.25rem;
  text-align: left;
  display: inline;
  white-space: nowrap;
  vertical-align: baseline;
}

.read-more-btn:hover {
  text-decoration: underline;
}

.assess.card .btn.link {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  background: transparent;
  box-shadow: none;
  padding: 0;
  color: #1671B0;
  /* UPDATED */
  font-family: 'Georgia', serif;
  /* UPDATED */
  font-weight: 600;
  font-size: 16px;
}

.card {
  width: 100%;
  max-width: 550px;
}

.deco-img-left,
.deco-img-right {
  position: absolute;
  z-index: 1;
  opacity: 0.8;
  bottom: 8rem;
}

.deco-img-left {
  left: clamp(1rem, 5vw, 1rem);
  width: clamp(70px, 8vw, 90px);
}

.deco-img-right {
  right: clamp(3rem, 5vw, 1rem);
  width: clamp(90px, 10vw, 110px);
  bottom: 8rem;
}