/*
 * Temporary expert-review card and read-only final-profile dialog.
 * Load AFTER styles.css / themes.css / motion.css. Uses the identity tokens of the
 * existing Persian RTL design system; nothing here restyles the chat itself.
 */
.review-panel {
  width: min(87%, 720px);
  margin: 26px 0 6px;
  margin-inline-start: auto; /* aligns with assistant perfume cards in RTL */
  padding: 18px 20px 16px;
  border: 1px dashed var(--identity-border);
  border-radius: 16px;
  background: linear-gradient(160deg, #14201a, #0f1512 70%);
  color: var(--ink);
  box-shadow: 0 10px 30px #00000040;
  animation: message-in 240ms ease-out both;
}
.review-panel-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: start; }
.review-badge {
  grid-column: 1 / -1; justify-self: start;
  padding: 1px 9px; border-radius: 999px; font-size: .6875rem; line-height: 1.9;
  color: var(--identity-accent); background: var(--identity-glow); border: 1px solid var(--identity-border);
}
.review-panel-title { grid-column: 1; margin: 4px 0 0; font-size: 1rem; font-weight: 600; color: #f1f7f2; }
.review-panel-description { grid-column: 1; margin: 0; font-size: .8125rem; line-height: 2; color: var(--muted); }
.review-profile-button { grid-column: 2; grid-row: 2 / span 2; align-self: center; }
.review-secondary {
  min-height: 40px; padding: 7px 14px; border-radius: 10px; font-size: .75rem;
  border: 1px solid var(--identity-border); background: #ffffff06; color: var(--identity-accent);
  transition: background-color 180ms, border-color 180ms;
}
.review-secondary:hover:not(:disabled) { background: var(--identity-glow); border-color: var(--identity-accent); }
.review-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid #ffffff12; }
.review-ratings { margin: 0; padding: 0; border: 0; min-width: 0; }
.review-ratings legend { padding: 0; margin-bottom: 9px; font-size: .8125rem; color: #dbe8de; }
.review-rating-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.review-rating { position: relative; display: block; min-width: 0; }
.review-rating input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.review-rating input:disabled { cursor: default; }
.review-rating-pill {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 8px 10px;
  border: 1px solid #ffffff1f; border-radius: 12px; background: #ffffff05; color: #dce8df; font-size: .875rem;
  transition: background-color 180ms, border-color 180ms, box-shadow 180ms;
}
.review-rating-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rating-color); box-shadow: 0 0 0 3px #ffffff0a; }
.review-rating-good { --rating-color: #8fe0a4; }
.review-rating-average { --rating-color: #f0d38a; }
.review-rating-bad { --rating-color: #f3a39a; }
.review-rating input:hover:not(:disabled) + .review-rating-pill { border-color: var(--rating-color); }
.review-rating input:checked + .review-rating-pill {
  border-color: var(--rating-color); color: #ffffff; font-weight: 600;
  background: color-mix(in srgb, var(--rating-color) 18%, transparent);
  box-shadow: 0 0 0 1px var(--rating-color) inset;
}
.review-rating input:checked + .review-rating-pill::after { content: "✓"; font-size: .8125rem; color: var(--rating-color); }
.review-rating input:focus-visible + .review-rating-pill { outline: 2px solid var(--identity-focus); outline-offset: 3px; }
.review-rating input:disabled + .review-rating-pill { opacity: .5; }
.review-note-label { display: block; margin: 16px 0 7px; font-size: .8125rem; color: #dbe8de; }
.review-note {
  display: block; width: 100%; min-height: 104px; max-height: 260px; resize: vertical; padding: 10px 12px;
  border: 1px solid #79b88c40; border-radius: 12px; background: #0b100d; color: var(--ink);
  font: inherit; font-size: .875rem; line-height: 1.9;
}
.review-note::placeholder { color: #8fa596; font-size: .8125rem; opacity: 1; }
.review-note:focus-visible { outline: none; border-color: var(--identity-accent); box-shadow: 0 0 0 3px var(--identity-glow); }
.review-note:disabled { opacity: .6; }
.review-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.review-count { margin-inline-end: auto; font-size: .6875rem; color: var(--quiet); }
.review-link { min-height: 40px; border: 0; background: none; color: var(--identity-accent); font-size: .75rem;
  text-decoration: underline; text-underline-offset: 5px; }
.review-submit {
  min-height: 42px; padding: 8px 20px; border-radius: 11px; font-size: .8125rem; font-weight: 500;
  border: 1px solid var(--identity-border); background: var(--identity-message-bg); color: #f3fbf4;
  transition: opacity 180ms, background-color 180ms;
}
.review-submit:hover:not(:disabled) { opacity: .88; }
.review-submit:disabled { opacity: .45; }
.review-status { margin: 8px 0 0; min-height: 1.6em; font-size: .75rem; line-height: 1.9; color: var(--muted); }
.review-status:empty { min-height: 0; margin: 0; }
.review-status-success { color: #a9e9b9; }
.review-status-success::before { content: "✓ "; }
.review-status-error { color: #ffc5b7; }
.review-status-info { color: #c9d6cc; }

/* Read-only final profile dialog: fixed header/footer, internal scrolling body. */
.review-profile-modal {
  box-sizing: border-box; position: fixed; inset: 0; margin: auto; padding: 0;
  width: min(820px, calc(100vw - 32px)); height: min(820px, calc(100dvh - 40px)); max-height: calc(100dvh - 40px);
  color: var(--ink); font-family: Vazirmatn, Tahoma, sans-serif; font-size: .8125rem; line-height: 1.85;
  border: 1px solid #83a98c55; border-radius: 22px; background: linear-gradient(150deg, #142219, #0b100d 55%);
  box-shadow: 0 30px 110px #000a; overflow: hidden;
}
.review-profile-modal:not([open]) { display: none; }
.review-profile-modal[open] { display: flex; flex-direction: column; }
.review-profile-modal::backdrop { background: #050807d0; backdrop-filter: blur(6px); }
.review-profile-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex: 0 0 auto;
  padding: 16px 22px 12px; border-bottom: 1px solid #ffffff14; background: #070c09f2;
}
.review-profile-titles h2 { margin: 0; font-size: 1rem; font-weight: 600; color: #eef8f0; }
.review-profile-titles p { margin: 2px 0 0; font-size: .6875rem; color: var(--quiet); }
.review-profile-close {
  flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; padding: 0;
  border-radius: 50%; border: 1px solid #ffffff26; background: #ffffff0d; color: #f1f7f2; font: 24px/1 Arial, sans-serif;
}
.review-profile-close:hover { background: #ffffff1f; }
.review-profile-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  padding: 6px 22px 18px; scrollbar-width: thin; scrollbar-color: #4e765a #0b100d; }
.review-profile-scroll:focus-visible { outline: 2px solid var(--identity-focus); outline-offset: -4px; }
.review-profile-footer { display: flex; justify-content: flex-end; flex: 0 0 auto; padding: 12px 22px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid #ffffff14; background: #070c09f2; }
.review-profile-state { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  text-align: center; color: var(--muted); }
.review-profile-state-error { color: #ffc5b7; }
.review-profile-section { padding: 14px 0; border-bottom: 1px solid #ffffff10; }
.review-profile-section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.review-profile-section-header h3 { margin: 0; font-size: .875rem; font-weight: 600; color: var(--identity-accent); }
.review-code { font: .75rem/1.6 Consolas, "SFMono-Regular", Menlo, monospace; color: #b7cbbd; overflow-wrap: anywhere; }
.review-profile-section-header > .review-code { color: var(--quiet); font-size: .6875rem; }
.review-fields, .review-polarity, .review-weights { display: grid; gap: 8px; margin: 0; }
.review-field, .review-polarity-row, .review-weight {
  display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); gap: 10px; align-items: start;
}
.review-field dt, .review-polarity-row dt, .review-weight dt { color: #cfdcd2; font-size: .75rem; }
.review-field dt .review-code, .review-polarity-row dt .review-code, .review-weight dt .review-code { font-size: .625rem; color: var(--quiet); }
.review-field dd, .review-polarity-row dd, .review-weight dd { margin: 0; min-width: 0; }
.review-field dd .review-polarity { padding: 8px 10px; border-radius: 10px; background: #ffffff05; }
.review-polarity-row { padding-inline-start: 10px; border-inline-start: 2px solid var(--row-color); }
.review-preferred { --row-color: #8fe0a4; }
.review-avoided { --row-color: #f3a39a; }
.review-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.review-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 10px; border-radius: 999px;
  border: 1px solid #ffffff1f; background: #ffffff08; }
.review-gloss { font-size: .75rem; color: #eef8f0; }
.review-muted { color: var(--quiet); font-size: .75rem; }
.review-null { color: #f0d38a; font-size: .75rem; }
.review-weight dd { display: flex; align-items: center; gap: 10px; }
.review-weight dd > .review-code { min-width: 4.5em; color: #eef8f0; font-size: .8125rem; }
.review-weight-track { flex: 1; height: 7px; border-radius: 99px; background: #ffffff12; overflow: hidden; direction: ltr; }
.review-weight-fill { display: block; height: 100%; border-radius: inherit; background: var(--identity-accent); opacity: .75; }
.review-unmapped { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.review-unmapped li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: 10px; background: #ffffff05; }
.review-unmapped-text { overflow-wrap: anywhere; }
.review-unmapped-polarity { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; border-radius: 999px;
  border: 1px solid var(--row-color); }
.review-raw { margin-top: 14px; border-top: 1px solid #ffffff10; padding-top: 12px; }
.review-raw summary { cursor: pointer; color: var(--identity-accent); font-size: .8125rem; width: fit-content; border-radius: 4px; }
.review-raw summary:focus-visible { outline: 2px solid var(--identity-focus); outline-offset: 3px; }
.review-json { direction: ltr; text-align: left; margin: 10px 0 0; max-width: 100%; max-height: 360px; overflow: auto; padding: 12px;
  border-radius: 10px; background: #050806; border: 1px solid #ffffff10; font: .75rem/1.6 Consolas, "SFMono-Regular", Menlo, monospace;
  white-space: pre; color: #cfe3d4; }
.review-json:focus-visible { outline: 2px solid var(--identity-focus); outline-offset: 2px; }

@media (max-width: 767px) {
  .review-panel-header { grid-template-columns: minmax(0, 1fr); }
  .review-profile-button { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 6px; }
}
@media (max-width: 540px) {
  .review-panel { width: 94%; padding: 14px 14px 12px; border-radius: 14px; }
  .review-rating-options { gap: 6px; }
  .review-rating-pill { min-height: 44px; padding: 6px; font-size: .8125rem; gap: 6px; }
  .review-actions { flex-wrap: wrap; }
  .review-submit { flex: 1 1 auto; }
  .review-profile-modal { width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); border-radius: 16px; }
  .review-profile-header { padding: 12px 14px 10px; }
  .review-profile-scroll { padding: 4px 14px 14px; }
  .review-profile-footer { padding-inline: 14px; }
  .review-field, .review-polarity-row, .review-weight { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .review-panel { animation: none; }
  .review-panel *, .review-profile-modal * { transition: none !important; }
}
