/* =========================================================
   POLL Survey System - Modern UI Stylesheet
   (Dark Mode & Light Mode Full Theme Support)
   ========================================================= */

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --secondary: #8b5cf6;
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.25);

  --bg-gradient: linear-gradient(135deg, #090d16 0%, #171c35 50%, #090d16 100%);
  --card-bg: rgba(22, 29, 49, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover-border: rgba(99, 102, 241, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --input-bg: rgba(15, 23, 42, 0.65);
  --input-border: rgba(255, 255, 255, 0.12);
  --input-focus: #6366f1;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --glow-shadow: 0 0 35px var(--primary-glow);

  --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #edf2f7 50%, #f1f5f9 100%);
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(226, 232, 240, 0.9);
  --card-hover-border: rgba(99, 102, 241, 0.6);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;

  --input-bg: #ffffff;
  --input-border: rgba(203, 213, 225, 0.95);
  --input-focus: #6366f1;

  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 20px 35px -10px rgba(99, 102, 241, 0.12);
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Background Ambient Glow */
.ambient-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  transition: opacity 0.3s ease;
}
[data-theme="light"] .ambient-glow {
  opacity: 0.22;
}
.glow-1 {
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
}
.glow-2 {
  bottom: -150px;
  right: -100px;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
}

/* Container */
.survey-wrapper {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Top Utility Bar */
.top-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 4px 2px;
}
.brand-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  transition: all 0.2s ease;
}
[data-theme="light"] .brand-back-link {
  background: rgba(0, 0, 0, 0.04);
}
.brand-back-link:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateX(-2px);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  border-radius: 99px;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  font-family: inherit;
}
[data-theme="light"] .theme-toggle-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.theme-toggle-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  transform: translateY(-1px);
}
.theme-icon {
  font-size: 1rem;
  display: inline-flex;
}

/* Sticky Progress Bar */
.progress-bar-container {
  position: sticky;
  top: 16px;
  z-index: 100;
  margin-bottom: 28px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.3s ease;
}
[data-theme="light"] .progress-bar-container {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(226, 232, 240, 0.9);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
}
.progress-info .pct-badge {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
}
[data-theme="light"] .progress-track {
  background: rgba(0, 0, 0, 0.08);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a855f7, #10b981);
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header Card */
.survey-header-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 44px 36px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  text-align: center;
  transition: all 0.3s ease;
}
.survey-header-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
}
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #818cf8;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 99px;
  margin-bottom: 16px;
}
[data-theme="light"] .header-badge {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.25);
  color: #4f46e5;
}
.survey-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="light"] .survey-title {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.survey-subtitle {
  font-size: 1.025rem;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Question Cards */
.question-card {
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 32px 30px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.question-card:hover {
  border-color: var(--card-hover-border);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
}
.question-card.active-card {
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: var(--shadow-lg), 0 0 25px rgba(99, 102, 241, 0.15);
}

.question-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.q-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.35);
}
.q-title-wrap {
  flex-grow: 1;
}
.q-title {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.q-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.q-required {
  color: #f43f5e;
  font-weight: 700;
  margin-left: 4px;
}
.q-optional {
  font-size: 0.75rem;
  color: var(--text-subtle);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 500;
}
[data-theme="light"] .q-optional {
  background: rgba(0, 0, 0, 0.06);
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.options-grid.single-col {
  grid-template-columns: 1fr;
}

/* Custom Option Item */
.option-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
[data-theme="light"] .option-item {
  background: #ffffff;
  border-color: #e2e8f0;
}
.option-item:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateX(3px);
}
.option-item.selected {
  background: rgba(99, 102, 241, 0.14);
  border-color: var(--primary);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}
[data-theme="light"] .option-item.selected {
  background: #eef2ff;
  border-color: var(--primary);
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.custom-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.option-item input[type="checkbox"] + .custom-indicator {
  border-radius: 6px;
}
.option-item.selected .custom-indicator {
  border-color: var(--primary);
  background: var(--primary);
}
.custom-indicator::after {
  content: '';
  display: none;
}
.option-item input[type="radio"] + .custom-indicator::after {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
}
.option-item input[type="checkbox"] + .custom-indicator::after {
  content: '✓';
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
}
.option-item.selected .custom-indicator::after {
  display: block;
}

.option-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Other text input box */
.other-input-container {
  margin-top: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}
.other-text-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}
.other-text-input:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Textarea & Helper tags */
.custom-textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px 16px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  resize: vertical;
  line-height: 1.5;
  transition: all 0.2s ease;
}
.custom-textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.char-counter {
  display: flex;
  justify-content: flex-end;
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-top: 6px;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.tag-chip {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--input-border);
  border-radius: 99px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
[data-theme="light"] .tag-chip {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}
.tag-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border-color: var(--primary);
  transform: translateY(-1px);
}
[data-theme="light"] .tag-chip:hover {
  background: #eef2ff;
  color: #4f46e5;
}

/* Q7: NPS Rating 0 ~ 10 Component */
.nps-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.nps-buttons-wrap {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 6px;
}
@media (max-width: 640px) {
  .nps-buttons-wrap {
    grid-template-columns: repeat(6, 1fr);
  }
}
.nps-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--input-border);
  color: var(--text-main);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="light"] .nps-btn {
  background: #ffffff;
  border-color: #e2e8f0;
}
.nps-btn:hover {
  transform: scale(1.08);
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
}
.nps-btn.selected {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-color: transparent;
  transform: scale(1.1);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}
.nps-btn.detractor.selected {
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.4);
}
.nps-btn.passive.selected {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}
.nps-btn.promoter.selected {
  background: linear-gradient(135deg, #10b981, #34d399);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.nps-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.nps-feedback-badge {
  text-align: center;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--card-border);
}
[data-theme="light"] .nps-feedback-badge {
  background: #f8fafc;
  border-color: #e2e8f0;
}

/* Optional Respondent Info Accordion */
.accordion-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 0;
  cursor: pointer;
  text-align: left;
}
.accordion-toggle:hover {
  color: var(--primary);
}
.accordion-toggle .toggle-icon {
  transition: transform 0.3s ease;
}
.accordion-toggle.expanded .toggle-icon {
  transform: rotate(180deg);
}

.accordion-body {
  display: none;
  padding-top: 16px;
}
.accordion-body.open {
  display: block;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}
.text-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  transition: all 0.2s ease;
}
.text-input:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Submit Actions */
.submit-container {
  margin-top: 36px;
  text-align: center;
}
.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  padding: 18px 32px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  border: none;
  border-radius: var(--radius-lg);
  color: #ffffff;
  font-size: 1.12rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.submit-btn:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 15px 35px rgba(99, 102, 241, 0.55);
}
.submit-btn:active {
  transform: translateY(0) scale(0.99);
}
.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Loading Spinner */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Thank You Success Screen */
.thankyou-card {
  display: none;
  text-align: center;
  padding: 60px 40px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: fadeInScale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.thankyou-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: bounce 2s infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.thankyou-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text-main);
}
.thankyou-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 32px;
  line-height: 1.6;
}
.thankyou-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.btn-secondary {
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}
[data-theme="light"] .btn-secondary {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}
[data-theme="light"] .btn-secondary:hover {
  background: #e2e8f0;
}

/* Footer */
.survey-footer {
  margin-top: 60px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.footer-links {
  display: flex;
  gap: 16px;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}
.footer-links a:hover {
  color: var(--primary);
}

/* Toast Message */
.toast-notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 99px;
  backdrop-filter: blur(12px);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 999;
}
.toast-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
