/* ==========================================================================
   Dialogue — Left/right speaker alignment and situaciones browse styles
   ========================================================================== */

/* ---- Dialogue sentence container needs flex-column for alignment ---- */
.sentence-list--dialogue {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Dialogue Reader — Chat Bubble Layout
   ========================================================================== */

/* ---- Dialogue header ---- */
.dialogue-header {
  text-align: center;
  max-width: var(--max-width-reader);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md) var(--space-lg);
}

.dialogue-header__phase {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.dialogue-header__phase::before,
.dialogue-header__phase::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--phase-color, var(--color-border));
  opacity: 0.4;
}

.dialogue-header__phase-label {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  display: flex;
  gap: var(--space-sm);
}

.dialogue-header__phase-es {
  color: var(--phase-color, var(--color-text-secondary));
}

.dialogue-header__phase-en {
  color: var(--color-text-light);
  font-weight: 400;
}

.dialogue-header__title {
  font-family: var(--font-heading);
  font-size: 32px;
  color: var(--color-text);
  margin: 0 0 var(--space-xs);
  line-height: 1.2;
}

.dialogue-header__subtitle {
  font-family: var(--font-reading);
  font-style: italic;
  font-size: 17px;
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-lg);
}

.dialogue-header__speakers {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}

.dialogue-header__speaker {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.dialogue-header__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  color: white;
  background: var(--phase-color, var(--color-text-secondary));
  flex-shrink: 0;
}

.dialogue-header__speaker-name {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

.dialogue-header__amp {
  font-family: var(--font-reading);
  font-style: italic;
  font-size: 16px;
  color: var(--color-text-light);
}

.dialogue-header__meta {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--color-text-light);
  display: flex;
  justify-content: center;
  gap: var(--space-md);
}

/* ---- Chat row (wraps avatar + bubble) ---- */
.chat-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 4px;
}

.chat-row--a {
  flex-direction: row;
}

.chat-row--b {
  flex-direction: row-reverse;
}

.chat-row--first {
  margin-top: var(--space-lg);
}

.chat-row--first:first-child {
  margin-top: 0;
}

/* ---- Chat avatar (inline, small) ---- */
.chat-row__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: white;
  background: var(--phase-color, var(--color-text-secondary));
  flex-shrink: 0;
  margin-top: 4px;
}

.chat-row__avatar--spacer {
  visibility: hidden;
}

/* ---- Chat bubble ---- */
.chat-row__bubble {
  max-width: 85%;
  border-radius: 16px;
  padding: var(--space-sm) var(--space-md);
  position: relative;
}

/* Speaker A: phase-colored background, tail bottom-left */
.chat-row--a .chat-row__bubble {
  background: var(--phase-bg, var(--color-border-light));
  border-bottom-left-radius: 4px;
}

/* Speaker B: neutral light background, tail bottom-right */
.chat-row--b .chat-row__bubble {
  background: var(--color-border-light);
  border-bottom-right-radius: 4px;
}

/* ---- Speaker name label above first bubble in a run ---- */
.chat-row__name {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
  padding: 0 2px;
}

.chat-row--b .chat-row__name {
  text-align: right;
}

/* ---- Overrides inside bubbles ---- */
.chat-row__bubble .sentence-block {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}

.chat-row__bubble .sentence__es-row {
  gap: var(--space-sm);
}

.chat-row__bubble .sentence__speak {
  opacity: 0.5;
  flex-shrink: 0;
}

.chat-row__bubble .sentence__speak:hover {
  opacity: 1;
}

.chat-row__bubble .sentence__en {
  font-size: calc(var(--english-size) - 1px);
  opacity: 0.7;
  margin-top: 2px;
}

/* ---- Mobile: chat layout ---- */
@media (max-width: 480px) {
  .chat-row__bubble {
    max-width: 92%;
    padding: var(--space-xs) var(--space-sm);
  }

  .chat-row__avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .dialogue-header__title {
    font-size: 26px;
  }

  .dialogue-header__speakers {
    gap: var(--space-md);
  }

  .dialogue-header__avatar {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .dialogue-header__speaker-name {
    font-size: 13px;
  }
}

/* ==========================================================================
   Situaciones Browse — Travel Phrasebook List Layout
   ========================================================================== */

/* ---- Compact page header ---- */
.sit-header {
  text-align: center;
  padding: var(--space-2xl) 0 var(--space-lg);
}

.sit-header__title {
  font-family: var(--font-heading);
  font-size: 32px;
  color: var(--color-text);
  margin: 0 0 var(--space-xs);
}

.sit-header__subtitle {
  font-family: var(--font-reading);
  font-style: italic;
  font-size: 17px;
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-xs);
}

.sit-header__count {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--color-text-light);
  margin: 0;
}

/* ---- Phase divider ---- */
.sit-phase {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-xl) 0 var(--space-md);
}

.sit-phase::before,
.sit-phase::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--phase-color, var(--color-border));
  opacity: 0.4;
}

.sit-phase__label {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--phase-color, var(--color-text-secondary));
  white-space: nowrap;
  display: flex;
  gap: var(--space-sm);
}

.sit-phase__label-es {
  color: var(--phase-color, var(--color-text-secondary));
}

.sit-phase__label-en {
  color: var(--color-text-light);
  font-weight: 400;
}

/* ---- List row ---- */
.sit-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-md);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: background var(--transition-fast);
  cursor: pointer;
}

.sit-row:hover {
  background: var(--phase-bg, var(--color-border-light));
}

/* ---- Overlapping speaker avatars ---- */
.sit-row__speakers {
  display: flex;
  flex-direction: row;
}

.sit-row__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  color: white;
  background: var(--phase-color, var(--color-text-secondary));
  border: 2px solid var(--color-surface);
  flex-shrink: 0;
}

.sit-row__avatar:nth-child(2) {
  margin-left: -12px;
  opacity: 0.85;
}

/* ---- Row content ---- */
.sit-row__content {
  min-width: 0;
}

.sit-row__title {
  font-family: var(--font-reading);
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.sit-row__title-en {
  color: var(--color-text-secondary);
  font-weight: 400;
}

.sit-row__speakers-text {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--color-text-light);
  margin-top: 2px;
}

/* ---- Right-aligned meta ---- */
.sit-row__meta {
  text-align: right;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--color-text-light);
  white-space: nowrap;
  flex-shrink: 0;
}

.sit-row__meta-words {
  font-weight: 500;
  color: var(--color-text-secondary);
}

.sit-row__meta-time {
  font-size: 12px;
}

/* ---- Progress bar (full-width at row bottom) ---- */
.sit-row__progress {
  position: absolute;
  bottom: 0;
  left: var(--space-md);
  right: var(--space-md);
  height: 2px;
  background: var(--color-border-light);
  border-radius: 1px;
  overflow: hidden;
}

.sit-row__progress-fill {
  height: 100%;
  background: var(--phase-color, var(--color-accent));
  border-radius: 1px;
  transition: width var(--transition-normal);
}

/* ---- Read state ---- */
.sit-row--read .sit-row__title {
  color: var(--color-text-light);
}

.sit-row--read .sit-row__speakers-text {
  color: var(--color-border);
}

.sit-row__read-mark {
  font-size: 12px;
  color: var(--phase-color, var(--color-a1));
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ---- Mobile: stack meta below content ---- */
@media (max-width: 480px) {
  .sit-row {
    grid-template-columns: auto 1fr;
    gap: var(--space-sm);
  }

  .sit-row__meta {
    grid-column: 1 / -1;
    text-align: left;
    display: flex;
    gap: var(--space-sm);
    padding-left: calc(32px + 32px - 10px + var(--space-sm));
  }

  .sit-row__avatar {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .sit-row__avatar:nth-child(2) {
    margin-left: -10px;
  }

  .sit-row__title {
    font-size: 15px;
  }

  .sit-header__title {
    font-size: 26px;
  }
}
