/* Common Base Styles */
p,
span {
  font-size: 1.1rem;
}

@media screen and (max-width: 480px) {

  p,
  span {
    font-size: 0.8rem;
  }
}

/* Layout Containers */
#textAndOptions {
  width: 100%;
  flex-direction: column;
  padding: 1em clamp(1em, 8%, 8em);
  height: 96%;
  flex: 1 1 auto;
  overflow: auto;
  text-align: justify;
  line-height: 2.5rem;
  font-size: 1rem;
}

#fullWritingSection {
  margin-top: 1em;
  margin-bottom: 1em;
  width: 100%;
}

/* Task Sections - Combined */
#task2Section,
#task3Section,
#task4Section,
#task5Section,
#task6Section,
#completionSection {
  margin-top: 2em;
}

.question {
  margin-bottom: 2em;
}

/* Button Styles - Combined */
button {
  padding: 0.6em 1.2em;
  margin: 0.5em 0;
  font-size: 1rem;
  border: none;
  border-radius: 1em;
  background-color: #502f77;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover:not(:disabled) {
  background-color: #4cbce0;
}

button:disabled {
  background-color: #a0a0a0;
  cursor: not-allowed;
}

.nextBtn {
  padding: 12px 20px;
  margin: 8px 0;
  max-width: none;
  font-size: 1em;
}

/* Highlight Options - Combined Base Styles */
.hlOption,
.selected,
.selectedTask1,
.selectedTask2,
.correct {
  cursor: pointer;
  border-radius: 1.5em;
  padding: 0.3em;
  transition: all 0.3s ease-in-out;
  border: 2px solid rgb(100, 208, 255);
  background-color: white;
  position: relative;
  z-index: 1;
}

/* Selection States - Combined */
.selected {
  background-color: rgb(217, 242, 253);
  border: 1px solid lightblue;
}

.selectedTask1 {
  background-color: #d9f2fd;
  border: 2px solid #64d0ff;
}

.selectedTask2 {
  background-color: #ffe6e6;
  border: 2px solid #ff9999;
}

.correct {
  background-color: #c8e6c9 !important;
  border: 2px solid green !important;
  font-size: 1.1rem;
}

/* Selection Feedback States - Combined */
.hlOption.selected-correct {
  background-color: #c8e6c9 !important;
  border: 2px solid green !important;
}

.hlOption.selected-incorrect {
  background-color: #ffcdd2 !important;
  border: 2px solid rgb(201, 60, 60) !important;
  color: rgb(57, 57, 57) !important;
}

.hlOption.unselected-correct {
  background-color: #ffffff !important;
  border: 1px solid rgba(0, 128, 0, 0.45) !important;
  opacity: 0.7 !important;
}

.hlOption.unselected-incorrect {
  background-color: #ffffff !important;
  border: 2px solid rgb(98, 98, 98) !important;
}

/* Explanation Styles - Combined */
.hlExplanation {
  cursor: pointer;
  transition: all 0.3s ease;
}

.hlExplanation.active,
.hlOption.active,
[id^='ExplanationFor'].active {
  box-shadow: 0 0 8px rgba(76, 188, 224, 0.8);
  background-color: rgb(217, 242, 253);
  font-weight: bolder;
  color: rgb(0, 0, 0);
  transition: all 0.3s ease;
}

/* Explanation Container */
.explanation {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: white;
  padding: 20px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
  border-top: 3px solid #2e8b57;
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: start;
  font-size: 1.1em;
  line-height: 1.4;
  min-height: 12em;
  overflow-y: scroll;
}

.explanation-intro {
  width: 100%;
  color: #6d6d6d;
  text-align: center;
  margin-bottom: 15px;
}

.explanation-items {
  width: 100%;
  text-align: center;
  display: block;
}

.explanation-item {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0 auto;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out,
    box-shadow 0.3s ease-in-out;
  color: #333;
  max-width: 800px;
  background-color: white;
  border-radius: 2em;
  padding: 0.2em 0.8em;
  opacity: 0;
  visibility: hidden;
}

.explanation-item.correct {
  box-shadow: 0 0 8px rgba(18, 92, 31, 0.35);
}

.explanation-item.incorrect {
  box-shadow: 0 0 8px rgba(128, 128, 128, 0.35);
}

/* Progress Bars */
#progressBars {
  margin: 1em 0;
}

#progressBars .progressBar {
  width: 100%;
  background-color: #e0e0e0;
  border-radius: 0.5em;
  overflow: hidden;
  margin-bottom: 0.5em;
}

#progressBars .progressBarFilled {
  height: 1em;
  background-color: #64d0ff;
  width: 0%;
  transition: width 0.3s;
}

/* Utility Classes */
.hidden {
  display: none;
}

.reveal {
  display: block !important;
}

.span-active {
  box-shadow: 0 0 20px rgb(0, 0, 0);
}

/* Next Button Sections - Combined */
#nextButtonSection,
.nextButtonSection {
  display: flex;
  justify-content: center;
  width: 100%;
  font-size: 1em;
  padding: 0.6em 1.2em;
  margin: 0.5em 0;
  border: none;
  border-radius: 1em;
}

input[type="text"],
.gap,
textarea,
input {
  max-width: none;
  min-width: 20em;
}

#nextButton {
  margin: 0 auto;
}

/* Media Queries */
@media screen and (max-width: 768px) {
  body {
    font-size: 16px;
    line-height: 1.6;
  }

    .question {
       padding: 0.5em;
        line-height: 2em;
    
}
  #textAndOptions {
    padding: 10px;
  }

  button {
    padding: 12px 20px;
    margin: 8px 0;
    width: 100%;
    max-width: none;
  }

  .explanation {
    padding: 15px;
    min-height: 8em;
  }

  .explanation-intro {
    padding: 10px;
    margin-bottom: 10px;
  }

  .explanation-item {
    padding: 10px;
    margin: 5px auto;
  }

  .task-instructions {
    padding: 15px;
    margin: 10px 0;
  }
}

@media screen and (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .explanation {
    min-height: 12em;
  }

  button {
    padding: 10px 15px;
  }

  p,
  span {
    font-size: 0.8rem;
  }
}

/* Sample Accordion Styles */
#sampleAccordion {
  width: 100%;
  max-width: 100%;
  margin: 1em 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}

#sampleAccordion summary {
  padding: 1em;
  background-color: #502f77;
  color: white;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

#sampleAccordion summary:hover {
  background-color: #4cbce0;
}

#sampleAccordion div {
  padding: 1em;
  background-color: #f5f5f5;
}

#sampleAccordion img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em 0;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#sampleAccordion audio {
  width: 100%;
  margin: 1em 0;
}

@media screen and (max-width: 768px) {
  #sampleAccordion {
    margin: 0.5em 0;
  }

  #sampleAccordion summary {
    padding: 0.8em;
    font-size: 0.9em;
  }

  #sampleAccordion div {
    padding: 0.8em;
  }
}

/* Premium Feature Section Styles */
.premium-feature {
  background-color: #f8f4ff;
  border-radius: 8px;
  padding: 10px;
  margin: 15px 0;
}

.highlight-text {
  color: #6b46c1;
  font-weight: 600;
  margin: 0;
}

.benefits-list,
.guarantee-box {
  margin: 20px 0;
}

.benefits-list ul,
.guarantee-box ul {
  list-style: none;
  padding-left: 20px;
}

.benefits-list li,
.guarantee-box li {
  margin: 10px 0;
  line-height: 1.5;
}

/* Update existing sample image styles */
#sampleAccordion img,
.sample-image {
  max-width: 100%;
  margin: 10px 0;
}

/* FAQ Section Styles */
.faq-section {
  margin: 2em 0;
}

.faq-section h3 {
  color: #502f77;
  margin-bottom: 1em;
}

.faq-item {
  margin-bottom: 1em;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.faq-item summary {
  padding: 1em;
  background-color: #f8f4ff;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.faq-item summary:hover {
  background-color: #efe8ff;
}

.faq-item[open] summary {
  border-bottom: 1px solid #e0e0e0;
}

.faq-item div {
  padding: 1em;
  background-color: white;
}

.faq-item ul {
  list-style: none;
  padding-left: 1em;
}

.faq-item li {
  margin: 0.5em 0;
  position: relative;
  padding-left: 1.5em;
}

.faq-item li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #502f77;
}

@media screen and (max-width: 768px) {
  .faq-section {
    margin: 1.5em 0;
  }

  .faq-item summary {
    padding: 0.8em;
  }

  .faq-item div {
    padding: 0.8em;
  }
}

/* Dropdown styles to prevent overflow issues */
#writingTaskDropdown,
#customTaskTypeDropdown {
  max-width: 100%;
  width: 100%;
  min-width: 0;
  height: 2.75rem;
  padding: 0.55rem 2.75rem 0.55rem 1rem;
  border: 1px solid #b0c2ff;
  border-radius: 1.5rem;
  background-color: rgb(188, 238, 255);
  color: #4a4a4a;
  font-size: max(1rem, 16px);
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 12 12'%3E%3Cpath fill='%23502f77' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Style for dropdown options to prevent them from pushing container */
#writingTaskDropdown option,
#writingTaskDropdown optgroup,
#customTaskTypeDropdown option {
  color: #3f3f3f;
  background: #fff;
}

#writingTaskDropdown:hover,
#customTaskTypeDropdown:hover {
  background-color: #d9f2fd;
  border-color: #b29afa;
}

#writingTaskDropdown:focus,
#customTaskTypeDropdown:focus {
  outline: none;
  border-color: #8e9eff;
  box-shadow: 0 0 0 4px rgba(176, 194, 255, 0.35);
}

/* Ensure the task selection area doesn't expand beyond its container */
#taskSelectionArea {
  max-width: 100%;
  overflow: hidden;
}

#taskSelectionArea > label {
  display: block;
  margin-bottom: 0.6rem;
}

.task-select-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#customTaskTypeWrapper {
  width: 100%;
}

@media (min-width: 768px) {
  .task-select-row {
    flex-direction: row;
    align-items: flex-start;
  }

  #writingTaskDropdown {
    flex: 0 1 50%;
    max-width: 32rem;
  }

  #customTaskTypeWrapper {
    flex: 0 0 15rem;
    max-width: 18rem;
  }
}
