/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: #4a0e6b; /* Dark purple fallback */
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: #ffffff;
  line-height: 1.6;
  padding: 20px;
  min-height: 100vh; /* Ensure body takes full height */
}

.container {
  max-width: 1000px;
  margin: 40px auto;
  padding: 40px;
  /* background: rgba(0, 0, 0, 0.1); */ /* Removed grey box background */
  border-radius: 15px;
  text-align: center;
}

/* Hero Section */
/* NEW: Intro text style */
.intro-text {
  font-size: 1.2rem; /* Adjust size as needed */
  font-weight: 600;
  margin-bottom: 25px; /* Space below intro text */
  opacity: 0.95;
}

.hero {
  display: flex; /* Use flexbox for layout */
  align-items: flex-start; /* Changed from center to flex-start */
  /* justify-content: space-between; */ /* Removed this to let elements flow closer */
  gap: 10px; /* Reduced gap */
  text-align: left; /* Align text block to the left */
  margin-bottom: 40px; /* Keep margin below hero */
}

.hero-content {
  flex: 1; /* Allow text content to take available space */
  max-width: 600px; /* Limit text width */
}

.hero h1 {
  font-size: 2.8rem; 
  font-weight: 700;
  margin-bottom: 15px;
  line-height: 1.3;
  opacity: 0.9;
  text-align: left; /* Ensure h1 is left-aligned */
}

.hero p { /* Style for the main description paragraph */
  font-size: 1.4rem;
  max-width: 600px;
  /* Remove margin auto as flex handles alignment */
  margin-bottom: 40px; 
  opacity: 0.9;
  text-align: left; /* Ensure p is left-aligned */
}

.hero-mascot {
  max-width: 320px; /* Increased max width */
  height: auto; /* Maintain aspect ratio */
  flex-shrink: 0; /* Prevent mascot from shrinking */
  margin-left: -50px; /* Increased negative margin for more overlap */
  background-color: #0a0514; /* Dark blue-ish background for the image */
  border-radius: 5px; /* Optional: slight rounding if background shows too sharply */
}

/* Feature Checkmarks in Hero */
.feature-checks {
    margin-top: 15px; 
    margin-bottom: 30px; 
    display: grid; /* CHANGED to grid */
    grid-template-columns: repeat(3, 1fr); /* Create 3 equal columns */
    gap: 10px 15px; /* Keep reduced gap (row-gap column-gap) */
    margin-left: auto; /* Center the grid container */
    margin-right: auto; /* Center the grid container */
}

.check-item {
    display: inline-flex;
    align-items: start;
    font-size: 1.3em; 
    opacity: 0.9;
    text-align: left;
}

.check-item .checkmark {
    color: #ff7e3e; 
    font-weight: bold;
    margin-right: 6px;
    font-size: 1.1em; 
    line-height: 1; 
    flex-shrink: 0;
}

/* Input Section */
#inputSection {
  margin-bottom: 40px;
}

.input-group {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #ffffff;
  border-radius: 50px; /* Fully rounded */
  padding: 0 8px 0 25px; /* Adjust padding, no vertical needed with fixed height */
  max-width: 700px;
  margin: 0 auto 20px auto;
  height: 54px; /* Explicit height */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.input-group input[type="text"] {
  flex-grow: 1;
  min-width: 0; /* Prevent overflow in flex context */
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: 'Poppins', sans-serif;
  color: #333;
  background: transparent;
}

.input-group button {
  background-color: #ff7e3e; /* Orange button */
  color: white;
  border: none;
  border-radius: 50px; /* Restore full radius */
  padding: 10px 25px; /* Adjusted padding for vertical centering */
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: background-color 0.3s ease;
  white-space: nowrap; /* Prevent text wrapping */
  flex-shrink: 0; /* Add back */
}

.input-group button:hover {
  background-color: #e66a2e;
}

.input-group button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Audience Options */
.audience-options {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px; /* Space between options */
  margin-bottom: 20px;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.audience-options label {
  font-size: 0.9rem;
  opacity: 0.8;
}

.audience-options select {
  background: rgba(0, 0, 0, 0.3); /* Darker background */
  border: 1px solid rgba(255, 255, 255, 0.2); /* Slightly lighter border */
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-family: 'Poppins', sans-serif;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none; /* Remove default arrow */
  -moz-appearance: none;
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg fill="%23ffffff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 35px; /* Space for custom arrow */
}

.audience-options select option {
    background-color: #4a0e6b; /* Match background */
    color: white;
}

/* Feature Boxes */
.feature-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Responsive grid */
  gap: 30px;
  margin-top: 50px;
  cursor: pointer;
}

.feature-box {
  background: rgba(0, 0, 0, 0.3); /* Darker background */
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.feature-box .icon {
  font-size: 2.5rem; /* Larger icons */
  margin-bottom: 15px;
  display: inline-block; /* Center icon properly */
  line-height: 1;
}

.feature-box h3 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.feature-box p {
  font-size: 0.95rem;
  opacity: 0.8;
}

/* Spinner Style Update */
.spinner {
  border: 4px solid rgba(255, 255, 255, 0.2);
  width: 28px; /* Smaller spinner */
  height: 28px;
  border-radius: 50%;
  border-left-color: #ff7e3e; /* Match button color */
  margin: 20px auto 0 auto; /* Position below audience options */
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Loading text style */
.loading-text {
    margin-top: 10px;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Topic Selection Section (Initially Hidden) */
#topicsSection {
  background: rgba(0, 0, 0, 0.2);
  padding: 30px;
  border-radius: 15px;
  margin-top: 40px;
}

#topicsSection h2 {
  margin-bottom: 20px;
}

/* --- ADDED: Style for topic recommendation text --- */
.topic-recommendation {
  font-size: 0.85rem; /* Smaller text */
  opacity: 0.8;
  font-style: italic; /* Italic style */
  margin-top: -10px; /* Adjust spacing relative to heading */
  margin-bottom: 20px; /* Space before checkboxes */
  max-width: 600px; /* Limit width */
  margin-left: auto; /* Center */
  margin-right: auto; /* Center */
}

.topic-recommendation strong {
  font-weight: 600; /* Ensure bold is applied */
  font-style: normal; /* Remove italic from the bold part if desired */
}
/* --- END ADDED --- */

#topicCheckboxes label {
  display: block;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#topicCheckboxes label:hover {
    background: rgba(255, 255, 255, 0.1);
}

#topicCheckboxes input[type="checkbox"] {
  margin-right: 10px;
  accent-color: #ff7e3e; /* Match button color */
}

/* Style ONLY the Continue button */
#continueBtn {
  background-color: #ff7e3e; /* Orange button */
  color: white;
  border: none;
  border-radius: 50px; 
  padding: 12px 30px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-top: 20px; /* Keep the margin-top here */
}

/* Style ONLY the hover state for Continue button */
#continueBtn:hover {
    background-color: #e66a2e;
}

/* Style ONLY the disabled state for Continue button */
#continueBtn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Question List Section (Initially Hidden) */
#questionList {
  background: rgba(0, 0, 0, 0.2);
  padding: 30px;
  border-radius: 15px;
  margin-top: 40px;
  text-align: left;
}

/* Style for the fetched text display */
.wiki-text-display {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    max-height: 300px; /* Limit height */
    overflow-y: auto; /* Add scroll if needed */
    text-align: left;
    white-space: pre-wrap; /* Preserve line breaks */
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Style for the generate questions button */
.generate-questions-btn {
    display: block; /* Make it block level */
    margin: 20px auto; /* Center it */
    background-color: #ff7e3e; /* Orange button */
    color: white;
    border: none;
    border-radius: 50px; 
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.generate-questions-btn:hover {
    background-color: #e66a2e;
}

#questionList h2 {
  margin-bottom: 20px;
  text-align: center;
}

#questionList ul {
  list-style: none;
  padding: 0;
}

#questionList li {
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 8px;
  display: flex; /* Use flexbox for alignment */
  align-items: center; /* Align items vertically */
}

/* Style for the drag handle */
.drag-handle {
    cursor: grab;
    margin-right: 10px;
    font-size: 1.2rem;
    opacity: 0.6;
    user-select: none; /* Prevent text selection */
}

.drag-handle:active {
    cursor: grabbing;
}

#questionList .question-checkbox {
    margin-right: 10px; /* Keep margin */
    flex-shrink: 0; /* Prevent checkbox from shrinking */
}

/* SortableJS helper classes (optional styling) */
.sortable-ghost {
    opacity: 0.4;
    background: #4a0e6b;
}

.sortable-chosen {
    /* Style for the item being dragged (optional) */
}

.sortable-drag {
    opacity: 0.9; /* Make dragged item slightly transparent */
}

/* Quiz Options Section Styles */
#quizOptionsSection {
    background: rgba(0, 0, 0, 0.2);
    padding: 30px;
    border-radius: 15px;
    margin-top: 40px;
    text-align: center;
}

.options-group-container {
    margin-bottom: 40px;
}

.options-group-container h3 {
    margin-bottom: 20px;
    font-weight: 600;
}

/* PDF Layout Options Styling - Apply to both grids now */
.layout-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    /* Remove justify-content if grid columns handle centering */
    /* justify-content: center; */
    max-width: 600px; /* Limit width for centering */
    margin: 0 auto; /* Center the grid */
}

.layout-option-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px; /* Reduce gap slightly */
    min-height: 120px; /* Ensure a minimum height */
    justify-content: center; /* Center content vertically too */
}

.layout-option-box:hover, 
.layout-option-box.selected {
    background: rgba(255, 126, 62, 0.2); /* Use the orange theme color with some transparency */
    border-color: rgba(255, 126, 62, 0.6); /* Make border match the theme color too */
    transform: translateY(-3px); 
}

.layout-option-box .icon {
    font-size: 1.8rem; /* Slightly smaller icon */
}

.layout-option-box .text {
    font-size: 0.9rem;
    font-weight: 600; /* Make text bolder */
}

/* Style for the description paragraph */
.layout-option-box .description {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 2px;
}

/* Finalize Button */
#finalizeBtn {
    background-color: #ff7e3e; 
    color: white;
    border: none;
    border-radius: 50px; 
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 30px; /* Ensure consistent margin above finalize */
}

#finalizeBtn:hover {
    background-color: #e66a2e;
}

/* Utility for screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Basic Responsiveness */
@media (max-width: 768px) {
  .hero {
    /* flex-direction: column; */ /* Removed to keep side-by-side layout */
    /* text-align: center; */ /* Keep left-align from default hero style? */
    /* Adjust gap or other properties if needed for smaller screens */
    gap: 5px; /* Reduce gap further on small screens */
  }

  .hero-content {
      max-width: 100%; 
      /* text-align: center; */ /* Keep left-align? */
      /* order: 2; */ /* Removed order property */
  }

  .hero h1,
  .hero p {
      /* text-align: center; */ /* Keep left-align? */
  }

  .hero-mascot {
      /* order: 1; */ /* Removed order property */
      max-width: 180px; /* Re-added smaller size for mobile */
      margin-bottom: 0; 
      margin-left: 0; /* Set margin to 0 for smaller screens */
  }
  
  .intro-text {
      font-size: 1.1rem; /* Slightly smaller intro text */
  }

  .input-group {
    padding: 8px 8px 8px 15px;
    max-width: 95%;
  }
  .input-group input[type="text"] {
    text-align: left;
  }
  .input-group button {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  .audience-options {
    flex-direction: column; /* Stacks vertically */
    gap: 15px; /* Reduces gap when stacked */
    max-width: 400px; /* Limit width when stacked */
    margin-left: auto; /* Center the container */
    margin-right: auto; /* Center the container */
    align-items: flex-start; /* Align items to the start (left) */
  }
  .audience-options .option-group {
    display: flex; /* Ensure flex display */
    align-items: center; /* Keep vertical alignment */
    width: 100%; /* Make group take full width of container */
  }
  .audience-options .option-group label {
      width: 180px; /* Adjust this width */
      text-align: left; /* Align text left */
      flex-shrink: 0; /* Prevent label from shrinking */
      margin-right: 10px; /* Gap between label and select */
  }
  .feature-boxes {
      grid-template-columns: 1fr;
  }
  .container {
      padding: 20px;
  }

  /* Adjust background position for mobile */
  body {
    background-position: top center; 
  }

  .feature-checks {
      grid-template-columns: repeat(2, 1fr); /* Switch to 2 columns on smaller screens */
      /* Adjust gap or other properties if needed */
      max-width: 500px; /* Optional: Adjust max-width for 2 columns */
  }

  .check-item { /* Added rule for check item */
      font-size: 1em; /* Smaller font size on mobile */
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.8rem;
  }
  .hero p {
    font-size: 0.9rem;
  }
}

/* Add More Topics Section Styles */
.add-topics {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.add-topics label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

/* Reuse .input-group but make it smaller */
.input-group.small {
    max-width: 400px; /* Adjust max width */
    margin: 0 auto; /* Center it */
    padding: 0 8px 0 15px; /* Adjust padding */
    height: 54px; /* Match the explicit height */
    align-items: center;
}

.input-group.small input[type="text"] {
    font-size: 0.9rem;
}

.input-group.small button {
    background-color: #ff7e3e; /* Ensure consistency */
    color: white;
    border: none;
    /* Remove vertical padding, use flex to center text */
    padding: 0 20px; /* Only horizontal padding */
    display: inline-flex; /* Use flex for centering */
    align-items: center;    /* Center text vertically */
    justify-content: center; /* Center text horizontally (optional) */
    border-radius: 50px; 
    font-size: 0.9rem;
    font-weight: 600; 
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0; 
    height: 40px; /* Let's try adjusting height directly */
    /* Adjust height slightly smaller than container if needed */
}

/* Add hover/disabled states specifically for the small Add button */
.input-group.small button:hover {
    background-color: #e66a2e;
}

.input-group.small button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Smaller spinner */
.spinner.small {
    width: 20px;
    height: 20px;
    border-width: 3px;
    margin: 15px auto 0 auto; /* Centered margin */
    /* display: inline-block; /* No longer inline */
    /* vertical-align: middle; /* No longer needed */
}

/* Warning Text Style */
.warning-text {
    font-size: 0.85rem;
    color: #ffccaa; /* Light orange/peach color */
    max-width: 500px;
    margin: 25px auto 0 auto; /* Spacing and centering */
    padding: 0 15px;
    opacity: 0.9;
    line-height: 1.5;
}

/* --- Library Section Styles --- */
/* Align library section style with the rest */
.container #librarySection {
  background: rgba(0, 0, 0, 0.2); /* Match other sections */
  padding: 30px;
  border-radius: 15px; /* Match other sections */
  box-shadow: none; /* Remove specific shadow if container provides it */
  margin-top: 40px; /* Match other sections */
  color: #ffffff; /* Default text color back to white */
}

/* Style children relative to the more specific parent */
.container #librarySection h2,
.container #librarySection h3,
.container #librarySection h4,
.container #librarySection p {
    color: #ffffff; /* Ensure headers and paragraphs inside are light */
    opacity: 0.9; /* Slight transparency for paragraphs */
}
.container #librarySection p {
    color: #eee; /* Lighter color for paragraphs */
}

.container #librarySection .library-controls {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap; 
}

/* Style inputs/selects similar to audience options */
.container #librarySection #librarySearchInput {
  flex-grow: 1; 
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  border-radius: 20px; /* Rounded */
  font-size: 1rem;
  outline: none;
}
.container #librarySection #librarySearchInput::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.container #librarySection #libraryLanguageSelect {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 10px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-family: 'Poppins', sans-serif;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none; 
  -moz-appearance: none;
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg fill="%23ffffff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 35px; 
}

.container #librarySection #libraryLanguageSelect option {
    color: #333; /* Options still need dark background likely */
    background-color: #fff;
}

/* Style Search button similar to Fetch/Finalize */
.container #librarySection #librarySearchBtn {
  padding: 10px 25px;
  background-color: #ff7e3e; /* Orange like fetch button */
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.container #librarySection #librarySearchBtn:hover {
  background-color: #e66a2e;
}

.container #librarySection .library-results {
  margin-bottom: 30px;
}

.container #librarySection .quiz-list-container {
  min-height: 50px; 
  border: 1px solid rgba(255, 255, 255, 0.2); /* Lighter border */
  background: rgba(255, 255, 255, 0.05); /* Slight background */
  border-radius: 8px;
  padding: 15px;
}

/* --- NEW: Styles for Quiz Listing Items --- */
.quiz-list-item {
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease; /* Add transition */
}

.quiz-list-item:last-child {
    border-bottom: none;
}

/* Style for the active/selected list item */
.quiz-list-item.active {
    background-color: rgba(255, 126, 62, 0.1); /* Slight orange background */
}

.quiz-item-title {
    display: block; /* Make title block to push stars below */
    margin-bottom: 8px; 
    color: #ff7e3e; /* Restore orange color */
    font-weight: 600; /* Keep it bold */
    cursor: pointer; /* Keep pointer cursor for click */
    font-size: 1.1rem; /* Restore font size */
}

.quiz-item-title:hover {
    text-decoration: underline; /* Restore hover effect */
}

/* --- NEW: Star Rating Styles --- */
.star-rating {
    display: inline-block; /* Allow placing next to other elements if needed, or use block */
    margin-bottom: 8px; /* Space below stars before tags */
    font-size: 1.1rem; /* Adjust size of stars */
    color: #ff7e3e; /* Orange color for stars */
    line-height: 1; /* Prevent extra line height */
}

.star {
    display: inline-block; /* Keep stars inline */
    margin-right: 2px; /* Tiny space between stars */
    cursor: default; /* Default cursor, maybe pointer later */
}

/* Styles for different star states (using Unicode chars) */
.star.filled {
    /* ★ is already filled, color is set by .star-rating */
}

.star.empty {
    /* ☆ is outline, color is set by .star-rating */
    /* Optionally make empty stars less prominent */
    opacity: 0.7;
}

.star.half {
    /* For 4.5 stars etc. later */
    position: relative;
    display: inline-block;
    /* Content is the filled star */
}

.star.half::before {
    content: '★'; /* Filled star character */
    position: absolute;
    left: 0;
    top: 0;
    width: 50%; /* Show only half */
    overflow: hidden;
    color: #ff7e3e; /* Ensure color */
}
/* --- END: Star Rating Styles --- */

.quiz-item-tags {
    font-size: 0.8rem;
    color: #ccc;
    opacity: 0.8;
    margin: 0;
}
/* --- END: Styles for Quiz Listing Items --- */

/* --- NEW: Style for Create Own Prompt Link --- */
.create-own-prompt {
    text-align: center;
    margin-top: 30px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.create-own-link {
    color: #ff7e3e; /* Orange link color */
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

.create-own-link:hover {
    text-decoration: none;
}
/* --- END: Style for Create Own Prompt Link --- */

.container #librarySection #librarySelectedQuiz {
  margin-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.2); /* Lighter border */
  padding-top: 20px;
}

/* Adjust library question item style */
.container #librarySection .question-item {
  background: rgba(255, 255, 255, 0.05); /* Match other sections */
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  margin-bottom: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  cursor: grab;
  color: #eee; /* Lighter text for questions */
}
.container #librarySection .question-item .drag-handle {
    color: #aaa; /* Adjust handle color */
    opacity: 0.8;
}
.container #librarySection .question-item .answer-preview {
    color: #bbb; /* Lighter color for answer preview */
    font-size: 0.85rem;
    margin-left: auto; /* Push answer to the right */
    padding-left: 15px;
    opacity: 0.7;
}


/* Keep existing library option styles, they should work */
.container #librarySection #libraryQuizOptionsSection {
    margin-top: 20px;
}

.container #librarySection #libraryQuizOptionsSection h4 {
    margin-bottom: 15px;
    font-weight: 600;
    color: #fff; /* Ensure white */
}

/* Style library finalize button */
.container #librarySection #libraryFinalizeBtn {
  display: block; 
  width: 100%;
  max-width: 300px; 
  margin: 30px auto 0; 
  padding: 15px 40px; /* Match main finalize button */
  background-color: #ff7e3e; /* Match main finalize button */
  color: white;
  border: none;
  border-radius: 50px; /* Match main finalize button */
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.container #librarySection #libraryFinalizeBtn:hover {
    background-color: #e66a2e;
}

/* --- End Library Section Styles --- */

/* REMOVE TEMPORARY DEBUG STYLE */
/* 
body div#librarySection {
    border: 5px solid red !important;
    background-color: yellow !important;
}
*/

/* Wiki Text Display Box */
.wiki-content-box {
    background: rgba(0, 0, 0, 0.2); /* Darker translucent background */
    padding: 20px;
    border-radius: 10px;
    text-align: left; /* Align text left */
    margin-top: 20px;
    margin-bottom: 20px; /* Space before generate button */
    max-height: 300px; /* Limit height and add scroll */
    overflow-y: auto;
    white-space: pre-wrap; /* Allow wrapping */
    word-wrap: break-word; /* Break long words */
    font-family: monospace; /* Use monospace for pre */
    color: #e0e0e0; /* Lighter text color */
}

/* Style for the generate questions button */
#generateQuestionsBtn {
  background-color: #ff7e3e; /* Orange button */
  color: white;
  border: none;
  border-radius: 50px;
  padding: 12px 30px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-top: 20px; /* Add some space above */
  display: inline-block; /* Ensure it respects margins */
}

#generateQuestionsBtn:hover {
  background-color: #e66a2e;
}

#generateQuestionsBtn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* PDF Layout and Fake Answer Options Grid Container*/
.options-grid {
  display: grid;
  /* Adjust minmax for better fit, maybe slightly larger min width */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
  gap: 20px;
  margin-top: 10px;
  margin-bottom: 30px; /* Space before finalize button */
  /* Ensure grid itself doesn't have strange alignment if it's inside another flex/grid */
  width: 100%; /* Take full width available in its container */
  justify-content: center; /* Center grid items if grid takes more space than items */
}


/* Styles for generated questions list inside Quiz Options */
#quizOptionsSection ul#questions { /* Target the specific list */
  list-style: none;
  padding: 0;
  margin-top: 20px;
  margin-bottom: 30px;
}

/* <<< Add New Styling for Individual Question Items >>> */
#quizOptionsSection ul#questions li.generated-question-item {
  background-color: rgba(255, 255, 255, 0.08); /* Slightly more visible box */
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px 15px;
  margin-bottom: 10px;
  display: flex; /* Use flexbox for alignment */
  align-items: center; /* Vertically align items */
  gap: 10px; /* Space between handle, checkbox, text */
  text-align: left; /* Ensure text inside is left-aligned */
}

/* Styling for the Drag Handle */
#quizOptionsSection ul#questions li.generated-question-item .drag-handle {
  cursor: grab;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.2em;
  padding-right: 5px; /* Small space after handle */
  user-select: none; /* Prevent text selection on handle */
  flex-shrink: 0; /* Prevent handle from shrinking */
}

#quizOptionsSection ul#questions li.generated-question-item .drag-handle:active {
  cursor: grabbing;
}

/* Styling for the Question Checkbox */
#quizOptionsSection ul#questions li.generated-question-item .question-checkbox {
  margin-right: 5px; /* Space after checkbox */
  flex-shrink: 0; /* Prevent checkbox from shrinking */
  /* Optional: Style checkbox appearance if needed */
}

/* Styling for the Question Text Span */
#quizOptionsSection ul#questions li.generated-question-item .question-text {
  flex-grow: 1; /* Allow text to take up remaining space */
  /* font-weight: 600; Optional: make question bold */
}

/* Styling for the Answer Text Span */
#quizOptionsSection ul#questions li.generated-question-item .answer-text,
#librarySection ul#libraryQuestions li.question-item .answer-text {
  opacity: 0.7;
  font-size: 0.9em;
  /* margin-left: auto; /* Removed auto margin for consistent flow */
  padding-left: 2px; /* Smaller space before answer */
  flex-shrink: 0; 
}

/* Styling for Answer Label spans */
#quizOptionsSection ul#questions li.generated-question-item .answer-label,
#librarySection ul#libraryQuestions li.question-item .answer-label {
    opacity: 0.7;
    font-size: 0.9em;
}

/* Style for the Edit button */
.edit-btn,
.save-btn,
.cancel-btn {
    background: none;
    border: none;
    color: #ffae8a; /* Light orange */
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 5px;
    margin-left: auto; /* Push button to the right */
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.edit-btn:hover,
.save-btn:hover,
.cancel-btn:hover {
    color: #ff7e3e; /* Brighter orange on hover */
}

/* Style for editable spans */
.question-text[contenteditable="true"],
.answer-text[contenteditable="true"] {
    background-color: rgba(255, 255, 255, 0.15);
    outline: 1px dashed rgba(255, 255, 255, 0.5);
    padding: 2px 4px;
    margin: -2px -4px; /* Adjust negative margin to keep layout stable */
    border-radius: 3px;
}

/* SortableJS Helper Classes */
.sortable-ghost {
  opacity: 0.4;
  background-color: #ff7e3e;
}

/* --- NEW: Secondary Button Style --- */
.secondary-btn {
    background-color: rgba(255, 255, 255, 0.1); /* Lighter background */
    color: #eee; /* Lighter text */
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 10px 25px; /* Match input-group button padding */
    font-size: 1rem;
    font-weight: 500; /* Less bold */
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;

}

.secondary-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}
/* --- END: Secondary Button Style --- */

/* --- Updated Quiz Library Styles --- */
  
/* --- REMOVE Old Download Button Styles --- */
/* 
.download-btn {
    background-color: #ff7e3e; // Match finalize button color
    // ... other properties ... 
}

.download-btn:last-child {
    // ... 
}

.download-btn:hover {
  // ... 
}

.download-btn:disabled {
    // ... 
}
*/
/* --- END Remove Old Styles --- */

/* Payment Modal Styles */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
}

.modal-content {
  background-color: #fefefe;
  margin: 15% auto; /* 15% from the top and centered */
  padding: 20px 30px;
  border: 1px solid #888;
  width: 80%; /* Could be more or less, depending on screen size */
  max-width: 500px; /* Maximum width */
  border-radius: 8px;
  text-align: center;
  position: relative;
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
  color: #333; /* Ensure text inside modal is readable */
}

.modal-content h2 {
    color: #333; /* Darker color for heading inside modal */
    margin-bottom: 15px;
}

.modal-content p {
    color: #555; /* Darker color for paragraph inside modal */
    margin-bottom: 10px;
}

.close-button {
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
}

.close-button:hover,
.close-button:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

#confirmPaymentBtn {
  background-color: #4CAF50; /* Green */
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  margin-top: 20px;
  transition: background-color 0.3s ease;
}

#confirmPaymentBtn:hover {
  background-color: #45a049;
}

.payment-placeholder {
    margin-top: 20px;
    padding: 15px;
    background-color: #f0f0f0;
    border-radius: 4px;
    opacity: 0.8;
}

.payment-placeholder p em {
    color: #666; /* Adjust placeholder text color */
}

/* Library Back Button Specific Style */
.library-back-btn {
  display: block; /* Make it block for centering */
  padding: 8px 15px; /* Smaller padding */
  font-size: 0.9rem;
  margin: 0 auto 20px auto; /* Center horizontally, add margin below */
  max-width: 200px; /* Optional: Limit width */
}

/* Remove the clear rule for h3 */
/* #librarySelectedQuiz h3 {
    clear: left;
} */

/* --- Footer Styles --- */
.site-footer {
    background: rgba(0, 0, 0, 0.2); /* Match section background */
    padding: 25px 30px; /* Adjust padding as needed */
    border-radius: 15px; /* Match section border-radius */
    margin-top: 50px; /* Add space above the footer */
    text-align: center; /* Center footer content */
}

.site-footer .footer-content {
    max-width: 1000px; /* Optional: Limit width like container */
    margin: 0 auto; /* Center content within footer padding */
    display: flex;
    flex-direction: column; /* Stack paragraph and nav vertically */
    align-items: center; /* Center items horizontally */
    gap: 15px; /* Increased gap slightly for selector */
}

.site-footer p {
    color: #ccc; /* Lighter text color */
    font-size: 0.9rem;
    opacity: 0.8;
    margin: 0; /* Remove default margin */
}

.site-footer .footer-nav {
    display: flex;
    flex-wrap: wrap; /* Allow links to wrap on smaller screens */
    justify-content: center;
    gap: 15px; /* Space between links */
}

.site-footer .footer-nav a {
    color: #ffae8a; /* Lighter orange/peach for links */
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.site-footer .footer-nav a:hover {
    color: #ffffff; /* White on hover */
    text-decoration: underline;
}

/* --- NEW: UI Language Selector Styles --- */
.language-selector-container {
    /* No specific styles needed for container currently */
}

#uiLanguageSelect {
  background: rgba(255, 255, 255, 0.1); /* Match other selects */
  border: 1px solid rgba(255, 255, 255, 0.3); /* Match other selects */
  color: white;
  padding: 5px 10px; /* Smaller padding for footer */
  border-radius: 20px; /* Match other selects */
  font-size: 0.85rem; /* Slightly smaller font size */
  font-family: 'Poppins', sans-serif;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none; /* Remove default arrow */
  -moz-appearance: none;
  appearance: none;
  /* Use the same SVG arrow as other selects */
  background-image: url('data:image/svg+xml;utf8,<svg fill="%23ffffff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
  background-repeat: no-repeat;
  background-position: right 8px center; /* Adjust arrow position slightly */
  padding-right: 30px; /* Space for custom arrow */
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

#uiLanguageSelect:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

#uiLanguageSelect option {
    background-color: #4a0e6b; /* Match main background */
    color: white;
}
/* --- END UI Language Selector Styles --- */
/* --- END Footer Styles --- */

/* --- Reviews Section Styles --- */
.reviews-section {
    background: rgba(0, 0, 0, 0.2); /* Match other sections */
    padding: 30px; 
    border-radius: 15px; 
    margin-top: 50px; 
    text-align: center; 
}

.reviews-section h2 {
    margin-bottom: 30px; /* More space below heading */
    font-weight: 600;
}

.review-item {
    margin-bottom: 25px;
}

.review-item:last-child {
    margin-bottom: 0;
}

.review-stars {
    color: #ff7e3e; /* Orange color for stars */
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.review-stars span {
    margin: 0 1px; /* Tiny space between stars */
}

.review-text {
    font-style: italic;
    color: #eee; /* Light text color */
    max-width: 600px; /* Limit width */
    margin: 0 auto 10px auto; /* Center and add space below */
    line-height: 1.7;
}

.reviewer-name {
    font-weight: 600;
    color: #ccc; /* Slightly lighter than main text */
    font-size: 0.9rem;
}

.review-divider {
    border: none;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.15);
    margin: 30px auto; /* Space above and below divider */
    width: 80%; /* Make divider not full width */
    max-width: 400px;
}

/* --- NEW: Feedback Link Style --- */
.feedback-prompt {
  margin-top: 30px; /* Space above the link */
  text-align: center;
}

.feedback-prompt a {
  color: #ccc; /* Lighter, less prominent color */
  text-decoration: underline;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.feedback-prompt a:hover {
  color: #fff; /* White on hover */
}
/* --- END Feedback Link Style --- */

/* --- NEW: Download Buttons Section Styling --- */
#downloadButtonsContainer,
#libraryDownloadButtonsContainer {
    display: flex;
    flex-direction: column; /* Stack vertically */
    align-items: center; /* Align buttons to the center */
    gap: 10px; /* Add space between buttons */
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

#downloadButtonsContainer p.download-description,
#libraryDownloadButtonsContainer p.download-description {
    margin-bottom: 10px; /* Add space below description */
    margin-right: 0; /* Remove right margin if buttons are vertical */
    font-weight: 600;
    color: #eee; /* Adjust color if needed */
    text-align: center; /* Center the description text */
}

.download-btn {
    padding: 10px 18px;
    background-color: #ff7e3e; /* Explicitly set primary orange color */
    color: white;
    border: none;
    border-radius: 20px; /* Match other buttons */
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
    width: auto; /* Let button size naturally */
    min-width: 200px; /* Add a minimum width for better appearance */
    text-align: center;
    align-self: center; /* Explicitly center the button itself */
}

.download-btn:hover {
    background-color: #e07b00; /* Consistent darker orange on hover */
    transform: translateY(-1px);
}

.download-btn:active {
    transform: translateY(0px);
}

/* Add back the disabled state styling */
.download-btn:disabled {
    background-color: #cccccc;
    color: #888; /* Optional: Dim text color */
    cursor: not-allowed;
    transform: none; /* Remove hover/active transform */
    opacity: 0.7; /* Optional: Reduce opacity */
}

/* Re-introduce specific styling for the secondary (raw text) button */
.download-btn.secondary-btn {
    background-color: #555; /* Grey background */
    color: #ddd; /* Lighter text for contrast */
}

.download-btn.secondary-btn:hover {
    background-color: #777; /* Slightly lighter grey on hover */
    transform: translateY(-1px); /* Keep hover effect consistent */
}

/* --- Media Query for smaller screens --- */
@media (max-width: 768px) {
  #downloadButtonsContainer,
  #libraryDownloadButtonsContainer {
    flex-direction: column; /* Stack items vertically */
    align-items: center; /* Center items horizontally */
    text-align: center; /* Ensure text itself is centered */
  }

  .download-description {
    margin-bottom: 15px; /* Add space below text when stacked */
    min-width: auto; /* Remove min-width constraint on small screens */
  }

  .download-btn {
      width: 80%; /* Make buttons take more width */
      max-width: 300px; /* But not too wide */
      margin-right: 0; /* Remove right margin when stacked */
  }
}
/* --- END Download Buttons Section Styling --- */

/* General Modal Styles (if needed later) */
/* ... */

/* Style for payment modal (placeholder) */
/* ... */

/* --- ADD Media Query for Mobile Responsiveness --- */
@media (max-width: 600px) { 
  #quizOptionsSection ul#questions li.generated-question-item {
    flex-wrap: wrap; /* Allow items to wrap */
    padding: 10px; /* Slightly reduce padding */
    gap: 5px; /* Reduce gap */
  }

  #quizOptionsSection ul#questions li.generated-question-item .drag-handle {
    /* Handle might be less useful on mobile, could hide if desired */
    /* display: none; */ 
    padding-right: 0; /* Remove extra padding if kept */
  }

  #quizOptionsSection ul#questions li.generated-question-item .question-checkbox {
    /* Checkbox usually fine */
  }

  #quizOptionsSection ul#questions li.generated-question-item .question-text {
    /* Allow question text to take full width minus checkbox/handle */
    flex-basis: calc(100% - 50px); /* Adjust basis depending on handle/checkbox size */
    order: 3; /* Place text after handle/checkbox */
  }

  #quizOptionsSection ul#questions li.generated-question-item .answer-text {
    /* Answer text takes full width on its own line below */
    flex-basis: 100%; 
    order: 4; /* Place answer last */
    margin-left: 0; /* Remove the auto margin */
    padding-left: 0; /* Remove extra padding */
    margin-top: 5px; /* Add a small space above the answer */
    text-align: left; /* Ensure left alignment */
    opacity: 0.8; /* Slightly more visible on mobile maybe */
    font-size: 0.85em; /* Slightly smaller */
  }
}
/* --- END Media Query --- */

/* Styling specific IDs for layout options grids */
#pdfLayoutOptions,
#fakeAnswerOptions {
    max-width: 600px; /* Limit width */
    margin-left: auto; /* Center the grid container */
    margin-right: auto; /* Center the grid container */
}

/* PDF Layout and Fake Answer Options Grid Container */
.options-grid { 
  /* Keep existing grid styles */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
  gap: 20px;
  margin-top: 10px;
  margin-bottom: 30px; 
  width: 100%; 
  /* justify-content: center; /* This might not be needed if max-width and margin auto works */
}

/* Specific color for Save button icon */
.save-btn {
    color: #28a745; /* Green color */
}

.save-btn:hover {
    color: #218838; /* Darker green on hover */
}

/* Style for generated/library question lists */
.sortable-list {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.sortable-list li {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center; /* Align items vertically */
    cursor: grab;
}

.sortable-ghost {
    opacity: 0.4;
    background-color: #555;
}

.drag-handle {
    cursor: grab;
    margin-right: 10px;
    font-size: 1.2em; 
    color: #aaa;
}

.question-checkbox {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 0 !important;
    margin-left: 0;
    margin-bottom: 0;
}

.question-number {
    font-weight: bold;
    margin-right: 5px;
}

.answer-label,
.answer-text {
    /* font-style: italic; */ /* Remove italic? */
    color: #ccc; /* Lighter color for answer */
    margin-left: 5px;
}



.edit-btn, .save-btn, .cancel-btn {
    background: none;
    border: none;
    color: #eee;
    cursor: pointer;
    font-size: 1.1em;
    margin-left: auto; /* Push buttons to the right */
    padding: 2px 5px;
}

.edit-btn:hover, .save-btn:hover, .cancel-btn:hover {
    color: #fff;
}

.save-btn {
    color: #28a745; /* Green */
}
.save-btn:hover {
    color: #218838; /* Darker Green */
}

.cancel-btn {
    margin-left: 5px; /* Add space between save/cancel */
    color: #dc3545; /* Red */
}
.cancel-btn:hover {
    color: #c82333; /* Darker Red */
}

/* New style for the remove question button */
.remove-question-btn {
    background: none;
    border: 1px solid rgba(220, 53, 69, 0.5); /* Reddish border, slightly transparent */
    color: #dc3545; /* Red text */
    cursor: pointer;
    font-size: 0.85em; /* Slightly smaller */
    padding: 3px 8px;
    margin-left: 8px; /* Space from other buttons */
    border-radius: 15px; /* Pill-like */
    font-weight: 500;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.remove-question-btn:hover {
    color: #fff;
    background-color: rgba(220, 53, 69, 0.7);
    border-color: rgba(220, 53, 69, 0.9);
}

/* --- Cookie Consent Banner Styles --- */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #282c34; /* Mörk bakgrund */
    color: #ffffff;
    padding: 15px 25px;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.2);
    z-index: 1000; /* Se till att den ligger överst */
    display: flex; /* Använd flexbox för layout */
    justify-content: space-between; /* Sprid ut innehållet */
    align-items: center; /* Centrera vertikalt */
    flex-wrap: wrap; /* Tillåt radbrytning på små skärmar */
    gap: 15px; /* Mellanrum mellan text och knappar */
}

.cookie-banner p.cookie-text {
    margin: 0;
    font-size: 0.9em;
    flex-grow: 1; /* Låt texten ta upp tillgängligt utrymme */
    max-width: 70%; /* Begränsa bredden på texten lite */
}

.cookie-banner p.cookie-text a {
    color: #61dafb; /* Ljusare länkfärg */
    text-decoration: underline;
}

.cookie-buttons {
    display: flex;
    gap: 10px; /* Mellanrum mellan knappar */
}

.cookie-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.cookie-btn.accept {
    background-color: #4CAF50; /* Grön */
    color: white;
}
.cookie-btn.accept:hover {
    background-color: #45a049;
}

.cookie-btn.reject {
    background-color: #f44336; /* Röd */
    color: white;
}
.cookie-btn.reject:hover {
    background-color: #da190b;
}

/* Media Query för mindre skärmar */
@media (max-width: 768px) {
    .cookie-banner {
        flex-direction: column; /* Stapla elementen */
        text-align: center;
    }
    .cookie-banner p.cookie-text {
        max-width: 100%;
        margin-bottom: 10px;
    }
    .cookie-buttons {
        justify-content: center; /* Centrera knappar */
        width: 100%;
    }
}

/* CSS för spinner (loader) */
.loader {
  border: 5px solid #f3f3f3; /* Light grey */
  border-top: 5px solid #555; /* Darker grey for spinner part */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto; /* Centrera spinnern */
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Styling for question generation buttons */
.question-generator-options button {
    margin-right: 5px;
    padding: 6px 10px; /* Reduced padding */
    border-radius: 15px; /* More pill-like */
    border: 1px solid transparent;
    color: #e0e0e0;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    font-size: 0.85em; /* Reduced font size */
}

.question-generator-options button:hover {
    color: #fff;
}

/* Individual button colors */
.question-generator-options button.generate-btn[data-type="song"] {
    background-color: rgba(46, 204, 113, 0.2); /* Greenish */
    border-color: rgba(46, 204, 113, 0.6);
}
.question-generator-options button.generate-btn[data-type="song"]:hover {
    background-color: rgba(46, 204, 113, 0.4);
    border-color: rgba(46, 204, 113, 0.8);
}

.question-generator-options button.generate-btn[data-type="artist"] {
    background-color: rgba(155, 89, 182, 0.2); /* Purplish */
    border-color: rgba(155, 89, 182, 0.6);
}
.question-generator-options button.generate-btn[data-type="artist"]:hover {
    background-color: rgba(155, 89, 182, 0.4);
    border-color: rgba(155, 89, 182, 0.8);
}

.question-generator-options button.generate-btn[data-type="spinoff"] {
    background-color: rgba(241, 196, 15, 0.2); /* Yellowish */
    border-color: rgba(241, 196, 15, 0.6);
}
.question-generator-options button.generate-btn[data-type="spinoff"]:hover {
    background-color: rgba(241, 196, 15, 0.4);
    border-color: rgba(241, 196, 15, 0.8);
}

/* Keep manual button orange but with similar transparency */
.question-generator-options button.write-btn[data-type="manual"] {
    background-color: rgba(230, 126, 34, 0.2); /* Orangish */
    border-color: rgba(230, 126, 34, 0.6);
}
.question-generator-options button.write-btn[data-type="manual"]:hover {
    background-color: rgba(230, 126, 34, 0.4);
    border-color: rgba(230, 126, 34, 0.8);
}

/* Keyframe animation for the glow effect */
@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 4px rgba(216, 27, 96, 0.6);
  }
  50% {
    box-shadow: 0 0 18px rgba(142, 36, 170, 0.9);
  }
  100% {
    box-shadow: 0 0 4px rgba(216, 27, 96, 0.6);
  }
}

/* Special styling for the awesome AI Search button */
.btn.btn-awesome-ai {
    background-image: linear-gradient(45deg, #d81b60, #8e24aa); /* Vibrant pink to purple gradient */
    border: none;
    color: #ffffff;
    font-weight: 600;
    animation: pulse-glow 2.5s infinite ease-in-out;
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease, background-image 0.3s ease;
}

.btn.btn-awesome-ai:hover {
    transform: translateY(-2px); /* Lift effect on hover */
    background-image: linear-gradient(45deg, #e7206e, #9c27b0); /* Slightly brighter on hover */
    color: #ffffff;
}

/* Styling for question items based on their type */
.question-item {
    padding: 10px;
    margin-bottom: 10px; /* Ensure space between items */
    border-radius: 5px;
    border-left-width: 5px;
    border-left-style: solid;
    /* transition for smooth color changes if items are re-rendered/typed */
    transition: background-color 0.3s, border-left-color 0.3s;
}

.question-item.question-type-song {
    background-color: rgba(46, 204, 113, 0.05); 
    border-left-color: rgba(46, 204, 113, 0.5); 
}

.question-item.question-type-artist {
    background-color: rgba(155, 89, 182, 0.05); 
    border-left-color: rgba(155, 89, 182, 0.5);
}

.question-item.question-type-spinoff {
    background-color: rgba(241, 196, 15, 0.07); /* Slightly more visible for yellow */
    border-left-color: rgba(241, 196, 15, 0.6);
}

.question-item.question-type-manual {
    background-color: rgba(230, 126, 34, 0.05);
    border-left-color: rgba(230, 126, 34, 0.5);
}

.question-item.question-type-default-title,
.question-item.question-type-default-artist {
    background-color: rgba(118, 118, 118, 0.05); /* Greyish for defaults */
    border-left-color: rgba(118, 118, 118, 0.4); /* Darker grey border */
}

/* Ensure existing .pill-button styles don't override these too much */
/* If .pill-button has very specific background/border, we might need to adjust specificity */
/* For now, the new rules for .question-generator-options button should be specific enough. */

/* Ensure that the add-question-btn also has consistent styling if it's not covered */
.add-question-btn {
    /* padding: 8px 12px; */ /* Already in .write-btn */
    /* border-radius: 15px; */ /* Already in .write-btn */
    /* Consider if it needs a default transparent style or a neutral color */
     
     border: 1px solid rgba(100, 100, 100, 0.6);
     color: #e0e0e0;
     margin-bottom: 25px;
}
.add-question-btn:hover {
    background-color: rgba(100, 100, 100, 0.4);
    border-color: rgba(120, 120, 120, 0.8);
    color: #fff;
}

/* New styles for inline spinner */
.inline-spinner {
    border: 3px solid rgba(var(--text-color-rgb, 224, 224, 224), 0.3); /* Lighter border for contrast */
    border-radius: 50%;
    border-top-color: var(--primary-color, #4dabf7); /* Using a primary color, ensure this var is defined or replace */
    width: 20px;
    height: 20px;
    animation: inlineSpin 0.8s linear infinite;
    margin: 10px auto; /* Some margin to breathe */
    display: block; /* To allow auto margins for centering */
}

@keyframes inlineSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ensure question items and their main content areas are left-aligned */
.question-item,
.question-content-wrapper {
    text-align: left;
}

/* Specifically align text content within these elements to the left */
.question-item .question-text,
.question-item .answer-row, /* Affects label and answer span within */
.question-item .question-source {
    text-align: left;
}

/* Ensure the group of buttons itself is aligned to the start (left)
   and items within it are also aligned to the start.
   The buttons themselves should have their own text-align if needed,
   but the group's positioning is key. */
.question-item .action-buttons-group {
    text-align: left; /* For the container itself if it has any direct text */
    display: flex; /* Use flexbox for alignment of items within */
    justify-content: flex-start; /* Align items (checkbox, buttons) to the start */
    align-items: center; /* Align items vertically centered */
    gap: 8px; /* Add some space between checkbox and buttons */
}

/* If individual buttons' text got centered by a global button rule, reset it.
   std-btn should ideally handle this, but as a safeguard: */
.question-item .action-buttons-group .std-btn {
    text-align: center; /* Icons/text within buttons are usually centered */
}

.question-item .question-content-wrapper {
  /* Ensure this wrapper allows its children to align properly */
  display: flex;
  flex-direction: column; /* Stack question/answer rows and button group vertically */
  flex-grow: 1;
  justify-content: center; /* Center content vertically if question-item has fixed height and children less */
  padding-left: 10px; /* Space from drag handle */
}

/* Align text within question/answer rows to the start (left) */
.question-item .question-row,
.question-item .answer-row {
  text-align: left;
  width: 100%; /* Ensure they take full width */
}

.question-item .action-buttons-group {
  display: flex;
  align-items: center; /* Vertically align checkbox and buttons */
  gap: 8px; /* Consistent spacing between checkbox and buttons */
  margin-top: 10px; /* Space above the button group */
  flex-wrap: wrap; /* Allow buttons to wrap if not enough space */
}

/* Styles for the Questions Tab Song Header - INCREASED SPECIFICITY & ROBUSTNESS */
#questions-view-container #questions-area .song-header-container {
    display: flex !important; /* Ensure flex is applied */
    flex-direction: row !important; /* Ensure default row direction */
    justify-content: space-between !important; /* Title left, button right */
    align-items: center !important;       /* Vertically align items */
    padding: 12px 0;
    margin-bottom: 18px;
    border-bottom: 1px solid #3a3f51;
    width: 100%; /* Ensure it takes full width to allow space-between */
}

#questions-view-container #questions-area .song-header-container .song-header-title {
    font-size: 1.8em;
    font-weight: 600;
    color: #e0e0e0;
    margin: 0;
    order: 0 !important; /* Reset order */
    display: inline-block !important; /* Override potential block */
    width: auto !important; /* Adjust width automatically */
    float: none !important; /* Reset float */
    clear: none !important; /* Reset clear */
}

#questions-view-container #questions-area .song-header-container .add-manual-question-btn {
    order: 1 !important; /* Ensure button comes after title visually if order was an issue, or use 0 as well */
    display: inline-block !important; /* Override potential block */
    width: auto !important; /* Adjust width automatically */
    float: none !important; /* Reset float */
    clear: none !important; /* Reset clear */
    margin-left: 15px; /* Add some space from the title */
}

/* Ensure question items clear the new header correctly */
/* No increased specificity needed here for now unless problems arise */
.question-item {
    margin-bottom: 15px; 
}

.song-title-in-questions {
  font-size: 22px;
  margin: 8px;
}

/* Credit Ticker Styles */
#credit-ticker-container {
    position: fixed; 
    bottom: 20px;    
    right: 20px;     
    background-color: #2c3e50; 
    color: #ecf0f1; 
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000; 
    font-family: 'Poppins', sans-serif; 
    font-size: 0.9em;
    display: flex; 
    align-items: center;
}

#credit-ticker-text {
    margin-right: 8px;
    opacity: 0.8;
}

#credit-ticker-value {
    font-weight: 600; 
    font-size: 1.1em; 
}

/* --- Apple Switch for Fake Answers --- */
.fake-answer-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    margin-left: 20px; /* Indent slightly */
}

.fake-answer-toggle-container .toggle-label {
    font-size: 0.8em;
    font-weight: 600;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
}

.apple-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.apple-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #ff6600; /* Orange color */
}

input:focus + .slider {
    box-shadow: 0 0 1px #ff6600;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 28px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Disabled state */
input:disabled + .slider {
    cursor: not-allowed;
    background-color: #555;
}

input:disabled + .slider:before {
    background-color: #444;
}

/* --- Hide old button permanently --- */
.generate-fake-answers-btn {
    display: none !important;
}

/* --- Toast Notification --- */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #28a745; /* Green for success */
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    z-index: 1050;
    font-size: 1em;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-notification.error {
    background-color: #dc3545; /* Red for error */
}