/* Zhougong Dream Dictionary — RT-CHN-101
   Widget styling. The card/section/ad shell comes from the platform tool
   layout; this file scopes the dm-* search + result + browse components.
   INDIGO / night theme (accent #4338CA). Loaded automatically by
   show.blade.php when present. */

.dm-wrap { display: flex; flex-direction: column; gap: 14px; }

.dm-disclaimer {
  padding: 10px 14px; background: #EEF2FF; border-left: 3px solid #4338CA;
  border-radius: 0 6px 6px 0; font-size: 12.5px; color: var(--rt-accent); line-height: 1.5;
}
.dm-note {
  padding: 10px 14px; background: #F5F3FF; border-left: 3px solid #818cf8;
  border-radius: 0 6px 6px 0; font-size: 12.5px; color: var(--rt-ink-muted); line-height: 1.5;
}

/* Search row */
.dm-search-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.dm-search {
  flex: 1; min-width: 180px; padding: 11px 14px; border: 1px solid var(--rt-hairline);
  border-radius: 8px; font-size: 15px; background: #fff;
}
.dm-search:focus { outline: none; border-color: #4338CA; box-shadow: 0 0 0 3px rgba(67,56,202,.12); }
.dm-btn {
  padding: 10px 16px; font-size: 12.5px; border-radius: 8px; cursor: pointer;
  font-family: var(--rt-font-mono); text-transform: uppercase; letter-spacing: .04em;
  font-weight: 600; white-space: nowrap;
}
.dm-btn-clear { background: #fff; color: #4338CA; border: 1px solid rgba(67,56,202,.4); }
.dm-btn-clear:hover { background: #EEF2FF; }

/* Results header + count */
.dm-results-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-top: 4px;
}
.dm-results-title {
  font-family: var(--rt-font-mono); font-size: 11.5px; color: var(--rt-ink-muted);
  text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
}
.dm-count { font-family: var(--rt-font-mono); font-size: 11.5px; color: #4338CA; font-weight: 700; }

/* Result cards */
.dm-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .dm-list { grid-template-columns: 1fr; } }
/* The whole card is a <button> so it is focusable + clickable to open the
   detail popup. Reset native button chrome, keep our card look. */
.dm-card {
  appearance: none; -webkit-appearance: none; text-align: left; width: 100%;
  font: inherit; cursor: pointer;
  padding: 13px 15px; background: #fff; border: 1px solid var(--rt-hairline);
  border-left: 3px solid #4338CA; border-radius: 8px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .12s, box-shadow .12s, transform .08s;
}
.dm-card:hover { border-color: rgba(67,56,202,.55); box-shadow: 0 2px 8px rgba(67,56,202,.1); }
.dm-card:focus-visible { outline: none; border-color: #4338CA; box-shadow: 0 0 0 3px rgba(67,56,202,.18); }
.dm-card:active { transform: translateY(1px); }

.dm-card-keyword { font-family: var(--rt-font-sans); display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.dm-card-kw-zh { font-size: 18px; font-weight: 700; color: var(--rt-ink); }
.dm-card-kw-en { font-size: 12.5px; font-weight: 600; color: #4338CA; }

.dm-card-interp { font-size: 14px; color: var(--rt-ink); line-height: 1.5; display: flex; flex-direction: column; gap: 1px; }
.dm-card-interp-zh::before { content: "→ "; color: #4338CA; font-weight: 700; }
.dm-card-interp-en { font-size: 12.5px; color: var(--rt-ink-muted); font-style: italic; }

.dm-card-cat {
  align-self: flex-start; margin-top: 2px; padding: 3px 9px; border-radius: 999px;
  background: #E0E7FF; color: #3730A3; font-size: 11px; font-weight: 600;
  border: 1px solid rgba(67,56,202,.24);
}
.dm-card-cat-en { font-weight: 500; }
.dm-card-hint {
  align-self: flex-start; font-family: var(--rt-font-mono); font-size: 10.5px;
  color: #818cf8; text-transform: uppercase; letter-spacing: .04em; opacity: 0;
  transition: opacity .12s;
}
.dm-card:hover .dm-card-hint, .dm-card:focus-visible .dm-card-hint { opacity: 1; }
@media (hover: none) { .dm-card-hint { opacity: .7; } }

.dm-empty { padding: 24px 16px; text-align: center; color: var(--rt-ink-muted); font-style: italic; }
.dm-fail { padding: 16px; text-align: center; color: var(--rt-accent); font-style: italic; }

/* Browse by category */
.dm-browse { margin-top: 6px; padding-top: 14px; border-top: 1px dashed rgba(67,56,202,.18); }
.dm-browse-title {
  font-family: var(--rt-font-mono); font-size: 11.5px; color: var(--rt-ink-muted);
  text-transform: uppercase; letter-spacing: .04em; font-weight: 700; margin-bottom: 10px;
}
.dm-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.dm-cat-chip {
  padding: 7px 12px; border-radius: 999px; cursor: pointer; font-size: 13px;
  background: #fff; color: #3730A3; border: 1px solid rgba(67,56,202,.3); line-height: 1.3;
}
.dm-cat-chip:hover { background: #EEF2FF; }
.dm-cat-chip.is-active { background: #4338CA; color: #fff; border-color: #3730A3; }
.dm-cat-chip .dm-cat-n { font-family: var(--rt-font-mono); font-size: 11px; opacity: .7; margin-left: 5px; }
.dm-cat-chip .dm-cat-en { font-weight: 500; opacity: .85; }

/* ----------------------------- Modal ------------------------------------ */
/* Click-to-detail popup. Hidden until JS adds .is-open. Backdrop click +
   Esc close are wired in app.js. */
.dm-modal {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(26, 24, 20, .55);
}
.dm-modal.is-open { display: flex; }
body.dm-modal-lock { overflow: hidden; }

.dm-modal-dialog {
  position: relative; width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--rt-hairline); border-top: 4px solid #4338CA;
  border-radius: 14px; padding: 22px 22px 20px; box-shadow: 0 16px 48px rgba(26,24,20,.28);
}
.dm-modal-dialog:focus-visible { outline: none; box-shadow: 0 16px 48px rgba(26,24,20,.28), 0 0 0 3px rgba(67,56,202,.25); }

.dm-modal-close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1; color: var(--rt-ink-muted);
  background: #fff; border: 1px solid var(--rt-hairline); border-radius: 8px; cursor: pointer;
}
.dm-modal-close:hover { background: #EEF2FF; color: #4338CA; border-color: rgba(67,56,202,.4); }
.dm-modal-close:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(67,56,202,.2); }

.dm-modal-title {
  margin: 0 36px 16px 0; display: flex; flex-direction: column; gap: 3px;
  font-family: var(--rt-font-sans); line-height: 1.25;
}
.dm-modal-kw-zh { font-size: 24px; font-weight: 700; color: var(--rt-ink); }
.dm-modal-kw-en { font-size: 14px; font-weight: 600; color: #4338CA; }

.dm-modal-row {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 0; border-top: 1px solid var(--rt-hairline);
}
.dm-modal-label {
  font-family: var(--rt-font-mono); font-size: 11px; color: var(--rt-ink-muted);
  text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
}
.dm-modal-val { display: flex; flex-direction: column; gap: 3px; }
.dm-modal-interp-zh, .dm-modal-cat-zh { font-size: 15.5px; color: var(--rt-ink); line-height: 1.5; }
.dm-modal-interp-en { font-size: 13px; color: var(--rt-ink-muted); font-style: italic; line-height: 1.5; }
.dm-modal-cat-en { font-size: 13px; color: var(--rt-ink-muted); }

.dm-modal-original {
  margin: 2px 0 0; padding: 10px 14px;
  background: #F5F3FF; border-left: 3px solid #4338CA; border-radius: 0 6px 6px 0;
  font-size: 15px; color: #3730A3; line-height: 1.6;
}
.dm-modal-original-note {
  margin-top: 5px; font-size: 11.5px; color: var(--rt-ink-muted); font-style: italic; line-height: 1.5;
}

/* Mobile: full-width bottom sheet feel. */
@media (max-width: 520px) {
  .dm-modal { padding: 0; align-items: flex-end; }
  .dm-modal-dialog {
    max-width: none; max-height: 92vh; border-radius: 16px 16px 0 0;
    border-left: none; border-right: none; border-bottom: none;
  }
}
