/* StudyVim Visitor Insights – front end */
.svi-overlay, .svi-inline, .svi-tab, .svi-consent-bar {
  --svi-ink: #0e1234;
  --svi-muted: #5b6280;
  --svi-line: #dfe2f0;
  --svi-a: #6366f1;
  --svi-b: #ec4899;
  --svi-err: #d92d20;
  font-family: inherit;
  box-sizing: border-box;
}
.svi-overlay *, .svi-inline *, .svi-consent-bar * { box-sizing: border-box; }
[hidden].svi-overlay, [hidden].svi-tab, [hidden].svi-consent-bar, .svi-done[hidden], .svi-form[hidden], .svi-wa[hidden] { display: none !important; }
html.svi-lock { overflow: hidden; }

/* popup */
.svi-overlay {
  position: fixed; inset: 0; z-index: 99998;
  background: rgba(10, 12, 35, .62);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: svi-fade .2s ease;
}
.svi-modal {
  position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto;
  background: #fff; color: var(--svi-ink); border-radius: 18px; padding: 28px 24px 22px;
  box-shadow: 0 24px 60px rgba(10, 12, 35, .35);
  animation: svi-up .25s ease;
}
.svi-modal::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px;
  border-radius: 18px 18px 0 0; background: linear-gradient(90deg, var(--svi-a), var(--svi-b));
}
.svi-modal h2 { margin: 0 32px 6px 0; font-size: 22px; line-height: 1.25; color: var(--svi-ink); }
.svi-sub { margin: 0 0 18px; font-size: 14.5px; line-height: 1.5; color: var(--svi-muted); }
.svi-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: #f1f2f8; color: var(--svi-ink); font-size: 22px; line-height: 1; cursor: pointer;
}
.svi-close:hover { background: #e4e6f3; }

/* form */
.svi-inline { max-width: 480px; background: #fff; color: var(--svi-ink); border: 1px solid var(--svi-line); border-radius: 16px; padding: 22px; }
.svi-inline-title { margin: 0 0 14px; font-size: 20px; }
.svi-field { margin-bottom: 12px; }
.svi-field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; color: var(--svi-ink); }
.svi-opt { font-weight: 400; color: var(--svi-muted); }
.svi-field input, .svi-field select {
  width: 100%; height: 44px; padding: 0 12px; font-size: 15px; color: var(--svi-ink);
  border: 1.5px solid var(--svi-line); border-radius: 10px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.svi-field input:focus, .svi-field select:focus { border-color: var(--svi-a); box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
.svi-field [aria-invalid="true"] { border-color: var(--svi-err); }
.svi-phone { display: flex; }
.svi-phone span {
  display: flex; align-items: center; padding: 0 12px; font-size: 15px; color: var(--svi-muted);
  background: #f5f6fb; border: 1.5px solid var(--svi-line); border-right: 0; border-radius: 10px 0 0 10px;
}
.svi-phone input { border-radius: 0 10px 10px 0; }
.svi-err { display: block; min-height: 0; font-size: 12.5px; color: var(--svi-err); margin-top: 4px; }
.svi-err:empty { display: none; }
.svi-consent { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; color: var(--svi-muted); margin: 4px 0 2px; cursor: pointer; }
.svi-consent input { margin-top: 2px; width: 16px; height: 16px; flex: none; accent-color: var(--svi-a); }
.svi-consent a { color: var(--svi-a); }
.svi-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.svi-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin-top: 14px;
  padding: 0 18px; border: 0; border-radius: 12px; cursor: pointer; text-decoration: none;
  font-size: 16px; font-weight: 700; color: #fff !important;
  background: linear-gradient(90deg, var(--svi-a), var(--svi-b));
  box-shadow: 0 8px 20px rgba(99, 102, 241, .28); transition: transform .1s, filter .15s;
}
.svi-btn:hover { filter: brightness(1.05); }
.svi-btn:active { transform: translateY(1px); }
.svi-btn:disabled { opacity: .7; cursor: wait; }
.svi-form-msg { margin: 10px 0 0; font-size: 13px; color: var(--svi-err); }
.svi-form-msg:empty { display: none; }

/* success */
.svi-done { text-align: center; padding: 8px 0 4px; }
.svi-done-icon {
  width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 28px; color: #fff;
  background: linear-gradient(135deg, #10b981, #2dd4bf);
}
.svi-done h3 { margin: 0 0 6px; font-size: 20px; color: var(--svi-ink); }
.svi-done p { margin: 0; color: var(--svi-muted); font-size: 14.5px; }
.svi-wa { background: #25d366; box-shadow: 0 8px 20px rgba(37, 211, 102, .3); }

/* reopen tab */
.svi-tab {
  position: fixed; left: 16px; bottom: 16px; z-index: 99990;
  padding: 11px 18px; border: 0; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: #fff;
  background: linear-gradient(90deg, var(--svi-a), var(--svi-b));
  box-shadow: 0 8px 24px rgba(14, 18, 52, .3);
}

/* consent bar */
.svi-consent-bar {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 99995; max-width: 720px; margin: 0 auto;
  display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 14px; background: #0e1234; color: #e6e8f5;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .3); font-size: 13.5px; line-height: 1.45;
}
.svi-consent-bar p { margin: 0; flex: 1 1 320px; }
.svi-consent-bar a { color: #a5b4fc; }
.svi-consent-bar div { display: flex; gap: 8px; }
.svi-consent-bar .svi-btn { width: auto; min-height: 38px; margin: 0; font-size: 14px; box-shadow: none; }
.svi-decline { background: transparent; color: #c7cbe6; border: 1px solid #3a3f6b; border-radius: 12px; padding: 0 14px; min-height: 38px; cursor: pointer; font-size: 14px; }

@keyframes svi-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes svi-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .svi-overlay, .svi-modal { animation: none; } }
@media (max-width: 480px) {
  .svi-overlay { align-items: flex-end; padding: 0; }
  .svi-modal { max-width: none; border-radius: 18px 18px 0 0; max-height: 92vh; }
  .svi-modal::before { border-radius: 18px 18px 0 0; }
}
