@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&display=swap');

/* ===== ROOT VARIABLES ===== */
:root {
  --nsp-primary:       #2d7a2d;
  --nsp-primary-dark:  #1b5e20;
  --nsp-primary-mid:   #388e3c;
  --nsp-accent:        #66bb6a;
  --nsp-light:         #e8f5e9;
  --nsp-lighter:       #f1f8f1;
  --nsp-white:         #ffffff;
  --nsp-text:          #1a3a1a;
  --nsp-text-light:    #556055;
  --nsp-border:        #c8e6c9;
  --nsp-shadow:        rgba(27, 94, 32, 0.18);
  --nsp-radius:        18px;
  --nsp-font:          'Sarabun', sans-serif;
}

/* ===== WRAPPER ===== */
.nsp-wrapper {
  font-family: var(--nsp-font);
  max-width: 960px;
  margin: 0 auto;
  background: var(--nsp-white);
  border-radius: var(--nsp-radius);
  overflow: hidden;
  box-shadow: 0 10px 48px var(--nsp-shadow);
}

/* ===== HEADER ===== */
.nsp-header {
  background: linear-gradient(120deg, var(--nsp-primary-dark) 0%, var(--nsp-primary-mid) 55%, var(--nsp-accent) 100%);
  padding: 22px 36px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}
.nsp-header::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.nsp-header::after {
  content: '';
  position: absolute;
  bottom: -35px; left: 30%;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}

.nsp-logo {
  font-size: 38px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.2));
  line-height: 1;
}

.nsp-header-text { flex: 1; }

.nsp-title {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  letter-spacing: .4px;
  margin-bottom: 2px;
  text-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.nsp-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,.82);
  font-weight: 400;
}

.nsp-question-inline {
  background: rgba(255,255,255,.16);
  border: 1.5px solid rgba(255,255,255,.28);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  max-width: 280px;
  line-height: 1.4;
  text-align: center;
}

/* ===== BODY: HORIZONTAL SPLIT ===== */
.nsp-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 400px;
}

/* ===== LEFT PANEL — FORM ===== */
.nsp-panel-left {
  padding: 26px 30px;
  border-right: 2px solid var(--nsp-border);
  display: flex;
  flex-direction: column;
}

.nsp-panel-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--nsp-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.nsp-form { display: flex; flex-direction: column; flex: 1; }

.nsp-choices {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
  flex: 1;
}

.nsp-choice-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border: 2px solid var(--nsp-border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--nsp-white);
  transition: all .18s ease;
  position: relative;
  user-select: none;
}

.nsp-choice-item:hover {
  border-color: var(--nsp-accent);
  background: var(--nsp-lighter);
  transform: translateX(3px);
}

.nsp-choice-item input[type=radio] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.nsp-choice-item input[type=radio]:checked ~ .nsp-check {
  opacity: 1;
  transform: scale(1);
}

.nsp-choice-item:has(input:checked) {
  border-color: var(--nsp-primary);
  background: var(--nsp-light);
  box-shadow: 0 2px 10px rgba(45,122,45,.14);
}

.nsp-choice-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}

.nsp-choice-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--nsp-text);
  flex: 1;
}

.nsp-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--nsp-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.4);
  transition: all .18s ease;
  flex-shrink: 0;
}

/* ===== VOTE BUTTON ===== */
.nsp-btn-vote {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--nsp-primary) 0%, var(--nsp-primary-mid) 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--nsp-font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s ease;
  box-shadow: 0 4px 14px rgba(45,122,45,.28);
  margin-top: auto;
}

.nsp-btn-vote:hover {
  background: linear-gradient(135deg, var(--nsp-primary-dark) 0%, var(--nsp-primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45,122,45,.36);
}
.nsp-btn-vote:active  { transform: translateY(0); }
.nsp-btn-vote:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ===== MESSAGE ===== */
.nsp-msg {
  margin-top: 9px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  min-height: 18px;
  transition: all .3s;
}
.nsp-msg.success { color: var(--nsp-primary); }
.nsp-msg.error   { color: #c62828; }

/* ===== VOTED BADGE ===== */
.nsp-voted-badge {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--nsp-light);
  border: 2px solid var(--nsp-border);
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--nsp-primary-dark);
}

/* ===== RIGHT PANEL — RESULTS ===== */
.nsp-panel-right {
  padding: 26px 30px;
  background: var(--nsp-lighter);
  display: flex;
  flex-direction: column;
  animation: nsp-fadeIn .4s ease;
}

.nsp-results-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--nsp-primary-dark);
  margin-bottom: 14px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .8px;
}

/* ===== DOUGHNUT ===== */
.nsp-chart-wrap {
  position: relative;
  width: 190px;
  height: 190px;
  margin: 0 auto 18px;
  flex-shrink: 0;
}
.nsp-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.nsp-total-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.nsp-total-center span {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--nsp-primary-dark);
  line-height: 1;
}
.nsp-total-center small {
  font-size: 10px;
  color: var(--nsp-text-light);
  font-weight: 600;
}

/* ===== LEGEND ===== */
.nsp-legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.nsp-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--nsp-white);
  border-radius: 8px;
  border: 1px solid var(--nsp-border);
}

.nsp-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nsp-legend-text {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--nsp-text);
}

.nsp-legend-bar-wrap {
  width: 52px;
  height: 5px;
  background: var(--nsp-border);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.nsp-legend-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}

.nsp-legend-count {
  font-size: 12px;
  font-weight: 800;
  color: var(--nsp-primary);
  min-width: 20px;
  text-align: right;
}

.nsp-legend-pct {
  font-size: 11px;
  color: var(--nsp-text-light);
  min-width: 34px;
  text-align: right;
}

/* ===== ANIMATION ===== */
@keyframes nsp-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE — mobile stacks vertically ===== */
@media (max-width: 660px) {
  .nsp-body {
    grid-template-columns: 1fr;
  }
  .nsp-panel-left {
    border-right: none;
    border-bottom: 2px solid var(--nsp-border);
    padding: 20px 18px;
  }
  .nsp-panel-right { padding: 20px 18px; }
  .nsp-header {
    flex-wrap: wrap;
    padding: 18px 18px;
    gap: 10px;
  }
  .nsp-question-inline {
    font-size: 13px;
    max-width: 100%;
  }
  .nsp-chart-wrap { width: 170px; height: 170px; }
}
