/* 기본 스타일 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-color: #1e293b;
  --border-color: #e2e8f0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background: var(--bg-color);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 네비게이션 */
.navbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

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

/* 메인 컨텐츠 */
main {
  padding: 2rem 0;
  min-height: calc(100vh - 200px);
}

/* 히어로 섹션 */
.hero {
  text-align: center;
  padding: 4rem 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
}

/* 기능 카드 */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.feature-card {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-card i {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.feature-card h3 {
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.feature-card p {
  color: var(--secondary-color);
  font-size: 0.95rem;
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s;
}

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

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

.btn-secondary:hover {
  background: #475569;
}

.button-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

/* 섹션 */
.action-section,
.info-section {
  background: var(--card-bg);
  padding: 3rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  text-align: center;
}

.action-section h2,
.info-section h2 {
  margin-bottom: 2rem;
  color: var(--text-color);
}

/* 평가기관 */
.bureaus {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.bureau-item {
  padding: 1.5rem;
  background: var(--bg-color);
  border-radius: 8px;
}

.bureau-item strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
  font-size: 1.1rem;
}

.bureau-item p {
  color: var(--secondary-color);
  font-size: 0.9rem;
}

/* 시뮬레이터 */
.simulator-container {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.simulator-container h1 {
  margin-bottom: 2rem;
  text-align: center;
  color: var(--text-color);
}

/* 탭 */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
}

.tab-btn {
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  color: var(--secondary-color);
  cursor: pointer;
  transition: all 0.3s;
}

.tab-btn:hover {
  color: var(--primary-color);
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.tab-content {
  padding: 2rem 0;
}

.tab-content.hidden {
  display: none;
}

/* 폼 */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-group input[type="checkbox"] {
  margin-right: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.help-text {
  color: var(--secondary-color);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* 결과 표시 */
.result-card {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.grade-display {
  text-align: center;
  padding: 3rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.grade-display .grade {
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.grade-display .description {
  font-size: 1.2rem;
  opacity: 0.95;
}

.rating-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.info-item {
  padding: 1.5rem;
  background: var(--bg-color);
  border-radius: 8px;
  text-align: center;
}

.info-item .label {
  font-size: 0.9rem;
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
}

.info-item .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
}

/* 경고 */
.warnings {
  margin-top: 2rem;
}

.warning-item {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  border-left: 4px solid;
}

.warning-item.critical {
  background: #fee;
  border-color: var(--danger-color);
}

.warning-item.high {
  background: #fff3cd;
  border-color: var(--warning-color);
}

.warning-item.medium {
  background: #e7f3ff;
  border-color: #0ea5e9;
}

.warning-item .warning-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* 로딩 */
.loading {
  text-align: center;
  padding: 3rem;
  font-size: 1.5rem;
  color: var(--primary-color);
}

.loading i {
  margin-right: 0.5rem;
}

/* 숨김 */
.hidden {
  display: none !important;
}

/* 푸터 */
footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  text-align: center;
  margin-top: 4rem;
}

footer p {
  color: var(--secondary-color);
  margin: 0.5rem 0;
}

.disclaimer {
  font-size: 0.85rem;
  font-style: italic;
}

/* 반응형 */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.8rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }
  
  .features {
    grid-template-columns: 1fr;
  }
  
  .nav-links {
    gap: 1rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* 활동성 필수 항목 스타일 */
small.help-text {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--secondary-color);
  line-height: 1.4;
}

.required-field {
  border-left: 3px solid var(--danger-color);
}

.required-field:focus {
  border-left-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* 3개년 입력 탭 스타일 */
.year-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  overflow-x: auto;
}

.year-tab-btn {
  padding: 0.875rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--secondary-color);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  white-space: nowrap;
  position: relative;
}

.year-tab-btn:hover {
  background: rgba(37, 99, 235, 0.05);
  color: var(--primary-color);
}

.year-tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.08);
}

.year-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-color);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* 3개년 컨테이너 */
#yearContainer-previous1,
#yearContainer-previous2 {
  display: none;
}

#yearContainer-previous1.active,
#yearContainer-previous2.active {
  display: block;
  animation: fadeInSlide 0.4s ease;
}

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

/* 파일 업로드 버튼 */
.upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.2);
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
}

.upload-btn i {
  font-size: 1.2rem;
}

/* 인식 결과 검토 모달 */
.review-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

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

.review-content {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  max-width: 900px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
}

.review-header h3 {
  margin: 0;
  color: #1e293b;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #64748b;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.close-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.confidence-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.confidence-high {
  background: #d1fae5;
  color: #065f46;
}

.confidence-medium {
  background: #fef3c7;
  color: #92400e;
}

.confidence-low {
  background: #fee2e2;
  color: #991b1b;
}

.warning-list {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}

.warning-list h4 {
  margin: 0 0 0.5rem 0;
  color: #92400e;
}

.warning-list ul {
  margin: 0;
  padding-left: 1.5rem;
  color: #78350f;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.review-field {
  background: #f8fafc;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.review-field label {
  display: block;
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.review-field input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 0.95rem;
}

.review-field.modified {
  border-color: #3b82f6;
  background: #eff6ff;
}

.review-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid #e2e8f0;
}

.review-actions button {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.review-actions .btn-confirm {
  background: #10b981;
  color: white;
}

.review-actions .btn-confirm:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.review-actions .btn-cancel {
  background: #e2e8f0;
  color: #475569;
}

.review-actions .btn-cancel:hover {
  background: #cbd5e1;
}

/* 입력 단위 선택 */
#inputUnit {
  padding: 0.5rem 0.75rem;
  border: 2px solid #f59e0b;
  border-radius: 6px;
  background: white;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #92400e;
}

#inputUnit:hover {
  border-color: #d97706;
  background: #fffbeb;
}

#inputUnit:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* 숫자 입력 필드 개선 */
input[type="number"] {
  text-align: right;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

input[type="number"]::placeholder {
  text-align: right;
  font-family: inherit;
}

/* 단위 표시 강조 */
.unit-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: #fef3c7;
  border: 2px solid #fbbf24;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #92400e;
}

