/* ============================================================
   Virtues — Kindle-Style Text Highlight Overlay
   Selectable text positioned over card images
   Natural flowing layout that covers the card text areas
   ============================================================ */

/* === TEXT OVERLAY (full card coverage) === */
.text-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: var(--radius-xl, 16px);
  overflow: hidden;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
  color: transparent;
  -webkit-overflow-scrolling: touch;
  /* All blocks are position: absolute within this overlay */
}

/* Text blocks — natural flow within flex container */
.text-overlay-block {
  flex-shrink: 0;
  box-sizing: border-box;
}

/* === FRONT CARD TEXT === */
.text-overlay-title {
  position: absolute;
  left: 0; right: 0;
  /* top is set inline per-card from frontLayout */
  text-align: left;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
  padding: 0 5%;
}

.text-overlay-desc {
  position: absolute;
  left: 0; right: 0;
  /* top is set inline per-card from frontLayout */
  bottom: 8%;
  text-align: left;
  font-size: 7.5px;
  line-height: 1.82;
  padding: 0 4.5% 0 5%;
  word-spacing: 0.02em;
  overflow: hidden;
}

/* === BACK CARD TEXT === */
.text-overlay-quote {
  position: absolute;
  left: 0; right: 0;
  top: 7%;
  font-size: 7.8px;
  font-style: italic;
  text-align: center;
  padding: 0 6%;
  line-height: 1.55;
}

.text-overlay-author {
  position: absolute;
  left: 0; right: 0;
  top: 25%;
  font-size: 6.5px;
  text-align: center;
  padding: 0 6%;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

.text-overlay-practice-title {
  position: absolute;
  left: 0; right: 0;
  top: 39%;
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  padding: 0 6%;
}

.text-overlay-practice {
  position: absolute;
  left: 0; right: 0;
  font-size: 7px;
  line-height: 1.35;
  text-align: left;
  padding: 0 5.5%;
}

.text-overlay-affirmation {
  position: absolute;
  left: 0; right: 0;
  top: 84%;
  font-size: 7.5px;
  font-style: italic;
  text-align: center;
  padding: 0 5.5%;
  line-height: 1.45;
}

/* === WORD SPANS === */
.text-overlay-word {
  color: transparent;
  transition: background-color 0.1s ease;
  border-radius: 2px;
  padding: 1px 0;
  cursor: text;
}

/* Debug mode */
.text-overlay.debug-visible .text-overlay-word {
  color: rgba(255, 0, 0, 0.7) !important;
}
.text-overlay.debug-visible .text-overlay-block {
  outline: 1px dashed rgba(255, 0, 0, 0.3);
}

/* Text selection styling */
.text-overlay-word::selection {
  background: rgba(123, 63, 141, 0.35);
  color: transparent;
}

.text-overlay-word::-moz-selection {
  background: rgba(123, 63, 141, 0.35);
  color: transparent;
}

/* Highlighted words */
.text-overlay-word.highlighted {
  cursor: pointer;
  border-radius: 2px;
}

/* === HIGHLIGHT TOOLBAR === */
.hl-toolbar {
  position: absolute;
  z-index: 30;
  animation: hl-toolbar-pop 0.15s ease;
}

@keyframes hl-toolbar-pop {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hl-toolbar-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--color-navy, #1a2a40);
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.06);
}

.hl-toolbar-color {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hl-toolbar-color:hover {
  transform: scale(1.18);
  border-color: rgba(255,255,255,0.5);
}

.hl-toolbar-color.selected {
  border-color: #fff;
  transform: scale(1.1);
}

.hl-toolbar-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.15);
  margin: 0 2px;
}

.hl-toolbar-note-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.hl-toolbar-note-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.hl-toolbar-expanded {
  width: 240px;
}

.hl-note-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px;
}

.hl-note-colors {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.hl-note-textarea {
  width: 100%;
  font-size: 12px;
  font-family: var(--font-body, sans-serif);
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 6px 8px;
  resize: none;
  color: #fff;
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.hl-note-textarea::placeholder { color: rgba(255,255,255,0.4); }
.hl-note-textarea:focus { border-color: var(--color-golden, #ef9f53); }

.hl-note-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hl-note-cancel {
  font-size: 11px;
  font-family: var(--font-body, sans-serif);
  color: rgba(255,255,255,0.5);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.hl-note-cancel:hover { color: rgba(255,255,255,0.8); }

.hl-note-save {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-body, sans-serif);
  color: #fff;
  background: var(--color-golden, #ef9f53);
  border: none;
  border-radius: 8px;
  padding: 4px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.hl-note-save:hover { background: var(--color-antique, #c4975a); }

/* === HIGHLIGHT POPOVER === */
.hl-popover {
  position: absolute;
  z-index: 30;
  width: 220px;
  animation: hl-pop 0.15s ease;
}

@keyframes hl-pop {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.hl-popover-inner {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}

.hl-popover-text {
  font-size: 12px;
  color: var(--color-navy, #1a2a40);
  font-style: italic;
  margin-bottom: 8px;
  line-height: 1.4;
  opacity: 0.7;
}

.hl-popover-note {
  font-size: 12px;
  color: var(--color-navy, #1a2a40);
  margin-bottom: 8px;
  line-height: 1.4;
  padding: 6px 8px;
  background: var(--color-surface, #faf7f3);
  border-radius: 6px;
  cursor: pointer;
}

.hl-popover-note:hover { background: var(--color-surface-offset, #f0eaf5); }

.hl-popover-edit {
  width: 100%;
  font-size: 13px;
  font-family: var(--font-body, sans-serif);
  border: 1px solid var(--color-sand, #eee8e0);
  border-radius: 8px;
  padding: 8px 10px;
  resize: none;
  color: var(--color-navy, #1a2a40);
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.hl-popover-edit:focus { border-color: var(--color-accent, #7b3f8d); }

.hl-popover-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.hl-popover-delete {
  font-size: 11px;
  font-family: var(--font-body, sans-serif);
  color: #c0392b;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.hl-popover-delete:hover { background: rgba(192, 57, 43, 0.08); }

.hl-popover-save {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body, sans-serif);
  color: #fff;
  background: var(--color-accent, #7b3f8d);
  border: none;
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.hl-popover-save:hover { background: var(--color-magenta, #b31e8c); }

/* === HIGHLIGHTS SUMMARY (Journey page) === */
.highlights-summary { margin-top: var(--space-8, 2rem); }

.highlights-summary-count {
  font-size: var(--text-sm, 0.875rem);
  color: var(--color-text-muted, #888);
  margin-top: var(--space-1, 0.25rem);
  margin-bottom: var(--space-4, 1rem);
}

.highlights-summary-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 0.5rem);
}

.highlights-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  background: var(--color-surface, #faf7f3);
  border: 1px solid var(--color-border, #e8e2db);
  border-radius: var(--radius-lg, 12px);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.highlights-summary-item:hover {
  background: var(--color-surface-offset, #f0eaf5);
  border-color: var(--color-accent, #7b3f8d);
  transform: translateY(-1px);
}

.highlights-summary-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.highlights-summary-item-name {
  font-family: var(--font-display, serif);
  font-size: var(--text-base, 1rem);
  font-weight: 500;
  color: var(--color-text, #333);
  text-transform: capitalize;
}

.highlights-summary-item-dots { display: flex; gap: 4px; }

.hl-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.highlights-summary-item-meta {
  font-size: var(--text-xs, 0.75rem);
  color: var(--color-text-muted, #888);
}

/* === DETAIL CARD POSITIONING === */
.detail-card-img-wrap { position: relative; }

/* === RESPONSIVE === */
@media (max-width: 600px) {
  .hl-toolbar-inner { padding: 5px 8px; gap: 5px; }
  .hl-toolbar-color { width: 24px; height: 24px; min-width: 24px; }
  .hl-toolbar-note-btn { width: 24px; height: 24px; }
  .hl-popover { width: 200px; }
  .hl-toolbar-expanded { width: 210px; }

  .text-overlay-title { font-size: 16px; }
  .text-overlay-desc { font-size: 5.8px; line-height: 1.8; }
  .text-overlay-quote { font-size: 6.2px; }
  .text-overlay-affirmation { font-size: 6px; }
  .text-overlay-author { font-size: 5.2px; }
  .text-overlay-practice-title { font-size: 7px; }
  .text-overlay-practice { font-size: 5.5px; }
}

@media (max-width: 480px) {
  .text-overlay-title { font-size: 12px; }
  .text-overlay-desc { font-size: 4.6px; line-height: 1.75; }
  .text-overlay-quote { font-size: 5px; }
  .text-overlay-affirmation { font-size: 4.8px; }
  .text-overlay-author { font-size: 4.2px; }
  .text-overlay-practice-title { font-size: 5.5px; }
  .text-overlay-practice { font-size: 4.5px; }
}
