/* ==========================================================================
   Maya FAQ Chatbot demo — shared styles + the registration card
   Formal and quiet: solid colors, thin borders, no gradients. The palette is the one of
   mayanext.com/products/FAQ-Chatbot (deep, plum, cyan, mist). RTL, Vazirmatn (self-hosted, OFL).
   ========================================================================== */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --deep: #1a1328;
  --ink: #140e1f;
  --text: #4f4760;
  --muted: #6e6782;
  --plum: #665290;
  --plum-600: #56437e;
  --plum-700: #46366a;
  --mist: #f4f1f9;
  --cyan: #5ec8d8;
  --cyan-600: #4bb9ca;
  --cyan-ink: #0e6f79;
  --bg: #f6f5f8;
  --paper: #fbfafd;
  --surface: #ffffff;
  --line: #e6e1ef;
  --line-2: #d6cfe2;
  --on-deep: #ffffff;
  --on-deep-2: #cfc7dc;
  --on-deep-3: #a99cc4;

  --success: #067647;
  --success-50: #ecfdf3;
  --danger: #b42318;
  --danger-50: #fef3f2;
  --warn: #93540a;
  --warn-50: #fffaeb;

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-card: 0 1px 2px rgba(26, 19, 40, .04), 0 8px 24px rgba(26, 19, 40, .06);
  --shadow-pop: 0 12px 32px rgba(26, 19, 40, .14);
  --focus: 0 0 0 3px rgba(102, 82, 144, .22);
  --font: "Vazirmatn", "Vazir", Tahoma, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.8; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--plum); }
img { max-width: 100%; }
h1, h2, h3 { text-wrap: balance; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ltr { direction: ltr; text-align: left; unicode-bidi: plaintext; }
.debug-ribbon {
  position: fixed; top: 14px; left: -46px; z-index: 80; transform: rotate(-45deg);
  background: #b54708; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 50px;
}

/* --- Buttons -------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--r);
  padding: 9px 18px; cursor: pointer; font-weight: 600; font-size: 15px; line-height: 1.6; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-sm { padding: 6px 14px; font-size: 14px; border-radius: var(--r-sm); }
.btn-lg { padding: 12px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--plum); color: #fff; }
.btn-primary:hover { background: var(--plum-600); }
.btn-primary[disabled] { opacity: .7; cursor: progress; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn-secondary:hover { background: var(--mist); }
.btn-cta { background: var(--cyan); color: var(--deep); }
.btn-cta:hover { background: var(--cyan-600); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

/* --- Site bar (matches the mayanext.com header) -------------------------------------- */
.sitebar { background: var(--deep); color: var(--on-deep); }
.sitebar-inner { max-width: 1200px; margin: 0 auto; height: 60px; padding: 0 24px; display: flex; align-items: center; gap: 14px; }
.sitebar-logo { display: flex; align-items: center; }
.sitebar-logo img { display: block; height: 22px; width: auto; }
.sitebar-sep { width: 1px; height: 20px; background: rgba(255, 255, 255, .2); }
.sitebar-product { font-size: 15px; font-weight: 600; color: #fff; white-space: nowrap; }
.sitebar-product small { font-size: 13px; font-weight: 400; color: var(--on-deep-3); margin-inline-start: 6px; }
.sitebar-back { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--on-deep-2); text-decoration: none; font-size: 14px; }
.sitebar-back:hover { color: #fff; }
.sitebar a:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(94, 200, 216, .45); border-radius: 6px; }

/* --- Registration page ------------------------------------------------------------------- */
.page { max-width: 600px; margin: 40px auto 0; padding: 0 16px 40px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card-head { padding: 28px 32px 22px; border-bottom: 1px solid var(--line); }
.card-kicker { margin: 0; font-size: 13px; font-weight: 600; color: var(--cyan-ink); }
.card-head h1 { margin: 2px 0 6px; font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.6; }
.card-head p { margin: 0; font-size: 14.5px; line-height: 1.95; color: var(--text); }
.card-body { padding: 22px 32px 6px; }
.card-foot { padding: 6px 32px 28px; }

.form-section { border: 0; padding: 0; margin: 0 0 6px; min-width: 0; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 4px; }
/* Floated so the legend sits inside the section, below its divider, instead of on the border line. */
.form-section legend { float: right; width: 100%; padding: 0; margin-bottom: 14px; font-size: 14.5px; font-weight: 700; color: var(--ink); }
.form-section legend + * { clear: both; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field label, .field .label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.field .req { color: var(--danger); margin-inline-start: 2px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; padding: 9px 13px; font-size: 15px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input, .select { height: 44px; }
.input::placeholder, .textarea::placeholder { color: #8d86a0; }
.input:hover, .select:hover, .textarea:hover { border-color: #c2b8d4; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--plum); box-shadow: var(--focus); }
.select {
  appearance: none; cursor: pointer; padding-left: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%234f4760' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 13px center;
}
.textarea { min-height: 150px; resize: vertical; line-height: 1.9; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.field.has-error .input:focus, .field.has-error .textarea:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .14); }
.error-text { color: var(--danger); font-size: 13px; }
.error-text:empty { display: none; }
.hint { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.hint-top { margin-top: 6px; }

/* Source tabs */
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
.segmented button {
  border: 0; background: #fff; padding: 9px 10px; cursor: pointer; font-weight: 500; color: var(--text); white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.segmented button + button { border-inline-start: 1px solid var(--line-2); }
.segmented button:hover { background: var(--paper); }
.segmented button:focus-visible { outline: none; box-shadow: inset var(--focus); }
.segmented button[aria-selected="true"] { background: var(--mist); color: var(--plum-700); font-weight: 700; box-shadow: inset 0 -2px 0 var(--plum); }
.source-panel { margin-top: 12px; }
.source-panel[hidden] { display: none; }

/* Link rows (built by landing.js) */
.link-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.link-input-wrap { position: relative; flex: 1; min-width: 0; }
.link-input-wrap .input { padding-left: 38px; }
.link-state { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; display: grid; place-items: center; }
.link-state .mini-spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--plum); animation: spin .8s linear infinite; }
.link-state.ok { color: var(--success); }
.link-state.bad { color: var(--danger); }
.link-state.warn { color: var(--warn); }
.link-msg { font-size: 12.5px; margin: -4px 2px 8px; }
.link-msg:empty { display: none; }
.link-msg.ok { color: var(--success); }
.link-msg.bad { color: var(--danger); }
.link-msg.warn { color: var(--warn); }
.icon-btn {
  width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--line-2); background: #fff; color: var(--muted); transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--danger-50); color: var(--danger); border-color: #fecdca; }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.add-link {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 2px; cursor: pointer;
  color: var(--plum); font-weight: 600; font-size: 14px; border-radius: 6px;
}
.add-link:hover { color: var(--plum-700); text-decoration: underline; text-underline-offset: 4px; }
.add-link:focus-visible { outline: none; box-shadow: var(--focus); }
.add-link[hidden] { display: none; }

.form-error { background: var(--danger-50); color: var(--danger); border: 1px solid #fecdca; border-radius: var(--r); padding: 10px 14px; font-size: 14px; margin-bottom: 18px; }
.form-error[hidden] { display: none; }
.consent { font-size: 12.5px; line-height: 1.9; color: var(--muted); text-align: center; margin: 12px 0 0; }

/* Confirmation ("the link will be emailed") */
.success { padding: 40px 32px 32px; text-align: center; }
.success:focus { outline: none; }
.success[hidden] { display: none; }
.success-badge { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; color: var(--success); background: var(--success-50); border: 1px solid #abefc6; }
.success h2 { margin: 0 0 8px; font-size: 21px; font-weight: 700; color: var(--ink); }
.success > p { margin: 0 auto; max-width: 440px; font-size: 14.5px; line-height: 2; color: var(--text); }
.success-detail { margin: 22px auto 18px; max-width: 440px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.success-detail dt { font-size: 12.5px; color: var(--muted); }
.success-detail dd { margin: 2px 0 0; font-size: 15.5px; font-weight: 600; color: var(--ink); word-break: break-all; }
.success-notes { margin: 0 auto 24px; padding: 0 18px 0 0; max-width: 440px; text-align: right; font-size: 13.5px; line-height: 1.95; color: var(--muted); }
.success-notes li + li { margin-top: 2px; }

.page-foot { margin: 20px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.page-foot a { color: var(--muted); text-decoration: none; }
.page-foot a:hover { color: var(--plum); }

@media (max-width: 600px) {
  .sitebar-inner { padding: 0 16px; gap: 10px; }
  .page { margin-top: 20px; padding: 0 12px 32px; }
  .card-head { padding: 22px 20px 18px; }
  .card-body { padding: 20px 20px 4px; }
  .card-foot { padding: 4px 20px 22px; }
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .success { padding: 32px 20px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
