/* style.css - Optimized with Fixed Vocabulary Highlighting and Hand Pointer */

/* Base Styles */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: Arial, sans-serif;
  line-height: 1.5;
}

.container {
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Selectors */
.selector {
  margin: 12px 0;
}

.selector label {
  font-weight: bold;
  margin-right: 8px;
}

.selector select {
  padding: 8px 12px;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 15px;
  background-color: white;
}

/* Reading Section Sections */
#readingText {
  padding: 12px;
  background-color: white;
  border-radius: 5px;
  margin-top: 12px;
  line-height: 1.5;
  font-size: 20px; /* this is the size for the text */
}

/* Picture or image Sections */
#imageSection {  
  margin: 16px 0;
  display: flex;
  justify-content: center;
  background-color: white;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  max-width: 100%;
  min-height: 250px; /* Minimum height */
  height: auto; /* Flexible height */
  overflow: hidden; /* Prevent scrollbars */ 
}

#imageFrame {  
  width: 100%;
  max-height: 1000px; /* New maximum height */
  height: auto; /* Let it adjust based on content */
  border: none;
  background-color: white;
  border-radius: 5px;
  object-fit: contain; /* Ensures image fits properly */
  aspect-ratio: auto; /* Maintain original aspect ratio */
  min-height: 250px; /* Keep your original minimum size */ 
  /* Ensure the iframe can scale properly */
  display: block; /* Change from default inline */  
}

/* Add this to handle iframe contents */
#imageFrame img {
  max-width: 100%;
  max-height: 1000px;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
}

.responsive-image {
  max-width: 100%;
  max-height: 1000px;
  width: auto;
  height: auto;
  display: block;
  border-radius: 5px;
  object-fit: contain;
}

/* Audio Player */
#audioPlayer {
  width: 100%;
  margin: 16px 0;
}

/* Text Content */
#readingText {
  padding: 12px;
  background-color: white;
  border-radius: 5px;
  margin-top: 12px;
  line-height: 1.5;
}

/* Vocabulary Section */
#vocabularySection {
  margin-top: 20px;
  padding: 15px;
  background-color: #f8fafc;
  border-radius: 8px;
  border-left: 4px solid darkred;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#vocabularySection h3 {
  margin: 0 0 10px 0;
  color: darkred;
  font-size: 1.2em;
  padding-bottom: 5px;
  border-bottom: 1px solid #e2e8f0;
}

#vocabularySection p {
  margin: 0 0 12px 0;
  font-style: italic;
  color: #4a5568;
  font-size: 0.95em;
}

#vocabularyContent {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  padding: 10px 0;
}

.vocab-item {
  padding: 12px;
  background-color: white;
  border-radius: 6px;
  border-left: 3px solid #3182ce;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  line-height: 1.5;
}

.vocab-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  border-left-color: #2b6cb0;
}

.vocab-item strong {
  color: #2b6cb0;
  font-weight: 600;
  display: inline-block;
  margin-right: 5px;
}

/* Quiz Section */
#quizSection {
  margin-top: 20px;
}

.quiz-question {
  margin-bottom: 12px;
  padding: 12px;
  background-color: white;
  border-radius: 5px;
  border-left: 3px solid darkblue;
}

.quiz-question p {
  margin: 0 0 8px 0;
  font-weight: 500;
}

.quiz-question ul {
  list-style-type: none;
  padding-left: 0;
  margin: 6px 0;
}

.quiz-question li {
  margin: 4px 0;
  padding: 6px 8px;
  background-color: #f9f9f9;
  border-radius: 3px;
  transition: background-color 0.2s;
}

.quiz-question li:hover {
  background-color: #f0f0f0;
}

.quiz-question input[type="radio"] {
  margin-right: 8px;
  transform: scale(1.05);
  vertical-align: middle;
}

/* Info Box */
.info-box {
  border: 2px solid darkblue;
  border-radius: 12px;
  padding: 12px;
  margin: 16px 0;
  background-color: #f9f9f9;
}

.info-box label {
  display: block;
  margin-top: 8px;
  color: darkblue;
  font-weight: bold;
  font-size: 15px;
}

.info-box input[type="text"] {
  width: 100%;
  padding: 7px;
  margin: 4px 0 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 15px;
}

/* Buttons */
button {
  padding: 8px 16px;
  margin-right: 8px;
  border: none;
  border-radius: 4px;
  background-color: darkblue;
  color: white;
  cursor: pointer;
  font-size: 15px;
  transition: background-color 0.2s;
}

button:hover {
  background-color: #0056b3;
}

/* For mobile devices */
@media (max-width: 600px) {
  button {
    margin-right: 10px;
  }
}

/* Feedback */
#scoreFeedback {
  margin: 12px 0;
  font-weight: bold;
  color: darkgreen;
  padding: 8px;
  border-radius: 4px;
  background-color: #f0fff0;
}

#timestamp {
  font-size: 13px;
  color: #666;
  margin-top: 8px;
}

/* Vocabulary Word Highlighting - Consolidated and Fixed */
.vocab-word {
  color: #2b6cb0;
  cursor: pointer;
  border-bottom: 1px dashed #2b6cb0;
  transition: all 0.2s ease;
  background-color: transparent;
  position: relative;
}

.vocab-word:hover {
  background-color: #e8f0fe;
  text-decoration: none;
}

.current-highlight .vocab-word {
  background-color: #ffeb3b;
  color: #000;
  border-bottom: 1px dashed #000;
}

/* Text Highlighting */
.current-highlight {
  background-color: #ffeb3b;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background-color 0.3s ease;
}

/* Hand Pointer Styles */
#handPointer {
  position: absolute;
  width: 30px;
  height: 30px;
  pointer-events: none;
  z-index: 1000;
  transition: all 0.3s ease;
  transform-origin: bottom center;
  display: none;
}

/* Effect for vocabulary words when "pressed" */
.vocab-word.highlightable.pressed {
  display: inline-block;
  transform: scale(1.1);
  transition: transform 0.2s;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #vocabularyContent {
    grid-template-columns: 1fr;
  }
  
  .vocab-item {
    padding: 10px;
  }
  
  #handPointer {
    width: 25px;
    height: 25px;
  }
}

@media (max-width: 600px) {
  #vocabularySection {
    padding: 10px;
    margin-top: 15px;
  }
  
  .vocab-item {
    padding: 6px 8px;
    font-size: 14px;
  }
  
  #vocabularySection h3 {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  #vocabularySection {
    padding: 12px;
  }
  
  #vocabularySection h3 {
    font-size: 1.1em;
  }
  
  #handPointer {
    width: 20px;
    height: 20px;
  }
}

/* Container for buttons - Ensures horizontal layout */
.button-row {
  display: flex;
  gap: 5px;               /* Consistent spacing */
  overflow-x: auto;        /* Allows horizontal scroll if buttons overflow */
  padding-bottom: 5px;     /* Prevents scrollbar from touching buttons */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Button styling (applies to all buttons) */
#scoreButton, 
#clearButton, 
#screenshotButton {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background-color: darkblue;
  color: white;
  cursor: pointer;
  font-size: 15px;
  white-space: nowrap;     /* Prevents text wrapping */
  flex-shrink: 0;         /* Stops Chrome from shrinking buttons */
}

/* Tooltip Styles */
.vocab-tooltip {
  position: absolute;
  background: white;
  border: 2px solid #1a73e8;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  z-index: 10000;
  max-width: 250px;
  animation: fadeIn 0.2s ease-out;
  
  /* New positioning approach */
  left: var(--tooltip-x, 0);
  top: var(--tooltip-y, 0);
  transform: translateZ(0); /* Fixes flickering/disappearing */
  margin: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s, visibility 0.2s;
}

.vocab-tooltip.visible {
  visibility: visible;
  opacity: 1;
}

/* Smart positioning classes */
.vocab-tooltip.position-above {
  transform: translate(-50%, -110%);
}

.vocab-tooltip.position-below {
  top: var(--tooltip-y);
}

/* Vocabulary word styling (no changes to existing) */
.vocab-word {
  position: relative;
  display: inline;
}

/* Close button (keep your existing styles) */
.close-tooltip {
  position: absolute;
  top: -12px;
  right: -12px;
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 1001;
}

.close-tooltip:hover {
  background: #0d5bba;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* My Reading Game Styles ---*/
.reading-game {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  font-size: 18px;
  line-height: 1.6;
  text-align: left
}

.reading-text {
  margin-bottom: 20px;
  white-space: pre-wrap;
}

.draggable-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 15px 0;
  padding: 8px;
  background: #f5f9fa;
  border-radius: 8px;
  min-height: 60px;
  align-items: center; /* This ensures vertical alignment */
}

.draggable {
  padding: 4px 10px;
  margin: 0;
  font-size: 14px;
  background: #a0ebdf;
  border-radius: 12px;
  cursor: grab;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.2s;
  white-space: nowrap; /* Prevent text wrapping */
  flex-shrink: 0; /* Prevent shrinking */
  height: 24px; /* Fixed height */
  line-height: 1; /* Better vertical centering */
}

.drop-zone {
  display: inline-block;
  min-width: 60px;
  border-bottom: 2px dashed #3498db;
  margin: 0 2px;
  position: relative;
  color: inherit;  
  min-height: 22px;         /* Slightly larger than content */
  height: auto;             /* Flexible height */
  padding: 1px 0;           /* Minimal padding */  
}

.drop-zone.filled {
  border-bottom: none;
  color: inherit;
}

.hovered {
  background-color: #f0f8ff !important;
}

.game-button {
  padding: 4px 16px;
  background: darkblue;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 5px;
}

.game-button:hover {
  background: #0056b3;
}

/* Updated Drag-and-Drop Game Styles */
.draggable {
  padding: 2px 8px;       /* Smaller padding */
  margin: 0px;            /* Reduced margin */
  font-size: 14px;        /* Smaller font */
  background: #a0d2eb;
  border-radius: 12px;    /* Slightly less rounded */
  cursor: grab;
  display: inline-flex;   /* Better alignment */
  align-items: center;
  min-width: 0;          /* Allow natural width */
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  white-space: nowrap; 		/* Make sure text doesn't wrap 
  display: inline-flex;  /* Changed from inline-block */
  align-items: center;   /* Better vertical alignment */
  user-select: none;
  touch-action: none;
  line-height: 1.2;      /* Tighter line spacing */
  height: 24px;          /* Fixed height */
  box-sizing: border-box; /* Include padding in height */  
}

.draggable-words {
  gap: 8px;              /* Tighter spacing */
  padding: 15px;
  margin: 5px 0;
}

/* Updated Drop Zone Styles */
.drop-zone {
  min-width: 60px;
  height: 26px; /* Control fillintheblank height */
  margin: 0 2px;
  border-bottom: 2px dashed #3498db;
  vertical-align: middle;
  position: relative;
  display: inline-block;  
}

.drop-zone.filled {
  border-bottom: none;
}

.dropped-word { 
  padding: 1px 6px;         /* Smaller padding */
  font-size: 15px;          /* Slightly smaller text */
  height: 20px;             /* Reduced height */
  line-height: 1.1;         /* Tighter line spacing */
  min-width: 40px;          /* Minimum width */
  align-items: center;
  justify-content: center;
  background: #e0f7fa;
  border-radius: 12px;       /* Smaller radius */
  margin: 0 1px;            /* Minimal margin */
  white-space: nowrap; 		/* Make sure text doesn't wrap 
}

/* Word Bank Styles */
.draggable-words {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;              /* Reduced from 6px */
  margin: 8px 0;         /* Slightly reduced margins */
  padding: 4px 6px;      /* Tighter padding */
  background: #f5f9fa;
  border-radius: 8px;    /* Slightly smaller radius */
  min-height: 32px;      /* Reduced from 40px */
  align-items: center;   /* New: Vertically center items */
  transition: transform 0.2s ease, opacity 0.2s ease; /* New: ghost trailing items */
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .draggable-words {
    gap: 3px;
    padding: 3px;
    min-height: 28px;
  }
  
  .draggable {
    padding: 1px 6px;
    height: 22px;
    font-size: 13px;
  }
}

.draggable:hover {
  background: #8bc5e0;
}

.draggable.returned {
  animation: pulse 0.5s;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

draggable, .dropped-word {
  cursor: grab;
  user-select: none;
}

.draggable:active, .dropped-word:active {
  cursor: grabbing;
}

/*Preventing scrolling*/
body.dragging {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

.dragging {
  opacity: 0.4;
  transform: scale(0.9);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.dropped-word {
  padding: 4px 10px;
  background: #e0f7fa;
  border-radius: 12px;
  cursor: grab;
  display: inline-block;
  user-select: none;
  color: #000 !important;
}

.drop-zone.filled {
  border-bottom: none;
  color: inherit;
}

/* New color examples */
.drop-zone.correct {
  background-color: #e6ffed; /* Lighter green */
  border-left: 3px solid #2ecc71; /* Add green accent */
}

.drop-zone.incorrect {
  background-color: #ffebee; /* Lighter red */
  border-right: 3px solid #e74c3c; /* Add red accent */
}

#scoreDisplay {
    font-family: Arial, sans-serif;
    font-weight: bold;
    color: darkblue;
    text-align: center;  /* This will force centering */
}

.score-divider {
  border: 0;
  height: 2px;
  background-color: darkblue;
  margin: 12px 0;
}

/* showing like trailing tail for ss to know he is doing it. */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.8;
  transform: translate(-50%, -50%);
  padding: 4px 8px;
  background: #a0d2eb;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: transform 0.1s ease;
  animation: float 1s ease-in-out infinite alternate;
}

@keyframes float {
  from { transform: translate(-50%, -50%) rotate(-2deg); }
  to { transform: translate(-50%, -50%) rotate(2deg); }
}

body, .notranslate {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  translate: no;
}




