/* ==========================================================================
   Clean Modern Light Theme Design System
   ========================================================================== */

:root {
  --bg-gradient: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --card-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
  
  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-secondary: #0284c7;
  --accent-glow: rgba(37, 99, 235, 0.12);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  
  --success-color: #10b981;
  --danger-color: #ef4444;
  
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 4px;
  --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  padding-bottom: 60px;
}

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

.header-container {
  max-width: 768px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

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

.progress-container {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  position: absolute;
  bottom: 0;
  left: 0;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-primary);
  transition: width 0.3s ease;
}

/* Main Container */
.container {
  max-width: 768px;
  margin: 20px auto;
  padding: 0 16px;
}

/* Hero Section */
.hero-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
}

.hero-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
}

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

.section-header {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-primary);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid #eff6ff;
}

.section-subheader {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 14px;
  margin-bottom: 12px;
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.question-group {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f1f5f9;
}

.question-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.question-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* Option Controls (Normal Compact Buttons) */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 520px) {
  .options-grid-2col {
    grid-template-columns: repeat(2, 1fr);
  }
}

.option-btn-label {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
  min-height: 42px;
}

.option-btn-label:hover {
  border-color: var(--accent-primary);
  background: #f8fafc;
}

.option-btn-label input[type="radio"],
.option-btn-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #94a3b8;
  border-radius: 50%;
  margin-right: 10px;
  outline: none;
  position: relative;
  flex-shrink: 0;
  background: #fff;
  cursor: pointer;
}

.option-btn-label input[type="checkbox"] {
  border-radius: 4px;
}

.option-btn-label input[type="radio"]:checked,
.option-btn-label input[type="checkbox"]:checked {
  border-color: var(--accent-primary);
  background-color: var(--accent-primary);
}

.option-btn-label input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}

.option-btn-label input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: -3px;
  left: 2px;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
}

.option-btn-label:has(input:checked) {
  border-color: var(--accent-primary);
  background: #eff6ff;
  color: var(--accent-primary);
  font-weight: 700;
}

/* ==========================================================================
   Table & Radio Matrix / Scale Formats (완벽 정렬 표 방식)
   ========================================================================== */

.scale-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 10px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.scale-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  text-align: center;
}

.scale-table th, .scale-table td {
  padding: 10px 4px;
  border-right: 1px solid #f1f5f9;
  vertical-align: middle;
}

.scale-table th:last-child, .scale-table td:last-child {
  border-right: none;
}

.scale-table th {
  background: #f8fafc;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--card-border);
  line-height: 1.35;
}

.scale-table th span, .scale-sub-label {
  font-weight: 700 !important;
  color: #0f172a !important;
  display: inline-block;
  margin-top: 2px;
}


.scale-table td {
  background: #ffffff;
  padding: 12px 4px;
}

/* Table Radio Button Container */
.radio-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: 100%;
  gap: 4px;
}

.radio-cell input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #94a3b8;
  border-radius: 50%;
  outline: none;
  position: relative;
  background: #fff;
  cursor: pointer;
  transition: var(--transition-fast);
}

.radio-cell input[type="radio"]:checked {
  border-color: var(--accent-primary);
  background-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.radio-cell input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}

.radio-cell span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.radio-cell input[type="radio"]:checked + span {
  color: var(--accent-primary);
}

/* Matrix Table for Q10 */
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.9rem;
}

.matrix-table th, .matrix-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.matrix-table th {
  background: #f8fafc;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--card-border);
}

.matrix-table tr:hover {
  background: #f8fafc;
}

.matrix-factor-cell {
  text-align: left;
  font-weight: 600;
  color: var(--text-main);
  padding-left: 12px;
}

/* Input Fields & Textarea */
.input-text, .textarea-text {
  width: 100%;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition-fast);
}

.input-text:focus, .textarea-text:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.textarea-text {
  resize: vertical;
  min-height: 80px;
}

/* Dynamic Hidden Class */
.hidden {
  display: none !important;
}

/* Submit & Nav Buttons */
.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-normal);
}

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

.btn-secondary {
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Admin Dashboard */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-primary);
}

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

.filter-select {
  width: 100%;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  margin-bottom: 16px;
}

.action-buttons-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.btn-danger {
  background: #fef2f2;
  border-color: #fca5a5;
  color: var(--danger-color);
}

.stat-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: #ffffff;
}

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

.stat-table th, .stat-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
}

.stat-table th {
  background: #f8fafc;
  color: var(--text-main);
  font-weight: 700;
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 16px;
}
