/* widget.css */
/* Novella Widget (trigger + panel + question types) */

/* ===== WIDGET TRIGGER BUTTON ===== */
.novella-widget-trigger{
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #5b5bd6 0%, #7c3aed 100%);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.5rem;
  box-shadow: 0 4px 20px rgba(91, 91, 214, 0.35);
  transition: all 0.3s;
  z-index: 1000;
}

.novella-widget-trigger:hover{
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(91, 91, 214, 0.45);
}

.novella-widget-trigger.open{
  transform: rotate(45deg);
}

/* ===== WIDGET PANEL ===== */
.novella-widget{
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.novella-widget.open{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ===== HEADER ===== */
.novella-widget-header{
  padding: 20px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.widget-logo{
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: #5b5bd6;
  font-size: 1rem;
}

.widget-close{
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #a0aec0;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.widget-close:hover{
  color: #4a5568;
}

/* ===== BODY ===== */
.novella-widget-body{
  padding: 24px;
}

.widget-question{
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 20px;
  line-height: 1.4;
}

/* ===== NPS ===== */
.nps-scale{
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.nps-scale input{ display: none; }

.nps-scale label{
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.nps-scale label:hover{
  border-color: #5b5bd6;
  background: #f7fafc;
}

.nps-scale input:checked + label{
  background: #5b5bd6;
  border-color: #5b5bd6;
  color: #ffffff;
  transform: scale(1.1);
}

/* NPS color bands */
.nps-scale input[value="0"]:checked + label,
.nps-scale input[value="1"]:checked + label,
.nps-scale input[value="2"]:checked + label,
.nps-scale input[value="3"]:checked + label,
.nps-scale input[value="4"]:checked + label,
.nps-scale input[value="5"]:checked + label,
.nps-scale input[value="6"]:checked + label{
  background: #f56565;
  border-color: #f56565;
}

.nps-scale input[value="7"]:checked + label,
.nps-scale input[value="8"]:checked + label{
  background: #ed8936;
  border-color: #ed8936;
}

.nps-scale input[value="9"]:checked + label,
.nps-scale input[value="10"]:checked + label{
  background: #48bb78;
  border-color: #48bb78;
}

.scale-labels{
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #a0aec0;
  margin-bottom: 20px;
  padding: 0 2px;
}

/* ===== CSAT (same design language as NPS) ===== */
.csat-scale{
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.csat-scale input{ display: none; }

.csat-scale label{
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.csat-scale label:hover{
  border-color: var(--nw-accent);
  background: #f7fafc;
}

.csat-scale input:checked + label{
  background: var(--nw-accent);
  border-color: var(--nw-accent);
  color: #ffffff;
  transform: scale(1.08);
}

/* ===== CES ===== */
.ces-scale{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.ces-scale input{ display: none; }

.ces-scale label{
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-weight: 700;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.ces-scale label:hover{
  border-color: #5b5bd6;
  background: #f7fafc;
}

.ces-scale input:checked + label{
  background: #5b5bd6;
  border-color: #5b5bd6;
  color: #ffffff;
  transform: scale(1.1);
}

/* ===== Likert ===== */
.likert-scale{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.likert-option{
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.likert-option:hover{
  border-color: #5b5bd6;
  background: #f7fafc;
}

.likert-option input{
  margin-right: 12px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.likert-option input:checked{
  accent-color: #5b5bd6;
}

.likert-option label{
  cursor: pointer;
  font-weight: 600;
  color: #4a5568;
  flex: 1;
}

.likert-option input:checked ~ label{
  color: #5b5bd6;
  font-weight: 800;
}

/* ===== Thumbs ===== */
.thumbs-scale{
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 20px;
}

.thumbs-btn{
  width: 80px;
  height: 80px;
  border: 3px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  transition: all 0.2s;
  user-select: none;
}

.thumbs-btn:hover{
  transform: scale(1.1);
  border-color: #5b5bd6;
}

.thumbs-btn.selected{
  transform: scale(1.15);
}

.thumbs-btn.up.selected{
  border-color: #48bb78;
  background: #c6f6d5;
}

.thumbs-btn.down.selected{
  border-color: #f56565;
  background: #fed7d7;
}

/* ===== Comment ===== */
.widget-comment{
  margin-bottom: 20px;
}

.widget-comment label{
  display: block;
  font-weight: 700;
  color: #4a5568;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.widget-comment textarea{
  width: 100%;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 80px;
  transition: all 0.2s;
}

.widget-comment textarea:focus{
  outline: none;
  border-color: #5b5bd6;
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.12);
}

/* ===== Submit ===== */
.widget-submit{
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #5b5bd6 0%, #7c3aed 100%);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.widget-submit:hover{
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(91, 91, 214, 0.35);
}

.widget-submit:disabled{
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== Success state ===== */
.widget-success{
  text-align: center;
  padding: 40px 20px;
}

.success-icon{
  width: 60px;
  height: 60px;
  background: #c6f6d5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #48bb78;
  font-size: 2rem;
}

.success-title{
  font-size: 1.25rem;
  font-weight: 800;
  color: #1a202c;
  margin-bottom: 8px;
}

.success-text{
  color: #718096;
  font-size: 0.9rem;
}

/* ===== Footer ===== */
.novella-widget-footer{
  padding: 12px 20px;
  border-top: 1px solid #f0f0f0;
  text-align: center;
  font-size: 0.75rem;
  color: #a0aec0;
}

.novella-widget-footer a{
  color: #5b5bd6;
  text-decoration: none;
  font-weight: 800;
}

.novella-widget-footer a:hover{
  color: #7c3aed;
}

/* ===================================================== */
/* Demo – widget placement controls                      */
/* ===================================================== */

.demo-display-controls {
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #ffffff);
  border-radius: 14px;
}

.demo-display-title {
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--heading, #1a202c);
}

.demo-display-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.demo-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text, #2d3748);
  cursor: pointer;
}

.demo-radio input {
  cursor: pointer;
}

/* ===================================================== */
/* Demo – embed slot                                     */
/* ===================================================== */

.demo-embed-slot {
  margin-top: 22px;
  padding: 14px;
  border: 1px dashed var(--border, #e2e8f0);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}

.demo-embed-placeholder {
  font-size: 14px;
  color: var(--muted, #718096);
}

/* ===================================================== */
/* Widget trigger – placement variants                   */
/* ===================================================== */

/* Base trigger (your existing styles still apply) */
.novella-widget-trigger {
  z-index: 9999;
}

/* Floating button */
.novella-widget-trigger.is-floating {
  position: fixed;
  bottom: 18px;
}

.novella-widget-trigger.is-floating.right {
  right: 18px;
  left: auto;
}

.novella-widget-trigger.is-floating.left {
  left: 18px;
  right: auto;
}

/* ===================================================== */
/* Hotjar-style side tab (flush edge, vertical text)     */
/* ===================================================== */

.novella-widget-trigger.is-tab{
  position: fixed;
  top: 50%;
  transform: translateY(-50%); /* no rotation */
  bottom: auto;

  width: auto;
  height: auto;
  padding: 10px 12px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;

  /* keep your existing gradient */
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.06);
}

/* Hide icon in tab mode */
.novella-widget-trigger.is-tab i{
  display: none;
}

/* Vertical label */
.novella-widget-trigger.is-tab .tab-label{
  display: block;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.5px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  margin: 0;
}

/* Flush to the browser edge */
.novella-widget-trigger.is-tab.right{
  right: 0;
  left: auto;
  border-radius: 12px 0 0 12px; /* rounded on inner edge */
}

.novella-widget-trigger.is-tab.left{
  left: 0;
  right: auto;
  border-radius: 0 12px 12px 0; /* rounded on inner edge */
}

/* Small hover nudge inward */
.novella-widget-trigger.is-tab.right:hover{
  transform: translateY(-50%) translateX(-2px);
}

.novella-widget-trigger.is-tab.left:hover{
  transform: translateY(-50%) translateX(2px);
}

/* ===================================================== */
/* Widget container – embedded variant                   */
/* (blend into content: no shadow, no floating panel)    */
/* ===================================================== */

.novella-widget.is-embedded{
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;

  width: 100%;
  max-width: 100%;
  height: auto;

  margin: 0;              /* part of content flow */
  border-radius: 12px;

  /* override base hidden state */
  opacity: 1 !important;
  transform: none !important;
  pointer-events: all !important;

  /* key changes */
  box-shadow: none !important;
  background: transparent !important;
}

/* keep "open" from adding panel transforms */
.novella-widget.is-embedded.open{
  transform: none !important;
  opacity: 1 !important;
  pointer-events: all !important;
}

/* make header feel like inline section header */
.novella-widget.is-embedded .novella-widget-header{
  padding: 0 0 10px 0;
  border-bottom: 0;
  background: transparent;
}

/* body becomes the visible “form block” */
.novella-widget.is-embedded .novella-widget-body{
  padding: 14px;
  background: #fff;
  border: 1px solid rgba(113, 128, 150, 0.18);
  border-radius: 12px;
}

/* footer becomes subtle inline text */
.novella-widget.is-embedded .novella-widget-footer{
  padding: 10px 0 0 0;
  border-top: 0;
  background: transparent;
  text-align: left; /* feels more “content” */
}

/* ===================================================== */
/* Responsive tweaks                                     */
/* ===================================================== */

@media (max-width: 640px) {
  .demo-display-grid {
    grid-template-columns: 1fr;
  }

  .novella-widget.is-embedded {
    max-width: 100%;
  }
}

/* ===== Responsive ===== */
@media (max-width: 768px){
  .novella-widget{
    bottom: 90px;
    right: 12px;
    width: calc(100vw - 24px);
  }

  .novella-widget-trigger{
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
  }

  .nps-scale{
    gap: 4px;
  }

  .nps-scale label{
    font-size: 0.75rem;
  }
}

/* ===== 3-step widget flow ===== */
.novella-stepper{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  margin: -4px 0 14px;
}

.novella-step{
  width:26px;
  height:26px;
  border-radius:999px;
  border:2px solid #e2e8f0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:12px;
  color:#a0aec0;
  background:#fff;
}

.novella-step.active{
  border-color:#5b5bd6;
  color:#5b5bd6;
}

.novella-step-line{
  height:2px;
  width:28px;
  background:#e2e8f0;
  border-radius:999px;
}

.widget-helper{
  margin:-10px 0 14px;
  font-size:0.85rem;
  color:#a0aec0;
}

.novella-followup-options{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin: 10px 0 16px;
}

.novella-option-btn{
  border:2px solid #e2e8f0;
  background:#fff;
  padding:10px 12px;
  border-radius:12px;
  font-weight:700;
  font-size:0.9rem;
  color:#4a5568;
  cursor:pointer;
  transition:all .15s;
}

.novella-option-btn:hover{
  border-color:#5b5bd6;
  background:#f7fafc;
}

.novella-option-btn.selected{
  border-color:#5b5bd6;
  background:rgba(91,91,214,0.10);
  color:#1a202c;
}

.novella-step-actions{
  display:flex;
  gap:10px;
}

.widget-secondary{
  width: 40%;
  padding: 14px;
  border: 2px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}
.widget-secondary:hover{
  border-color:#5b5bd6;
  background:#f7fafc;
}

/* ===================================================== */
/* Demo – theme + font switching via data-attributes     */
/* ===================================================== */

/* A tiny select style used in the demo controls */
.demo-select{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid var(--border, #e2e8f0);
  background: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  font: inherit;
  color: var(--text, #2d3748);
  min-width: 180px;
  cursor: pointer;
}

/* Shared "theme variables" applied to both widget + trigger */
.novella-widget,
.novella-widget-trigger{
  --nw-accent: #5b5bd6;
  --nw-accent-2: #7c3aed;
  --nw-accent-contrast: #ffffff;
}

/* Purple (default) */
.novella-widget[data-theme="purple"],
.novella-widget-trigger[data-theme="purple"]{
  --nw-accent: #5b5bd6;
  --nw-accent-2: #7c3aed;
  --nw-accent-contrast: #ffffff;
}

/* Red */
.novella-widget[data-theme="red"],
.novella-widget-trigger[data-theme="red"]{
  --nw-accent: #e11d48;
  --nw-accent-2: #f97316;
  --nw-accent-contrast: #ffffff;
}

/* Green */
.novella-widget[data-theme="green"],
.novella-widget-trigger[data-theme="green"]{
  --nw-accent: #16a34a;
  --nw-accent-2: #0ea5e9;
  --nw-accent-contrast: #ffffff;
}

/* Yellow/Black */
.novella-widget[data-theme="yellowblack"],
.novella-widget-trigger[data-theme="yellowblack"]{
  --nw-accent: #facc15;
  --nw-accent-2: #111827;
  --nw-accent-contrast: #111827;
}

/* Apply theme variables to existing UI */
.novella-widget-trigger{
  background: linear-gradient(135deg, var(--nw-accent) 0%, var(--nw-accent-2) 100%);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--nw-accent) 35%, transparent);
}

.widget-logo{
  color: var(--nw-accent);
}

.widget-submit{
  background: linear-gradient(135deg, var(--nw-accent) 0%, var(--nw-accent-2) 100%);
}

.widget-submit:hover{
  box-shadow: 0 6px 20px color-mix(in srgb, var(--nw-accent) 35%, transparent);
}

/* Selected states */
.nps-scale input:checked + label,
.ces-scale input:checked + label{
  background: var(--nw-accent);
  border-color: var(--nw-accent);
}

/* Keep NPS band colors as-is; they override checked labels already */

/* Focus rings / accents */
.widget-comment textarea:focus{
  border-color: var(--nw-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--nw-accent) 14%, transparent);
}

.novella-widget-footer a{
  color: var(--nw-accent);
}
.novella-widget-footer a:hover{
  color: var(--nw-accent-2);
}

/* Icons in thank you */
.widget-success i{
  color: var(--nw-accent);
}

/* ===================================================== */
/* Font switching                                        */
/* ===================================================== */

.novella-widget[data-font="inter"],
.novella-widget-trigger[data-font="inter"]{
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.novella-widget[data-font="system"],
.novella-widget-trigger[data-font="system"]{
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.novella-widget[data-font="poppins"],
.novella-widget-trigger[data-font="poppins"]{
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.novella-widget[data-font="dmsans"],
.novella-widget-trigger[data-font="dmsans"]{
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.novella-widget[data-font="spacegrotesk"],
.novella-widget-trigger[data-font="spacegrotesk"]{
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Improve text rendering a bit */
.novella-widget,
.novella-widget-trigger{
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===================================================== */
/* Demo – theme swatches                                 */
/* ===================================================== */

.demo-swatch-row{
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.demo-swatch{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid var(--border, #e2e8f0);
  cursor: pointer;
  position: relative;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.demo-swatch:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.12);
  border-color: rgba(0,0,0,0.18);
}

.demo-swatch.is-active{
  border-color: rgba(0,0,0,0.25);
}

.demo-swatch.is-active::after{
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,0.18);
}

#novellaOverlay{
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 1500; /* below widget panel + trigger */
}

#novellaOverlay.is-visible{
  opacity: 1;
  pointer-events: all;
}

/* Ensure widget is above overlay */
.novella-widget{ z-index: 2000; }
.novella-widget-trigger{ z-index: 3000; }

/* Swatch fills (match your theme keys) */
.demo-swatch[data-theme="purple"]{
  background: linear-gradient(135deg, #5b5bd6 0%, #7c3aed 100%);
}
.demo-swatch[data-theme="red"]{
  background: linear-gradient(135deg, #e11d48 0%, #f97316 100%);
}
.demo-swatch[data-theme="green"]{
  background: linear-gradient(135deg, #16a34a 0%, #0ea5e9 100%);
}
.demo-swatch[data-theme="yellowblack"]{
  background: linear-gradient(135deg, #facc15 0%, #111827 100%);
}