/* ChatBot That Says Ni
   Clean, fanvue-adjacent vibe with light/dark mode support.
*/

:root{
  --bg1:#edf4ee;
  --bg2:#e6efe7;
  --card:rgba(255, 255, 255, 0.78);
  --text:#000000;
  --muted:#5b7a55;
  --line:rgba(20, 40, 16, 0.12);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.14);

  --brand1: rgba(22,163,74,.95);
  --brand2: rgba(21,128,61,.85);
  --glow1: rgba(22,163,74,.20);
  --glow2: rgba(21,128,61,.16);

  --btn:#49F264; /* Fanvue official Screamin' Green */
  --btnText:#07130a;
  --btnLine: rgba(17, 40, 16, 0.14);

  --pillBg: rgba(0, 0, 0, 0.04);
  --pillLine: rgba(19, 40, 16, 0.1);

  --radius: 18px;
}

@media (prefers-color-scheme: dark){
  :root{
    /* Base background: near-black, very subtle green bias */
    --bg1:#060807;
    --bg2:#090c0a;
    --card:rgba(14, 18, 15, 0.82);
    --text:#eef6f1;
    --muted:#9bb8a8;
    --line:rgba(255,255,255,0.08);
    --shadow: 0 30px 90px rgba(0,0,0,0.55);
    --brand1: rgba(22,163,74,.95);
    --brand2: rgba(21,128,61,.85);
    --glow1: rgba(73,242,100,0.14);
    --glow2: rgba(73,242,100,0.08);

    --btn:#49F264; /* Fanvue Screamin??? Green */
    --btnText:#07130a; /* almost-black */
    --btnLine: rgba(255,255,255,0.08);

    --pillBg: rgba(255,255,255,0.05);
    --pillLine: rgba(255,255,255,0.10);
  }
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:
    radial-gradient(900px 520px at 18% 10%, var(--glow1), transparent 60%),
    radial-gradient(900px 520px at 82% 10%, var(--glow2), transparent 62%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

a{ color:inherit; }

.container{
  min-height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:28px;
}

.wrap{
  width:min(1000px, 100%);
  display:grid;
  gap:16px;
}

.card{
  border:1px solid var(--line);
  background:var(--card);
  backdrop-filter: blur(12px);
  border-radius:var(--radius);
  padding:22px;
  box-shadow: var(--shadow);
}

.top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
}

.logo{
  width:44px;
  height:44px;
  border-radius:14px;
  background: linear-gradient(135deg, var(--brand1), var(--brand2));
  box-shadow: 0 12px 36px rgba(99,102,241,.22);
}

.brand.disconnected .logo{
  background: linear-gradient(135deg, #c53030, #9b2c2c);
  box-shadow: 0 12px 36px rgba(197,48,48,.25);
}
h1.disconnected{ color: #c53030; }

h1{
  margin:0;
  font-size:22px;
  letter-spacing:-0.01em;
}

p{
  margin:10px 0 0;
  color:var(--muted);
  line-height:1.55;
}

.small{ font-size:12px; }
.muted{ color:var(--muted); }
.k{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
}

.grid{
  display:grid;
  gap:14px;
  grid-template-columns: 1.25fr .75fr;
}
@media (max-width: 860px){
  .grid{ grid-template-columns: 1fr; }
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--btnLine);
  background:var(--btn);
  color:var(--btnText);
  text-decoration:none;
  font-weight:650;
  transition: transform .06s ease, opacity .15s ease;
  user-select:none;
}
.btn:hover{ opacity:.94; }
.btn:active{ transform: translateY(1px); }

.btn.secondary{
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--pillLine);
  background:var(--pillBg);
  color:var(--muted);
  font-size:12px;
}

.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:12px;
}

hr.sep{
  border:0;
  height:1px;
  background: var(--line);
  margin:16px 0;
}

.notice{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background: rgba(99,102,241,.07);
  color: var(--muted);
}

.codeblock{
  margin-top:10px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.035);
  overflow:auto;
}
@media (prefers-color-scheme: dark){
  .codeblock{ background: rgba(255,255,255,.06); }
}

.welcome{ margin:8px 0 0; font-weight:500; }
.profile-form .form-group{ margin-bottom:1rem; }
.profile-form label{ display:block; margin-bottom:6px; color:var(--muted); }
.profile-form .checkbox-label{ display:flex; align-items:center; gap:8px; margin-bottom:8px; font-weight:500; cursor:pointer; }
.profile-form .checkbox-label input[type="checkbox"]{ flex-shrink:0; accent-color: var(--brand1); }
.profile-form input[type="text"],
.profile-form input[type="password"],
.profile-form input[type="number"],
.profile-form select{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
}
.profile-form select{ cursor:pointer; accent-color: var(--brand1); }
.profile-form select option{ background: var(--card); color: var(--text); }
.profile-form input:disabled{ opacity:0.6; cursor:not-allowed; }
.profile-form .follow-options{ display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.profile-form textarea{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  resize: vertical;
  min-height: 140px;
}
/* Custom radios (avoids bright white native circle in dark mode) */
.profile-form .radio-row input[type="radio"]{
  appearance: none;
  -webkit-appearance: none;
  width: 1.15em;
  height: 1.15em;
  border-radius: 50%;
  border: 2px solid rgba(22, 163, 74, 0.45);
  background: var(--card);
  flex-shrink: 0;
  margin-top: 4px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.profile-form .radio-row input[type="radio"]:checked{
  border-color: var(--brand1);
  background-color: var(--brand1);
  box-shadow: inset 0 0 0 3px var(--card);
}
.profile-form .radio-row input[type="radio"]:focus-visible{
  outline: 2px solid var(--brand1);
  outline-offset: 2px;
}
fieldset.subscriber-mode-fieldset{
  border: 0;
  padding: 0;
  margin: 0 0 1rem;
  min-width: 0;
}
fieldset.subscriber-mode-fieldset legend{
  margin-bottom: 8px;
  color: var(--muted);
}
.radio-stack{
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.radio-row{
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font-weight: 400;
}
.radio-row span{
  line-height: 1.45;
  color: var(--muted);
  font-size: 13px;
}
.radio-row strong{
  color: var(--text);
  font-weight: 650;
}

.emoji-toggle-row{
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.emoji-toggle-caption{
  line-height: 1.45;
}

/* Smaller toggle (e.g. emoji preference) */
.ios-toggle--sm .ios-toggle-track{
  width: 40px;
  height: 22px;
  border-radius: 11px;
}
.ios-toggle--sm .ios-toggle-knob{
  width: 18px;
  height: 18px;
  top: 2px;
  left: 2px;
}
.ios-toggle--sm input:checked + .ios-toggle-track .ios-toggle-knob{
  transform: translateX(18px);
}
.ios-toggle-label--sm{
  font-size: 10px;
  letter-spacing: 0.03em;
}
.ios-toggle-wrap--sm{
  gap: 6px;
}

/* Subscriber override panel: iOS-style bot toggle + themed inputs */
.subscriber-override-card{
  padding: 20px 22px;
}
.subscriber-override-card textarea{
  min-height: 92px;
}
.subscriber-override-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.subscriber-override-heading{
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.subscriber-override-toggle-wrap{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ios-toggle-label{
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  user-select: none;
}
.ios-toggle-label-on{ color: var(--brand1); }
.ios-toggle{
  position: relative;
  display: inline-block;
  cursor: pointer;
  line-height: 0;
}
.ios-toggle input{
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.ios-toggle-track{
  display: block;
  width: 51px;
  height: 31px;
  border-radius: 16px;
  background: rgba(120, 120, 128, 0.32);
  transition: background 0.2s ease;
  position: relative;
}
.ios-toggle-knob{
  position: absolute;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s ease;
}
.ios-toggle input:checked + .ios-toggle-track{
  background: var(--brand1);
}
.ios-toggle input:checked + .ios-toggle-track .ios-toggle-knob{
  transform: translateX(20px);
}
.ios-toggle input:focus-visible + .ios-toggle-track{
  outline: 2px solid var(--brand1);
  outline-offset: 3px;
}
@media (prefers-color-scheme: dark){
  .ios-toggle-track{
    background: rgba(120, 120, 128, 0.45);
  }
  .ios-toggle-knob{
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  }
}
.profile-form .form-actions{ display:flex; align-items:center; gap:12px; margin-top:12px; }
.profile-form .form-actions .btn{ flex-shrink:0; }
.profile-form .form-actions .small{ flex:1; }
.profile-form .form-actions .small.error{ color: #c53030; }

#emoji-usage-wrap .profile-form-select-inline{ width:100%; max-width:360px; margin-top:4px; }
.emoji-grid{ display:flex; flex-wrap:wrap; gap:6px 12px; margin-top:12px; }
.emoji-check{ display:inline-flex; align-items:center; cursor:pointer; font-size:1.1em; }
.emoji-check input{ margin:0 4px 0 0; accent-color: var(--brand1); }
.emoji-check input:disabled{ cursor:not-allowed; opacity:0.6; }

@media (prefers-color-scheme: dark){
  .profile-form select{
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--card) !important;
    color: #eef6f1 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239bb8a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1.1em;
    padding-right: 2.5em;
  }
  .profile-form select option{
    background: #0e120f !important;
    color: #eef6f1 !important;
  }
  .profile-form select::-ms-value{
    color: #eef6f1 !important;
    background: transparent !important;
  }
  .profile-form .checkbox-label input[type="checkbox"],
  .emoji-check input[type="checkbox"]{
    appearance: none;
    width: 1.15em;
    height: 1.15em;
    border: 2px solid rgba(73, 242, 100, 0.55);
    background: transparent;
    border-radius: 4px;
    flex-shrink: 0;
  }
  .profile-form .checkbox-label input[type="checkbox"]:checked,
  .emoji-check input[type="checkbox"]:checked{
    background: var(--brand1);
    border-color: var(--brand1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath fill='none' stroke='%2307130a' stroke-width='2' d='M1 5l3 3 7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.85em;
  }
  .profile-form .checkbox-label input[type="checkbox"]:disabled,
  .emoji-check input[type="checkbox"]:disabled{
    border-color: rgba(255,255,255,0.25);
    background: var(--bg1);
    opacity: 0.7;
  }
  .emoji-check input[type="checkbox"]:checked:disabled{
    background-color: var(--brand1);
    opacity: 0.8;
  }
  .profile-form input[type="text"],
  .profile-form input[type="password"],
  .profile-form input[type="number"],
  .profile-form textarea{
    background-color: rgba(14, 18, 15, 0.92) !important;
    color: #eef6f1 !important;
  }
  .profile-form input:-webkit-autofill,
  .profile-form textarea:-webkit-autofill{
    -webkit-text-fill-color: #eef6f1 !important;
    box-shadow: 0 0 0 1000px rgba(14, 18, 15, 0.92) inset !important;
  }
  .profile-form .radio-row input[type="radio"]{
    border-color: rgba(73, 242, 100, 0.5);
    background: rgba(6, 8, 7, 0.72);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  }
  .profile-form .radio-row input[type="radio"]:checked{
    border-color: var(--brand1);
    background-color: var(--brand1);
    box-shadow: inset 0 0 0 3px rgba(6, 8, 7, 0.92);
  }
  .radio-row strong{
    color: #b8dcc8;
  }
}

.wizard-overlay{
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wizard-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 6, 0.55);
  backdrop-filter: blur(3px);
}
.wizard-modal{
  position: relative;
  width: min(740px, calc(100% - 28px));
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
  animation: wizardIn 220ms ease both;
}
.wizard-head h2{
  margin: 0 0 6px;
  font-size: 20px;
}
.wizard-progress-wrap{
  margin-top: 10px;
}
.wizard-progress-bar{
  width: 100%;
  height: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.07);
  overflow: hidden;
}
.wizard-progress-bar > span{
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  transition: width 220ms ease;
}
.wizard-question{
  margin: 8px 0 4px;
  color: var(--text);
  font-weight: 650;
}
.wizard-body{
  margin-top: 12px;
  min-height: 58px;
}
.wizard-inline-control{
  margin-top: 12px;
  display: grid;
  gap: 10px;
}
.wizard-inline-field{
  display: grid;
  gap: 6px;
}
.wizard-inline-field input[type="text"],
.wizard-inline-field input[type="number"],
.wizard-inline-field select,
.wizard-inline-field textarea{
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}
.wizard-inline-checkbox-row{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text);
}
.wizard-inline-checkbox-row input[type="checkbox"]{
  width: 16px;
  height: 16px;
}
.wizard-actions{
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wizard-actions .btn{
  min-width: 118px;
}
.wizard-actions .wizard-skip-all{
  margin-left: auto;
}
.wizard-subs-actions{
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wizard-loading{
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.wizard-spinner{
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(100, 100, 100, 0.35);
  border-top-color: var(--brand1);
  animation: spin 900ms linear infinite;
}
body.wizard-lock{
  overflow: hidden;
}
@keyframes spin{
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes wizardIn{
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
