/* =========================================================
   PHRASEBOOK — every French phrase, past and present.
   Opened from the book button in the home admin bar (right of Updates).
   The button itself reuses .mn-updates-btn so the pair match; only the
   modal is styled here.
   ========================================================= */

/* Same trap as #mnUpdatesModal: several elements below carry an author
   `display`, which beats the UA `[hidden]{display:none}`. The id selector wins
   on specificity, so JS toggling stays reliable. */
#mnPhrasebookModal [hidden] { display: none; }

#mnPhrasebookModal .mn-modal-panel {
  width: min(640px, calc(100vw - 1.2rem));
  max-height: calc(100vh - 6.5rem);
  display: flex;
  flex-direction: column;
}

/* ===== Filter ===== */
.mn-pb-filter-row {
  flex: 0 0 auto;
  padding-bottom: 0.75rem;
}

.mn-pb-filter {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-control);
  border: 1px solid var(--panel-border);
  background: color-mix(in srgb, var(--panel-bg) 60%, transparent);
  color: inherit;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.mn-pb-filter:focus {
  outline: 2px solid color-mix(in srgb, var(--color-accent-soft) 60%, transparent);
  outline-offset: 1px;
}

/* ===== List ===== */
.mn-pb-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mn-pb-empty {
  padding: 2rem 0.5rem;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.6;
}

.mn-pb-row {
  position: relative;   /* anchors the row menu */
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: color-mix(in srgb, var(--panel-bg) 45%, transparent);
}

/* Today's phrase gets a quiet accent rather than a loud one — it is the
   default reading position, not an alert. */
.mn-pb-row.is-current {
  border-color: color-mix(in srgb, currentColor 28%, transparent);
  background: color-mix(in srgb, currentColor 7%, transparent);
}

.mn-pb-icon {
  flex: 0 0 auto;
  width: 1.6rem;
  display: grid;
  place-items: center;
  margin-top: 0.1rem;
  font-size: 1rem;
  opacity: 0.7;
}

/* Reserve the column even with no icon, so the text of every row lines up. */
.mn-pb-icon-empty { visibility: hidden; }

.mn-pb-text {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 0.1rem;
}

/* Wraps rather than truncating: unlike the settings queue, this is for reading,
   and a phrase cut mid-sentence would defeat the point of the list. */
.mn-pb-fr {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
}

.mn-pb-phon {
  font-size: 0.78rem;
  line-height: 1.35;
  opacity: 0.6;
}

.mn-pb-en {
  font-size: 0.85rem;
  line-height: 1.35;
  opacity: 0.85;
}

.mn-pb-meta {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  padding-top: 0.1rem;
}

.mn-pb-badge {
  font-family: var(--font-header);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  opacity: 0.75;
  white-space: nowrap;
}

.mn-pb-date {
  font-size: 0.7rem;
  opacity: 0.5;
  white-space: nowrap;
}

/* ===== Admin row menu ===== */
.mn-pb-actions {
  flex: 0 0 auto;
  position: relative;
}

.mn-pb-kebab {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 0.85rem;
  opacity: 0.6;
}

.mn-pb-kebab:hover,
.mn-pb-kebab:focus-visible {
  opacity: 1;
  outline: none;
}

.mn-pb-menu {
  position: absolute;
  top: 2rem;
  right: 0;
  z-index: 5;
  min-width: 150px;
  padding: 0.25rem;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.mn-pb-menu.hidden { display: none; }

.mn-pb-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-family: var(--font-body);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.mn-pb-menu-item:hover {
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.mn-pb-menu-danger { color: #e0524a; }

.mn-pb-menu-danger:hover {
  background: color-mix(in srgb, #e0524a 15%, transparent);
}

@media (max-width: 480px) {
  .mn-pb-row {
    flex-wrap: wrap;
  }
  /* Date/badge drop under the text rather than squeezing it on a narrow phone. */
  .mn-pb-meta {
    flex-direction: row;
    align-items: center;
    width: 100%;
    justify-content: flex-start;
    padding-left: 2.35rem;
  }
}
