/* ===== CSS Variables ===== */
:root {
  --primary: #1a365d;
  --primary-light: #2b6cb0;
  --primary-lighter: #ebf4ff;
  --accent: #3b82f6;
  --accent-light: #93c5fd;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Progress Header ===== */
.progress-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.progress-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-mark {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--primary);
  flex-shrink: 0;
}

.progress-info {
  flex: 1;
}

.progress-info span {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary-light));
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease;
}

/* ===== Survey Container ===== */
.survey-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ===== Intro Screen ===== */
.intro-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}

.intro-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 560px;
  width: 100%;
  animation: fadeInUp 0.6s ease;
}

.intro-icon {
  margin-bottom: 24px;
}

.intro-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.4;
  margin-bottom: 20px;
}

.intro-desc {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-align: left;
}

.intro-body {
  text-align: left;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 28px;
}

.intro-body strong {
  color: var(--primary);
}

.intro-body p {
  margin-bottom: 10px;
}

.intro-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.meta-item svg {
  flex-shrink: 0;
}

/* ===== Form Steps ===== */
.form-step {
  display: none;
  animation: fadeInUp 0.4s ease;
}

.form-step.active {
  display: block;
}

.step-header {
  margin-bottom: 32px;
}

.step-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--primary-lighter);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.step-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.step-desc {
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== Sections ===== */
.step-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ===== Field Groups ===== */
.field-group {
  margin-bottom: 24px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.required {
  color: var(--danger);
  font-weight: 400;
}

.optional {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}

.input-stack {
  margin-top: 10px;
}

.field-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.5;
}

.field-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}

.field-input:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.field-textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
  resize: vertical;
  min-height: 80px;
}

.field-textarea:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ===== Input with Unit ===== */
.input-with-unit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-unit .field-input {
  flex: 1;
}

.unit {
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ===== Radio Cards ===== */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-card {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-label {
  display: inline-block;
  padding: 10px 18px;
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
  user-select: none;
}

.radio-card input[type="radio"]:checked + .radio-label {
  background: var(--primary-lighter);
  border-color: var(--accent);
  color: var(--primary);
  font-weight: 500;
}

.radio-card:hover .radio-label {
  border-color: var(--accent-light);
}

/* ===== Checkbox Cards ===== */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkbox-card {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.checkbox-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-card span {
  display: inline-block;
  padding: 10px 18px;
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
  user-select: none;
}

.checkbox-card input[type="checkbox"]:checked + span {
  background: var(--primary-lighter);
  border-color: var(--accent);
  color: var(--primary);
  font-weight: 500;
}

.checkbox-card:hover span {
  border-color: var(--accent-light);
}

/* ===== File Upload ===== */
.file-upload-area {
  margin-top: 4px;
}

.upload-placeholder {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-input);
}

.upload-placeholder:hover {
  border-color: var(--accent-light);
  background: var(--primary-lighter);
}

.upload-placeholder p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.upload-placeholder span {
  font-size: 12px;
  color: var(--text-muted);
}

.upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item .remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ===== Channel Grid ===== */
.channel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.channel-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.channel-item label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Priority List ===== */
.priority-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.priority-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.priority-item:hover {
  border-color: var(--accent-light);
}

.priority-label {
  font-size: 14px;
  color: var(--text-primary);
  flex: 1;
}

.priority-input {
  width: 70px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font);
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.priority-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== Goal List ===== */
.goal-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.goal-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.goal-num {
  width: 28px;
  height: 28px;
  background: var(--primary-lighter);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== Navigation ===== */
.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 24px;
}

.nav-spacer {
  flex: 1;
}

.btn-primary {
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(26, 54, 93, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(26, 54, 93, 0.3);
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-lg {
  padding: 16px 40px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

.btn-ghost {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-secondary);
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-ghost:hover {
  background: var(--bg-input);
  border-color: var(--text-muted);
}

.btn-submit {
  background: linear-gradient(135deg, var(--success), #059669);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-submit:hover {
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

/* ===== Success Screen ===== */
.success-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}

.success-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 480px;
  width: 100%;
  animation: fadeInUp 0.6s ease;
}

.success-icon {
  margin-bottom: 24px;
  animation: scaleIn 0.5s ease 0.2s both;
}

.success-card h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.success-card p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.success-sub {
  font-size: 13px !important;
  color: var(--text-muted) !important;
  margin-bottom: 24px !important;
}

.success-meta {
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  text-align: left;
}

/* ===== Validation ===== */
.field-input.error,
.field-textarea.error {
  border-color: var(--danger);
  background: #fef2f2;
}

.error-msg {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===== Loading Spinner ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .survey-container {
    padding: 20px 16px 60px;
  }

  .intro-card {
    padding: 32px 24px;
  }

  .intro-title {
    font-size: 22px;
  }

  .intro-meta {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .step-section {
    padding: 20px 16px;
  }

  .field-row,
  .field-row-3 {
    grid-template-columns: 1fr;
  }

  .channel-grid {
    grid-template-columns: 1fr;
  }

  .radio-group,
  .checkbox-group {
    flex-direction: column;
  }

  .radio-label,
  .checkbox-card span {
    display: block;
    text-align: center;
  }

  .step-header h2 {
    font-size: 20px;
  }

  .step-nav {
    flex-direction: column-reverse;
    gap: 12px;
  }

  .step-nav .btn-primary,
  .step-nav .btn-ghost,
  .step-nav .nav-spacer {
    width: 100%;
    text-align: center;
  }

  .priority-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .priority-input {
    width: 100%;
  }
}

/* ===== Admin Page Styles ===== */
.admin-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.admin-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.admin-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-num {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.submission-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.submission-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.submission-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-light);
}

.submission-card .card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.submission-card .card-company {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
}

.submission-card .card-time {
  font-size: 12px;
  color: var(--text-muted);
}

.submission-card .card-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.submission-card .card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== Detail Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 800px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
}

.modal-sm {
  max-width: 420px;
}

.token-hint {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.6;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-input);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.modal-body {
  padding: 28px;
  max-height: 70vh;
  overflow-y: auto;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.detail-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.detail-label {
  color: var(--text-muted);
  font-weight: 500;
}

.detail-value {
  color: var(--text-primary);
  word-break: break-all;
}

.detail-value.empty {
  color: var(--text-muted);
  font-style: italic;
}

.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-danger {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-secondary {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--border);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 15px;
}

@media (max-width: 640px) {
  .admin-stats {
    flex-direction: column;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .submission-card .card-meta {
    flex-direction: column;
    gap: 4px;
  }
}
