/* ==========================================================================
   POLL Survey System - Modern Dark & Light Theme Styling
   ========================================================================== */

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

:root,
[data-theme="dark"] {
  --font-main: 'Plus Jakarta Sans', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Dark Theme Colors */
  --bg-main: #0b0f19;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #0b0f19 75%);
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 38, 58, 0.85);
  --bg-input: rgba(15, 23, 42, 0.6);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.8);
  --border-active: #6366f1;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  
  --text-title: #f8fafc;
  --text-body: #cbd5e1;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-card: 0 12px 36px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.3);

  --ambient-color: rgba(99, 102, 241, 0.18);
  --ambient-sub: rgba(6, 182, 212, 0.08);

  --title-gradient: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
  --progress-bg: rgba(15, 23, 42, 0.85);
  --option-bg: rgba(15, 23, 42, 0.5);
  --option-hover-bg: rgba(28, 38, 58, 0.85);
  --option-selected-bg: rgba(99, 102, 241, 0.15);
  --nps-btn-bg: rgba(15, 23, 42, 0.6);
  --toggle-btn-bg: rgba(255, 255, 255, 0.08);
  --toggle-btn-border: rgba(255, 255, 255, 0.12);
  --toggle-btn-text: #cbd5e1;
}

[data-theme="light"] {
  /* Light Theme Colors */
  --bg-main: #f1f5f9;
  --bg-gradient: radial-gradient(circle at 50% 0%, #e0e7ff 0%, #f1f5f9 75%);
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-hover: rgba(248, 250, 252, 0.98);
  --bg-input: rgba(255, 255, 255, 0.95);
  --border-subtle: rgba(15, 23, 42, 0.09);
  --border-focus: rgba(79, 70, 229, 0.75);
  --border-active: #4f46e5;
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.25);
  --accent-cyan: #0284c7;
  --accent-purple: #7c3aed;
  --accent-emerald: #059669;
  
  --text-title: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-dim: #475569;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 10px 30px -4px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 25px rgba(79, 70, 229, 0.15);

  --ambient-color: rgba(99, 102, 241, 0.12);
  --ambient-sub: rgba(6, 182, 212, 0.06);

  --title-gradient: linear-gradient(135deg, #0f172a 30%, #4338ca 100%);
  --progress-bg: rgba(255, 255, 255, 0.9);
  --option-bg: rgba(248, 250, 252, 0.9);
  --option-hover-bg: #ffffff;
  --option-selected-bg: rgba(79, 70, 229, 0.08);
  --nps-btn-bg: #ffffff;
  --toggle-btn-bg: #ffffff;
  --toggle-btn-border: rgba(0, 0, 0, 0.1);
  --toggle-btn-text: #1e293b;
}

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

body {
  font-family: var(--font-main);
  background: var(--bg-main);
  background-image: var(--bg-gradient);
  color: var(--text-body);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 60px;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Background Ambient Glow */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 450px;
  background: radial-gradient(ellipse at center, var(--ambient-color) 0%, var(--ambient-sub) 50%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  transition: background 0.3s ease;
}

/* Header & Container */
.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

/* Survey Top Navigation Bar (Home Link + Theme Toggle) */
.survey-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 10px;
}

.nav-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  background: var(--toggle-btn-bg);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

.nav-back-link:hover {
  color: var(--primary);
  border-color: var(--border-focus);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border-radius: var(--radius-full);
  background: var(--toggle-btn-bg);
  border: 1px solid var(--toggle-btn-border);
  color: var(--toggle-btn-text);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
  user-select: none;
}

.theme-toggle-btn:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.theme-icon-sun,
.theme-icon-moon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

[data-theme="dark"] .theme-icon-moon {
  display: none;
}
[data-theme="dark"] .theme-icon-sun {
  display: inline-block;
  color: #fbbf24;
}

[data-theme="light"] .theme-icon-sun {
  display: none;
}
[data-theme="light"] .theme-icon-moon {
  display: inline-block;
  color: #6366f1;
}

/* Header */
.survey-header {
  text-align: center;
  padding: 24px 0 28px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.survey-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-title);
  line-height: 1.3;
  margin-bottom: 12px;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.survey-subtitle {
  font-size: 15px;
  color: var(--text-dim);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Sticky Progress Bar */
.progress-container {
  position: sticky;
  top: 16px;
  z-index: 50;
  margin-bottom: 30px;
  background: var(--progress-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-card);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.progress-label {
  color: var(--text-title);
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-pct {
  color: var(--primary);
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(125, 125, 125, 0.15);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  border-radius: var(--radius-full);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Survey Card Section */
.survey-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.question-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.3s ease;
}

.question-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
}

.question-card.active {
  border-color: var(--border-focus);
  box-shadow: 0 12px 36px -4px rgba(99, 102, 241, 0.2), 0 0 0 1px var(--primary);
}

.question-header {
  margin-bottom: 20px;
}

.q-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.q-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-title);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.q-title .required-star {
  color: #f43f5e;
  font-size: 16px;
  margin-left: 2px;
}

.q-subtitle {
  font-size: 13.5px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Option Grids & Cards */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.options-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Option Tile (Radio / Checkbox) */
.option-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--option-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.option-tile:hover {
  background: var(--option-hover-bg);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

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

.custom-indicator {
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.option-tile.checkbox-tile .custom-indicator {
  border-radius: 6px;
}

.custom-indicator::after {
  content: '';
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0);
  transition: all 0.2s ease;
}

.option-tile.checkbox-tile .custom-indicator::after {
  width: 10px;
  height: 6px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  border-radius: 0;
  transform: rotate(-45deg) scale(0);
  margin-top: -2px;
  background: transparent;
}

.option-tile.selected {
  background: var(--option-selected-bg);
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.18);
}

.option-tile.selected .custom-indicator {
  background: var(--primary);
  border-color: var(--primary);
}

.option-tile.selected .custom-indicator::after {
  opacity: 1;
  transform: scale(1);
}

.option-tile.checkbox-tile.selected .custom-indicator::after {
  transform: rotate(-45deg) scale(1);
}

.option-label {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-body);
  flex: 1;
}

.option-tile.selected .option-label {
  color: var(--text-title);
  font-weight: 600;
}

/* Other Input Field */
.other-input-wrap {
  margin-top: 10px;
  display: none;
  animation: fadeIn 0.3s ease;
}

.other-input-wrap.visible {
  display: block;
}

.text-input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-title);
  font-family: var(--font-main);
  font-size: 14.5px;
  outline: none;
  transition: all 0.2s ease;
}

.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.text-input::placeholder {
  color: var(--text-muted);
}

/* Textarea with Character Count */
.textarea-wrapper {
  position: relative;
}

.custom-textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-title);
  font-family: var(--font-main);
  font-size: 14.5px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: all 0.2s ease;
}

.custom-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.char-counter {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* NPS Scale 0 - 10 Component */
.nps-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nps-scale-grid {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 6px;
}

.nps-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nps-btn-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-body);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.nps-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  transform: translateY(-2px);
  color: var(--text-title);
}

/* NPS Colors on active */
.nps-btn.detractor.active {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.nps-btn.passive.active {
  background: #f59e0b !important;
  border-color: #f59e0b !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.nps-btn.promoter.active {
  background: #10b981 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.nps-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-dim);
  font-weight: 500;
  padding: 0 4px;
}

/* Form Actions / Submit Button */
.form-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.btn-submit {
  width: 100%;
  padding: 18px 28px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s ease;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.45);
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-footer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 4px;
}

.form-footer-nav a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.form-footer-nav a:hover {
  color: var(--primary);
}

/* Success View / Thank You Screen */
.success-screen {
  display: none;
  text-align: center;
  padding: 60px 30px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  animation: zoomIn 0.4s ease forwards;
}

.success-icon-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.15));
  border: 2px solid #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  color: #10b981;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

.success-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-title);
  margin-bottom: 12px;
}

.success-desc {
  font-size: 15px;
  color: var(--text-dim);
  max-width: 500px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.success-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-secondary {
  padding: 12px 24px;
  background: var(--toggle-btn-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-title);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: var(--option-hover-bg);
  border-color: var(--border-focus);
}

/* Validation Alert */
.alert-box {
  display: none;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  margin-bottom: 20px;
  animation: shake 0.4s ease;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .survey-title {
    font-size: 24px;
  }
  .question-card {
    padding: 20px;
  }
  .options-grid {
    grid-template-columns: 1fr;
  }
  .nps-scale-grid {
    gap: 4px;
  }
  .nps-btn {
    font-size: 13px;
  }
}
