/* ═══════════════════════════════════════════════
   SurveyApp — app.css
   ═══════════════════════════════════════════════ */

:root {
  --sa-primary:       #4F6EF7;
  --sa-primary-dark:  #3B57D8;
  --sa-primary-light: #EEF1FE;
  --sa-success:       #22C55E;
  --sa-danger:        #EF4444;
  --sa-warning:       #F59E0B;
  --sa-text:          #1a1a2e;
  --sa-muted:         #6b7280;
  --sa-border:        #e5e7eb;
  --sa-surface:       #ffffff;
  --sa-bg:            #f8f9fc;
  --sa-radius:        10px;
  --sa-radius-sm:     6px;
  --sa-shadow:        0 1px 4px rgba(0,0,0,.06);
  --sa-shadow-md:     0 4px 16px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--sa-bg);
  color: var(--sa-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ── */
.sa-navbar {
  background: var(--sa-surface);
  border-bottom: 1px solid var(--sa-border);
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.sa-logo-icon { color: var(--sa-primary); font-size: 1.4rem; }
.sa-logo-icon-lg { font-size: 2.5rem; color: var(--sa-primary); }
.sa-brand-text { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.3px; }
.sa-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--sa-primary-light);
  color: var(--sa-primary);
  font-weight: 600; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ── Main content ── */
.sa-main-content { flex: 1; }
.sa-footer { border-top: 1px solid var(--sa-border); background: var(--sa-surface); }

/* ── Card ── */
.sa-card {
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius);
  padding: 1.25rem;
  box-shadow: var(--sa-shadow);
}
.sa-card-title {
  font-weight: 600;
  font-size: .9rem;
  color: var(--sa-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Buttons ── */
.btn.sa-btn-primary {
  background: var(--sa-primary);
  color: #fff;
  border: none;
  border-radius: var(--sa-radius-sm);
  padding: .45rem 1rem;
  font-weight: 500;
  transition: background .15s;
}
.btn.sa-btn-primary:hover { background: var(--sa-primary-dark); color: #fff; }

.btn.sa-btn-secondary {
  background: var(--sa-surface);
  color: var(--sa-text);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius-sm);
  padding: .45rem 1rem;
  font-weight: 500;
  transition: background .15s;
}
.btn.sa-btn-secondary:hover { background: var(--sa-bg); }

.btn.sa-btn-ghost {
  background: transparent;
  color: var(--sa-muted);
  border: none;
  padding: .45rem .75rem;
}
.btn.sa-btn-ghost:hover { background: var(--sa-bg); color: var(--sa-text); }

.btn.sa-btn-success {
  background: var(--sa-success);
  color: #fff; border: none;
  border-radius: var(--sa-radius-sm);
  padding: .45rem 1rem;
  font-weight: 500;
}

.btn-xs { font-size: .75rem; padding: .2rem .4rem; }
.sa-btn-icon {
  background: transparent; border: 1px solid var(--sa-border);
  color: var(--sa-muted); border-radius: 5px;
}
.sa-btn-icon:hover { background: var(--sa-bg); color: var(--sa-text); }
.sa-btn-icon-danger {
  background: transparent; border: 1px solid #fecaca;
  color: var(--sa-danger); border-radius: 5px;
}
.sa-btn-icon-danger:hover { background: #fef2f2; }

/* ── Input ── */
.sa-input {
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius-sm);
  padding: .5rem .75rem;
  font-size: .9rem;
  transition: border-color .15s, box-shadow .15s;
}
.sa-input:focus {
  border-color: var(--sa-primary);
  box-shadow: 0 0 0 3px rgba(79,110,247,.12);
  outline: none;
}

/* ── Status badges ── */
.sa-status-badge {
  display: inline-block;
  font-size: .7rem; font-weight: 600;
  padding: .2rem .55rem;
  border-radius: 20px;
  text-transform: uppercase; letter-spacing: .3px;
}
.sa-status-draft     { background: #fef3c7; color: #92400e; }
.sa-status-published { background: #d1fae5; color: #065f46; }
.sa-status-closed    { background: #fee2e2; color: #991b1b; }

/* ── Type badges ── */
.sa-type-badge {
  display: inline-block;
  font-size: .68rem; font-weight: 500;
  padding: .15rem .5rem;
  border-radius: 4px;
  background: var(--sa-primary-light);
  color: var(--sa-primary);
}

/* ── Form card (dashboard list) ── */
.sa-form-card {
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius);
  overflow: hidden;
  box-shadow: var(--sa-shadow);
  transition: box-shadow .2s;
}
.sa-form-card:hover { box-shadow: var(--sa-shadow-md); }
.sa-form-card-header {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--sa-border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--sa-bg);
}
.sa-form-card-body { padding: 1rem; }
.sa-form-card-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--sa-border);
  display: flex; gap: .5rem;
  background: var(--sa-bg);
}

/* ── Empty state ── */
.sa-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--sa-surface);
  border: 1px dashed var(--sa-border);
  border-radius: var(--sa-radius);
}
.sa-empty-icon { font-size: 3.5rem; color: #d1d5db; display: block; margin-bottom: .5rem; }
.sa-empty-mini { text-align: center; padding: 2rem; }
.sa-empty-mini-icon { font-size: 2rem; color: #d1d5db; }

/* ── Question list ── */
.sa-question-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem;
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius-sm);
  margin-bottom: .5rem;
  cursor: move;
  transition: box-shadow .15s;
}
.sa-question-item:hover { box-shadow: var(--sa-shadow-md); }
.sa-question-item.sortable-ghost { opacity: .4; background: var(--sa-primary-light); }
.sa-question-item.sortable-chosen { box-shadow: var(--sa-shadow-md); }
.sa-question-drag { color: #d1d5db; margin-top: .15rem; font-size: 1rem; }
.sa-question-body { flex: 1; min-width: 0; }

.sa-q-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--sa-primary-light); color: var(--sa-primary);
  font-size: .7rem; font-weight: 600; flex-shrink: 0;
}
.sa-q-num-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--sa-primary); color: #fff;
  font-size: .75rem; font-weight: 600; flex-shrink: 0; margin-right: .5rem;
}
.sa-q-num-badge-lg {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--sa-primary); color: #fff;
  font-size: .8rem; font-weight: 600; flex-shrink: 0;
}

.sa-required-badge {
  display: inline-block; font-size: .65rem; font-weight: 500;
  padding: .1rem .4rem; border-radius: 4px;
  background: #fee2e2; color: #991b1b; margin-top: 2px;
}
.sa-options-preview { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; }
.sa-opt-chip {
  font-size: .7rem; padding: .1rem .45rem;
  background: var(--sa-bg); border: 1px solid var(--sa-border);
  border-radius: 3px; color: var(--sa-muted);
}

/* ── Type selector grid ── */
.sa-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .4rem;
}
.sa-type-tile input[type=radio] { display: none; }
.sa-type-tile-inner {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem;
  background: var(--sa-bg); border: 1.5px solid var(--sa-border);
  border-radius: var(--sa-radius-sm); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.sa-type-tile input[type=radio]:checked + .sa-type-tile-inner {
  border-color: var(--sa-primary);
  background: var(--sa-primary-light);
}
.sa-type-tile-inner:hover { border-color: var(--sa-primary); }
.sa-type-icon { font-size: 1rem; }
.sa-type-label { font-size: .78rem; font-weight: 500; }

/* ── Share box ── */
.sa-share-box {
  background: var(--sa-bg);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius-sm);
  padding: .75rem 1rem;
}

/* ── Sticky panel ── */
@media (min-width: 992px) {
  .sa-sticky-panel { position: sticky; top: 72px; }
}

/* ── Badge count ── */
.sa-badge-count {
  background: var(--sa-primary-light);
  color: var(--sa-primary);
  font-size: .7rem; padding: .1rem .45rem;
  border-radius: 10px;
}

/* ── Modal ── */
.sa-modal { border-radius: var(--sa-radius); border: none; }
.sa-modal .modal-header { padding: 1.25rem 1.25rem .5rem; }
.sa-modal .modal-body { padding: .75rem 1.25rem 1.25rem; }

/* ── Stats ── */
.sa-stat-card {
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius);
  padding: 1.25rem;
  text-align: center;
}
.sa-stat-value { font-size: 2rem; font-weight: 700; color: var(--sa-primary); }
.sa-stat-label { font-size: .8rem; color: var(--sa-muted); margin-top: .25rem; }

.sa-stat-card-sm {
  background: var(--sa-bg); border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius-sm); padding: .75rem;
  text-align: center;
}
.sa-stat-val-sm { font-size: 1.4rem; font-weight: 700; color: var(--sa-primary); display: block; }

/* ── Bar chart ── */
.sa-bar-chart-wrapper { padding: .25rem 0; }
.sa-bar-row { display: flex; align-items: center; gap: .75rem; }
.sa-bar-label { width: 140px; font-size: .82rem; text-align: right; color: var(--sa-text); flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-bar-track { flex: 1; height: 18px; background: var(--sa-bg); border-radius: 3px; overflow: hidden; }
.sa-bar-fill { height: 100%; background: var(--sa-primary); border-radius: 3px; transition: width .5s ease; }
.sa-bar-pct { font-size: .8rem; font-weight: 600; min-width: 70px; }

/* ── Stars display ── */
.sa-big-num { font-size: 2.5rem; font-weight: 700; color: var(--sa-primary); line-height: 1; }
.sa-stars-display { color: #f59e0b; font-size: 1.2rem; }
.sa-star-icon { color: #f59e0b; }

/* ── NPS stats ── */
.sa-nps-stat {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .5rem;
  font-size: 1.2rem; font-weight: 700;
}
.nps-promoter  { background: #d1fae5; color: #065f46; }
.nps-passive   { background: #fef3c7; color: #92400e; }
.nps-detractor { background: #fee2e2; color: #991b1b; }
.sa-nps-score-banner {
  background: var(--sa-primary-light); color: var(--sa-primary);
  border-radius: var(--sa-radius-sm); padding: .75rem 1rem;
  text-align: center; font-size: 1rem;
}

/* ── Text answers ── */
.sa-text-answers { max-height: 300px; overflow-y: auto; }
.sa-text-answer-item {
  padding: .65rem .85rem;
  border-left: 3px solid var(--sa-primary-light);
  margin-bottom: .5rem;
  background: var(--sa-bg);
  border-radius: 0 var(--sa-radius-sm) var(--sa-radius-sm) 0;
}
.sa-text-answer-date { font-size: .7rem; color: var(--sa-muted); display: block; margin-bottom: .2rem; }

/* ── Charts ── */
.sa-chart { max-height: 200px; }

/* ── Misc ── */
.sa-back-link { color: var(--sa-muted); text-decoration: none; font-size: .88rem; }
.sa-back-link:hover { color: var(--sa-primary); }
.sa-link { color: var(--sa-primary); text-decoration: none; }
.sa-link:hover { text-decoration: underline; }
.sa-divider { border-top: 1px solid var(--sa-border); }
