/* Global Styles */
:root {
  --primary-color: #2196f3;
  --primary-dark: #1976d2;
  --success-color: #4caf50;
  --error-color: #f44336;
  --text-color: #333;
  --background-color: #f5f5f5;
  --card-background: #ffffff;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  font-size: 16px;
  overflow: hidden; /* Prevent body scrolling */
  height: 100vh; /* Full viewport height */
}

/* Layout */
.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 1rem; /* Reduce padding to ensure content fits */
  margin: 0 auto;
  overflow: hidden;
}

/* Cards */
.card {
  background: var(--card-background);
  border-radius: 12px;
  padding: 3rem; /* Slightly reduce padding if needed */
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 800px;
  height: 600px !important; /* Fixed height with !important */
  min-height: 600px !important; /* Ensure minimum height */
  max-height: 600px !important; /* Ensure maximum height */
  margin: 0; /* Remove margin to prevent overflow */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4rem;
  overflow: auto; /* Add scrolling if content overflows */
  flex-shrink: 0 !important; /* Prevent shrinking */
  flex-grow: 0 !important; /* Prevent growing */
}

/* Forms */
.input-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.input-form input {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: var(--transition);
}

.input-form input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Buttons */
.button {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--primary-color);
  color: white;
}

.button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

/* Experiment Components */
.ishihara-test {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
  min-height: 400px; /* Give enough space for content */
  justify-content: space-between; /* Push button to bottom */
}

.ishihara-image {
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.input-container {
  display: flex;
  gap: 1rem;
  align-items: center;
  width: 100%;
  max-width: 400px;
  justify-content: center;
}

.ishihara-input {
  width: 150px;
  padding: 0.8rem;
  font-size: 1.2rem;
  text-align: center;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: var(--transition);
  margin: 0 auto;
}

.progress {
  color: #666;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Task Trials */
.test-trial,
.task-trial {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  height: 100%; /* Use full height of parent */
  justify-content: center; /* Center content vertically */
}

.choices {
  display: flex;
  justify-content: center;
  gap: 6rem;
  margin: 0 auto;
}

.choice {
  border-radius: 12px;
}

/* Questionnaire */
.question-container {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 0;
}

.question-text {
  font-size: 1.3rem; /* Larger questionnaire text */
  margin: 2rem 0;
  text-align: center;
  max-width: 800px; /* Wider container for questions */
  white-space: pre-line; /* Respect newlines and wrap */
}

.options-container {
  display: flex;
  justify-content: center;
  gap: 0.8rem; /* More space between options */
  flex-wrap: wrap;
  width: 100%;
  max-width: 800px;
  padding: 0.5rem; /* Add some padding */
}

.response-button {
  padding: 1rem 0;
  font-size: 1.2rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: var(--transition);
  min-width: 45px;
  width: 45px; /* Slightly wider buttons */
  text-align: center;
}

.response-button:hover {
  background: #f5f5f5;
}

.response-button.selected {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Text input for questionnaire */
.text-input {
  width: 100%;
  max-width: 200px;
  padding: 0.8rem 1rem;
  font-size: 1.2rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: var(--transition);
  text-align: center;
}

.text-input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.submit-button {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--primary-color);
  color: white;
  margin-left: 1rem;
}

.submit-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.submit-button:active {
  transform: translateY(0);
}

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

.text-center {
  text-align: center;
}

.instruction-text {
  font-size: 1.3rem; /* Larger instruction text */
  line-height: 1.6;
  margin: 0 auto;
  white-space: pre-line;
  text-align: center;
  width: 100%;
  max-width: 550px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Specific styles for trial instructions */
.test-trial .instruction-text,
.task-trial .instruction-text {
  display: block;
  line-height: 1.4;
}

/* Specific styles for participant screen */
.card > .instruction-text {
  max-width: 800px;
  display: flex; /* Keep flex for participant screen */
}

/* Remove any nested p tags margins */
.instruction-text p {
  margin: 0;
}

/* Task 2 Specific */
.term-buttons {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 2rem 0;
  flex-wrap: wrap; /* Allow buttons to wrap if needed */
}

.term-button {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--primary-color);
  color: white;
  min-width: 150px;
}

.term-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.term-button:active {
  transform: translateY(0);
}

/* Make sure exemplar image is also responsive */
.exemplar {
  margin: 0 auto;
}

/* Task Intro/End Box */
.test-intro,
.test-completion,
.task-intro {
  padding: 2rem;
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  margin: 1rem 0;
}

/* Different width for participant screen instructions */
.card > .instruction-text {
  max-width: 800px; /* Wider for participant screen */
}

/* Keep trial instructions narrower */
.test-trial .instruction-text,
.task-trial .instruction-text {
  max-width: 550px;
  line-height: 1.4;
}

/* Keep questionnaire text at its width */
.question-text {
  font-size: 1.3rem; /* Larger questionnaire text */
  margin: 2rem 0;
  text-align: center;
  max-width: 800px; /* Wider container for questions */
  white-space: pre-line; /* Respect newlines and wrap */
}

/* Different width for introduction text */
#introduction-screen .instruction-text {
  max-width: 900px; /* Wider for introduction */
}

/* Standardize all instruction and completion text */
.instruction-text,
.question-text,
.questionnaire_end,
.ishihara_confirmation,
.test-completion {
  font-size: 1.3rem;
  line-height: 1.6;
}

/* Color vision test specific */
.ishihara_confirmation {
  text-align: center;
  margin: 2rem 0;
}

.ishihara-test .button {
  margin: 0 auto;
  margin-top: auto; /* Push to bottom */
}

/* Hide all notifications that might appear in the bottom right */
[style*="position: fixed"][style*="bottom"][style*="right"],
[style*="position:fixed"][style*="bottom"][style*="right"],
div[style*="position: fixed"][style*="bottom: 10px"][style*="right: 10px"],
div[style*="position:fixed"][style*="bottom:10px"][style*="right:10px"],
div[style*="position: fixed"][style*="bottom: 15px"][style*="right: 15px"],
div[style*="position:fixed"][style*="bottom:15px"][style*="right:15px"] {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Target specifically the "Data saved successfully" notification */
body
  > div:not(#experiment-container):not(#loading-screen):not(#mobile-warning) {
  display: none !important;
}

/* Also make a more specific rule for the green notification */
body > div[style*="background-color: rgba(0,128,0"],
body > div[style*="background-color:rgba(0,128,0"],
body > div[style*="color: white"][style*="position: fixed"],
body > div:not([id])[style*="position: fixed"] {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Contact Footer */
#contact-footer {
  position: fixed;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 5px;
  font-size: 14px;
  z-index: 10000; /* Higher than loading screens (9999) */
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
}

#contact-footer p {
  margin: 0;
  color: #555;
}

.contact-info {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  padding: 5px;
  font-size: 14px;
}

.contact-info p {
  margin: 0;
  color: #555;
}

.contact-text {
  margin-top: 20px;
  font-size: 14px;
  color: #aaa;
}
