/**
 * Translation Overlay Styles
 */

/* Container for translation bubble overlays */
.translation-bubbles-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Allow clicks to pass through the container */
}

/* Individual translation bubbles are clickable */
.translation-bubbles-overlay .translation-bubble {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}

/* Scan animation effect to make bubbles discoverable - only on first render */
.translation-bubble.animate-scan::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-accent-primary-subtle) 50%,
    transparent 100%
  );
  animation: bubbleScan 1.5s ease-out;
  animation-delay: var(--transition-duration); /* Wait for page transition to complete */
  pointer-events: none;
}

@keyframes bubbleScan {
  from {
    left: -100%;
  }
  to {
    left: 100%;
  }
}

/* Translation content overlay */
.translation-overlay {
  position: fixed;
  /* Position set dynamically via JS: top, left, right, bottom, width */

  background: var(--color-surface-base);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px var(--color-shadow);

  overflow-y: auto;
  overflow-x: hidden;

  /* Smooth entrance/exit */
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  pointer-events: none;

  /* Ensure overlay appears above navigation menu */
  z-index: var(--z-index-translation-overlay);
}

.translation-overlay.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* Content container */
.translation-content {
  padding: var(--spacing-3);
  font-family: var(--font-family);
  line-height: 1.5;
}

/* Sentence blocks */
.sentence-block {
  margin-bottom: var(--spacing-3);
  padding-bottom: var(--spacing-3);
  border-bottom: 1px solid var(--color-border-default);
}

/* Sentence text */
.sentence-text {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-1);
  margin-bottom: var(--spacing-2);
}

.sentence-text .chinese {
  font-size: var(--font-xl);
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.6;
}

.sentence-text .english {
  color: var(--color-text-secondary);
  font-style: italic;
  line-height: 1.5;
}

/* Section headings */
.vocabulary-section h3,
.grammar-section h3 {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: var(--spacing-1) 0 var(--spacing-1) 0;
}

/* Vocabulary list */
.vocabulary-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.vocabulary-list li {
  padding: var(--spacing-1) var(--spacing-2);
  background: var(--color-surface-subtle);
  border-radius: var(--radius);
  margin-bottom: var(--spacing-1);
  display: flex;
  gap: var(--spacing-1);
  flex-wrap: wrap;
  align-items: baseline;
}

.vocab-word {
  font-weight: 600;
  color: var(--color-text-primary);
  font-size: var(--font-xl);
}

.vocab-translation {
  color: var(--color-text-secondary);
}

.vocab-romanization {
  color: var(--color-text-muted);
  font-style: italic;
}

/* Grammar section */
.grammar-section {
  margin-top: var(--spacing-2);
}

.grammar-point {
  background: var(--color-surface-subtle);
  border-left: 3px solid var(--color-accent-primary);
  padding: var(--spacing-2);
  margin-bottom: var(--spacing-1);
  border-radius: var(--radius);
}

.grammar-pattern {
  font-weight: 600;
  color: var(--color-accent-primary);
  margin-bottom: var(--spacing-0-5);
  font-size: var(--font-xl);
}

.grammar-explanation {
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-0-5);
  line-height: 1.5;
}

.grammar-example {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: var(--font-xl);
  line-height: 1.4;
}

/* Full translation section */
.full-translation {
  margin-top: var(--spacing-3);
  padding: var(--spacing-2);
  background: var(--color-surface-accent);
  border-radius: var(--radius);
  border: 1px solid var(--color-border-accent);
}

.full-translation h3 {
  font-size: var(--font-base);
  font-weight: 600;
  margin: 0 0 var(--spacing-2) 0;
  color: var(--color-text-primary);
  text-transform: none;
  letter-spacing: normal;
}

.full-translation p {
  margin: 0;
  color: var(--color-text-secondary);
  line-height: 1.6;
}
