/* Word-profile card + modal dialog. The card partial lives at
   app/views/child_words/_card.html.erb and is rendered both on the full
   standalone page (/children/:id/word/:word_id) and injected into the
   modal dialog on the session review. The link treatment and dialog
   chrome are used by any parent/teacher viewing a session — not gated
   behind admin. */

/* ---- Clickable word in the session-review table ---- */
.word-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  cursor: pointer;
}
.word-link:hover {
  color: #1565C0;
  border-bottom-color: currentColor;
}

/* ---- Modal dialog chrome (shared, lazy-loaded content) ---- */
.word-profile-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(820px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: none;
  padding: 0;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 40px 80px -20px rgba(0, 0, 0, 0.55),
    0 20px 40px -20px rgba(0, 0, 0, 0.35);
  color: #0F172A;
}
.word-profile-dialog::backdrop {
  background: rgba(8, 47, 106, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.word-profile-dialog[open] { animation: word-profile-in 0.18s ease-out; }
@keyframes word-profile-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.word-profile-dialog-card {
  position: relative;
  padding: 24px 24px 20px;
  max-height: inherit;
  overflow-y: auto;
}
.word-profile-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #F1F5F9;
  color: #475569;
  border-radius: 999px;
  cursor: pointer;
  z-index: 2;
}
.word-profile-close:hover { background: #E2E8F0; color: #0F172A; }
.word-profile-loading, .word-profile-error {
  padding: 40px 20px;
  text-align: center;
  color: #64748B;
  font-size: 14px;
}
.word-profile-error { color: #B91C1C; }

/* ---- The actual profile card content ---- */
#word-profile-card { font-family: var(--font-sans); }

.word-profile-header {
  background: linear-gradient(135deg, #F8FAFC 0%, #EFF6FF 100%);
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 20px;
}
.word-profile-eyebrow {
  font-size: 11px;
  font-weight: 800;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.word-profile-word {
  font-size: 32px;
  font-weight: 900;
  color: #0F172A;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}
.word-profile-diff-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #EFF6FF;
  color: #1E40AF;
  box-shadow: inset 0 0 0 1px #BFDBFE;
}

.word-profile-stat {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
}
.word-profile-stat-label {
  font-size: 10px;
  font-weight: 800;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.word-profile-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #0F172A;
  line-height: 1;
}
.word-profile-stat-sub {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 2px;
}

.word-profile-section {
  padding: 18px 0 4px;
}
.word-profile-section-title {
  font-size: 14px;
  font-weight: 800;
  color: #0F172A;
  margin: 0 0 12px;
  letter-spacing: -0.005em;
}

.word-profile-sm2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 20px;
}
@media (max-width: 640px) {
  .word-profile-sm2 { grid-template-columns: 1fr; }
}
.word-profile-sm2 > div {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 10px 12px;
}
.word-profile-sm2 dt {
  font-size: 10px;
  font-weight: 800;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.word-profile-sm2 dd {
  font-size: 18px;
  font-weight: 800;
  color: #0F172A;
  margin: 0;
  line-height: 1.1;
}
.word-profile-sm2-sub {
  margin-top: 2px;
  font-size: 11px;
  color: #94A3B8;
}

.word-profile-fasttrack-note {
  margin: 0 0 14px;
  padding: 10px 14px;
  background: #EFF6FF;
  border-left: 3px solid #3B82F6;
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  color: #1E3A8A;
  line-height: 1.5;
}
.word-profile-fasttrack-note em { font-style: italic; }

.word-profile-history {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.word-profile-history thead th {
  text-align: left;
  font-size: 10px;
  font-weight: 800;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  border-bottom: 1px solid #E2E8F0;
}
.word-profile-history tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid #F1F5F9;
  color: #0F172A;
}
.word-profile-history tbody tr[data-correct="false"][data-gave-up="false"] { background: #FEF2F2; }
.word-profile-history tbody tr[data-gave-up="true"] { background: #F8FAFC; }
.word-profile-history tbody tr:hover { background: #F1F5F9; }
