/* draft-blanks.css — «نامه روی کاغذ، نه فرم» (سشنِ پ). Pairs with draft-blanks.js.
   Base = the dark canvas (house convention); html[data-theme="light"] overrides below.
   One primary action at a time: «تکمیل n جای خالی» until nothing is left, then «ارسال». */

/* the unknowns, inside the letter itself */
body:is(.desktop-chat, .mobile-chat) .message.assistant .nb-blank {
  display: inline-block;
  min-height: 32px;
  min-width: 44px;
  margin: 2px 1px;
  padding: 0 9px;
  border: 1.5px dashed #e8b923;
  border-radius: 9px;
  background: rgba(255, 214, 92, 0.16);
  color: #ffd95e;
  font: inherit;
  font-weight: 700;
  font-size: 0.92em;
  line-height: 29px;
  vertical-align: baseline;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
body:is(.desktop-chat, .mobile-chat) .message.assistant .nb-blank.is-cur {
  border-style: solid;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35);
}
body:is(.desktop-chat, .mobile-chat) .message.assistant .nb-draft-foot { display: none !important; }

/* the one action row under the letter */
body:is(.desktop-chat, .mobile-chat) .message.assistant .nb-draft {
  margin-top: 10px;
}
body:is(.desktop-chat, .mobile-chat) .message.assistant .nb-draft-note {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.6;
  opacity: 0.72;
}
body:is(.desktop-chat, .mobile-chat) .nb-draft-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
body:is(.desktop-chat, .mobile-chat) .nb-draft-go,
body:is(.desktop-chat, .mobile-chat) .nb-draft-sec,
body:is(.desktop-chat, .mobile-chat) .nb-draft-icon {
  height: 46px;
  border-radius: 14px;
  font: inherit;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
body:is(.desktop-chat, .mobile-chat) .nb-draft-go {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: #0e9f6e;
  color: #fff;
  font-weight: 700;
  padding: 0 14px;
}
body:is(.desktop-chat, .mobile-chat) .nb-draft-sec {
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid rgba(148, 168, 200, 0.28);
  background: transparent;
  color: inherit;
}
body:is(.desktop-chat, .mobile-chat) .nb-draft-icon {
  flex: 0 0 46px;
  width: 46px;
  padding: 0;
  border: 1px solid rgba(148, 168, 200, 0.28);
  background: transparent;
  color: inherit;
}
body:is(.desktop-chat, .mobile-chat) .nb-draft-go svg,
body:is(.desktop-chat, .mobile-chat) .nb-draft-sec svg,
body:is(.desktop-chat, .mobile-chat) .nb-draft-icon svg { width: 19px; height: 19px; flex: none; }
body:is(.desktop-chat, .mobile-chat) .nb-draft-dots { display: inline-flex; gap: 4px; }
body:is(.desktop-chat, .mobile-chat) .nb-draft-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); }
body:is(.desktop-chat, .mobile-chat) .nb-draft-tones {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
body:is(.desktop-chat, .mobile-chat) .nb-draft-tones::-webkit-scrollbar { display: none; }
body:is(.desktop-chat, .mobile-chat) .nb-draft-tone {
  flex: none;
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid rgba(148, 168, 200, 0.28);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}
body:is(.desktop-chat, .mobile-chat) .nb-draft-go:focus-visible,
body:is(.desktop-chat, .mobile-chat) .nb-draft-sec:focus-visible,
body:is(.desktop-chat, .mobile-chat) .nb-draft-icon:focus-visible,
body:is(.desktop-chat, .mobile-chat) .nb-draft-tone:focus-visible,
body:is(.desktop-chat, .mobile-chat) .nb-blank:focus-visible { outline: 2px solid #10b981; outline-offset: 2px; }

/* the fill bar — glued above the keyboard; the composer steps aside while it is up */
.nb-fill {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 2147483000;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #182230;
  border-top: 1px solid rgba(148, 168, 200, 0.22);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.14);
  direction: rtl;
  color: #e8eef6;
  font-family: inherit;
}
.nb-fill[hidden] { display: none !important; }
body.desktop-chat .nb-fill {
  inset-inline: auto;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 32px));
  bottom: 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 168, 200, 0.22);
}
body.nb-filling .chat-input,
body.nb-filling #nabgolQuickStrip,
body.nb-filling .scroll-bottom-btn { visibility: hidden !important; }
.nb-fill-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 12.5px; opacity: 0.9; }
.nb-fill-head b { font-size: 13.5px; }
.nb-fill-close { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(148, 168, 200, 0.16); color: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.nb-fill-quick { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.nb-fill-quick[hidden] { display: none; }
.nb-fill-chip { flex: none; height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid rgba(148, 168, 200, 0.3); background: transparent; color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.nb-fill-row { display: flex; gap: 8px; align-items: center; }
.nb-fill-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  border: 2px solid #10b981;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font: inherit;
  font-size: 16px; /* ≥16px: iOS does not zoom the page on focus */
  outline: none;
}
.nb-fill-prev,
.nb-fill-next {
  flex: none;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  font: inherit;
  font-size: 14.5px;
  cursor: pointer;
}
.nb-fill-prev { border: 1px solid rgba(148, 168, 200, 0.3); background: transparent; color: inherit; }
.nb-fill-prev:disabled { opacity: 0.4; cursor: default; }
.nb-fill-next { border: 0; background: #0e9f6e; color: #fff; font-weight: 700; }

/* paper view — the exact PDF page. Phone: full sheet; desktop: side column. */
.nb-paper { position: fixed; inset: 0; z-index: 2147483001; direction: rtl; }
.nb-paper-scrim { position: absolute; inset: 0; background: rgba(8, 12, 20, 0.55); }
.nb-paper-sheet {
  position: absolute;
  inset: 12px 0 0 0;
  display: flex;
  flex-direction: column;
  background: #121a26;
  color: #e8eef6;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
}
body.desktop-chat .nb-paper-sheet { inset: 0 auto 0 0; width: min(560px, 46vw); border-radius: 0; }
body.nb-paper-open { overflow: hidden; }
.nb-paper-grab { width: 40px; height: 5px; border-radius: 3px; background: rgba(148, 168, 200, 0.4); margin: 8px auto 2px; }
body.desktop-chat .nb-paper-grab { display: none; }
.nb-paper-head { display: flex; align-items: center; gap: 10px; padding: 6px 14px 10px; }
.nb-paper-title { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nb-paper-state { flex: none; font-size: 12px; padding: 2px 10px; border-radius: 20px; background: rgba(255, 214, 92, 0.16); color: #ffd95e; }
.nb-paper-state.is-ok { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
.nb-paper-close { margin-inline-start: auto; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(148, 168, 200, 0.16); color: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.nb-paper-frame { flex: 1 1 auto; width: 100%; border: 0; background: #e8ece8; }
.nb-paper-bar { flex: none; display: flex; gap: 8px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(148, 168, 200, 0.18); }
.nb-paper-bar .nb-draft-go { flex: 2 1 auto; }
.nb-paper-bar .nb-draft-sec { flex: 1 1 auto; }

/* light theme */
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .message.assistant .nb-blank { background: #fff4c7; color: #6b4e00; }
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .nb-draft-sec,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .nb-draft-icon,
html[data-theme="light"] body:is(.desktop-chat, .mobile-chat) .nb-draft-tone { border-color: #e3e7ee; background: #fff; }
html[data-theme="light"] .nb-fill { background: #f1f3f6; color: #0f172a; border-top-color: #e3e7ee; box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.08); }
html[data-theme="light"] .nb-fill-input { background: #fff; }
html[data-theme="light"] .nb-fill-prev,
html[data-theme="light"] .nb-fill-chip { background: #fff; border-color: #e3e7ee; }
html[data-theme="light"] .nb-fill-close { background: #e3e7ee; }
html[data-theme="light"] .nb-paper-sheet { background: #fff; color: #0f172a; }
html[data-theme="light"] .nb-paper-state { background: #fff4c7; color: #6b4e00; }
html[data-theme="light"] .nb-paper-state.is-ok { background: #e8f6ee; color: #0b5d3e; }
html[data-theme="light"] .nb-paper-close { background: #f1f3f6; }
html[data-theme="light"] .nb-paper-bar { border-top-color: #e3e7ee; }

@media (prefers-reduced-motion: reduce) {
  .nb-blank, .nb-draft-go { transition: none !important; }
}
