/* ==========================================================================
   POLL Application - Modern Survey & Admin Design System (style.css)
   ========================================================================== */

:root {
  /* Color Palette - Dark Theme Default */
  --bg-main: #0a0e17;
  --bg-surface: #111827;
  --bg-surface-elevated: #1a2336;
  --bg-surface-glass: rgba(17, 24, 39, 0.75);
  --bg-surface-glass-border: rgba(255, 255, 255, 0.08);
  --bg-card: #151d2f;
  --bg-card-hover: #1c273e;
  --bg-card-active: rgba(99, 102, 241, 0.15);
  --bg-input: #0c121e;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-on-accent: #ffffff;

  --accent-primary: #6366f1;       /* Indigo */
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #06b6d4;     /* Cyan */
  --accent-success: #10b981;       /* Emerald */
  --accent-warning: #f59e0b;       /* Amber */
  --accent-danger: #ef4444;        /* Rose */

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.25);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-surface-glass: rgba(255, 255, 255, 0.85);
  --bg-surface-glass-border: rgba(0, 0, 0, 0.08);
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-card-active: rgba(99, 102, 241, 0.08);
  --bg-input: #f8fafc;

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

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-focus: #6366f1;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.12);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Top Navigation Bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.nav-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.4);
}

.nav-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ==========================================================================
   SURVEY PAGE CONTAINER
   ========================================================================== */
.survey-wrapper {
  max-width: 800px;
  margin: 2.5rem auto;
  padding: 0 1.25rem 4rem 1.25rem;
}

.survey-hero {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}

.survey-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #818cf8;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.survey-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.survey-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto;
}

/* Survey Progress Bar */
.progress-container {
  margin-bottom: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px;
  box-shadow: var(--shadow-sm);
}

.progress-bar {
  height: 8px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

/* Question Cards */
.question-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

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

.question-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.q-num {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
}

.q-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.q-help {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: normal;
  margin-left: 0.3rem;
}

/* Option Grid (Radios & Checkboxes) */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.option-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.option-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.4);
}

.option-card input[type="radio"],
.option-card input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 17px;
  height: 17px;
  cursor: pointer;
}

.option-card.selected {
  background: var(--bg-card-active);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.option-label {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-main);
  flex: 1;
}

/* Text Inputs & Textareas */
.text-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
  transition: var(--transition-fast);
}

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

.textarea-custom {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

/* NPS Rating Selector (0 ~ 10) */
.nps-selector {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.nps-buttons-row {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 0.4rem;
}

.nps-btn {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nps-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.nps-btn.selected {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.5);
  transform: scale(1.05);
}

.nps-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0 0.2rem;
}

/* Submit Actions */
.survey-submit-bar {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

.btn-submit {
  padding: 0.95rem 3rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.4);
  transition: all var(--transition-normal);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.55);
}

.btn-submit:active {
  transform: translateY(0);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: var(--transition-fast);
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-primary-hover);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-danger {
  background: var(--accent-danger);
  color: white;
}

/* ==========================================================================
   ADMIN DASHBOARD
   ========================================================================== */
.admin-wrapper {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem 4rem 1.5rem;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.dashboard-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Metric KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-primary);
}

.kpi-card.kpi-success::before { background: var(--accent-success); }
.kpi-card.kpi-warning::before { background: var(--accent-warning); }
.kpi-card.kpi-cyan::before { background: var(--accent-secondary); }

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
}

.kpi-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.chart-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-bars-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.stat-bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
}

.stat-bar-track {
  height: 8px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  transition: width 0.5s ease;
}

/* Responses Data Table */
.data-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-card-header {
  padding: 1.25rem 1.5rem;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.table-responsive {
  overflow-x: auto;
}

.table-custom {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.table-custom th {
  background: var(--bg-surface-elevated);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table-custom td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  white-space: nowrap;
}

.table-custom tbody tr:hover {
  background: var(--bg-card-hover);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-nps-promoter {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-nps-passive {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-nps-detractor {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.85rem 1.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Success Celebration Modal */
.celebrate-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.celebrate-modal.active {
  display: flex;
}

.celebrate-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-glass-border);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 640px) {
  .nps-buttons-row {
    grid-template-columns: repeat(6, 1fr);
  }
  .nps-btn {
    height: 40px;
    font-size: 0.9rem;
  }
}
