:root {
  --primary: #4361ee;
  --secondary: #3f37c9;
  --success: #4cc9f0;
  --dark: #242f3e;
  --light: #f8f9fa;
  --border-radius: 0.5rem;
  --box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

body {
  font-family: 'Noto Sans KR', 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 네비게이션 바 스타일 */
.main-navbar {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.5px;
  color: white !important;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  vertical-align: middle;
}

/* 히어로 배너 */
.hero-banner {
  background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
  color: white;
  padding: 4rem 0;
  margin-bottom: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.hero-banner h1 {
  font-weight: 800;
  letter-spacing: -0.5px;
}

.text-white-90 {
  color: rgba(255, 255, 255, 0.9);
}

.process-main-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.process-main-image:hover {
  transform: translateY(-5px);
}

/* 섹션 타이틀 */
.section-title {
  color: var(--dark);
  font-weight: 700;
  position: relative;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
}

/* 입력 모드 탭 스타일 */
.input-mode-tabs {
  margin-bottom: 2rem;
}

.tabs-container {
  display: flex;
  background-color: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 1rem;
  font-weight: 600;
  color: var(--dark);
  transition: var(--transition);
  cursor: pointer;
  outline: none;
  position: relative;
  overflow: hidden;
}

.tab-btn:hover {
  background-color: rgba(67, 97, 238, 0.05);
}

.tab-btn.active {
  color: var(--primary);
  background-color: rgba(67, 97, 238, 0.1);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
}

.tab-btn i {
  margin-right: 0.5rem;
}

/* 인터랙티브 공정 맵 스타일 */
.interactive-process-map-container {
  margin-bottom: 3rem;
}

.process-map-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
}

.process-map-image-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 50%; /* 이미지 비율에 맞게 조정 (2:1 비율) */
  background-color: #f8f9fb;
  overflow: hidden;
}

.process-map-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* cover에서 contain으로 변경하여 이미지가 온전히 보이도록 함 */
  transition: transform 0.3s ease;
}

.process-point-marker {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--secondary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
  z-index: 10;
  border: 2px solid white;
}

.process-point-marker:hover {
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.process-point-marker.active {
  background-color: var(--primary);
  box-shadow: 0 0 0 5px rgba(67, 97, 238, 0.3);
}

.process-popover {
  position: absolute;
  background-color: white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border: none;
  border-radius: 8px;
  width: 300px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.process-popover.show {
  display: block;
}

.popover-header {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.popover-body {
  padding: 1rem;
}

.process-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
  border-color: var(--primary);
}

.form-label.small {
  font-size: 0.875rem;
  color: var(--dark);
  margin-bottom: 0.25rem;
}

.input-group-sm {
  margin-bottom: 0.5rem;
}

.process-map-controls {
  background-color: white;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--box-shadow);
}

.process-map-info {
  color: var(--dark);
}

.process-quick-view {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.quick-view-item {
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
  min-height: 60px;
  justify-content: center;
  border: 1px solid transparent;
}

.quick-view-item.has-value {
  background-color: rgba(67, 97, 238, 0.1);
  border-color: rgba(67, 97, 238, 0.2);
}

.quick-view-label {
  font-size: 12px;
  color: #6c757d;
  margin-bottom: 0.2rem;
}

.quick-view-value {
  font-weight: 600;
  color: var(--dark);
  font-size: 14px;
}

.quick-view-item.has-value .quick-view-value {
  color: var(--primary);
}

/* 기본 입력 폼 스타일 */
.process-label-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 600;
  margin-right: 0.5rem;
}

.form-label {
  font-weight: 500;
  color: var(--dark);
}

/* 로딩 스타일 */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin: 2rem 0;
}

.spinner-border {
  color: var(--primary);
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
  display: inline-block;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
  to { transform: rotate(360deg); }
}

/* 결과 헤더 스타일 */
.result-header {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  color: white;
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 카드 스타일 */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  overflow: hidden;
  margin-bottom: 2rem;
  background-color: white;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  color: white;
  font-weight: 600;
  padding: 1rem 1.5rem;
  border: none;
}

.card-body {
  padding: 1.5rem;
}

/* 차트 컨테이너 */
.chart-container {
  background-color: white;
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

/* 테이블 스타일 */
.table {
  border-radius: 0.4rem;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.table thead th {
  background-color: #f2f5ff;
  color: var(--dark);
  font-weight: 600;
  padding: 1rem;
  border-top: none;
}

.table td {
  padding: 1rem;
  vertical-align: middle;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: #f8f9ff;
}

/* 배지 스타일 */
.badge {
  padding: 0.5em 0.8em;
  font-weight: 500;
}

/* 푸터 스타일 */
footer {
  margin-top: auto;
  background-color: var(--dark);
  color: white;
}

.footer-top {
  background: linear-gradient(135deg, #242f3e 0%, #1e2a3a 100%);
  padding: 3rem 0;
}

.footer-top .row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.footer-column {
  padding: 0 1rem;
}

.footer-column:not(:last-child) {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom {
  background-color: #1a242f;
  font-size: 0.9rem;
  padding: 1rem 0;
}

footer h5 {
  font-weight: 600;
  margin-bottom: 1.5rem;
  position: relative;
  padding-bottom: 0.5rem;
}

footer h5::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--primary);
}

footer a {
  color: rgba(255, 255, 255, 0.7);
  transition: var(--transition);
  text-decoration: none;
}

footer a:hover {
  color: white;
  text-decoration: none;
}

/* 유틸리티 클래스 */
.d-none {
  display: none !important;
}

.d-flex {
  display: flex !important;
}

/* 반응형 스타일 */
@media (max-width: 991px) {
  .hero-banner {
    padding: 2rem 0;
  }
  
  .process-main-image {
    margin-top: 1rem;
  }
  
  .footer-top {
    padding: 2rem 0;
  }
  
  .process-map-image-container {
    padding-bottom: 70%; /* 모바일에서 이미지 비율 조정 */
  }
  
  .tabs-container {
    flex-direction: column;
  }
  
  .tab-btn {
    border-bottom: 1px solid rgba(0,0,0,0.1);
  }
}

@media (max-width: 768px) {
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  .card {
    margin-bottom: 1rem;
  }
  
  .card-header {
    padding: 0.75rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .hero-banner {
    padding: 1.5rem 0;
  }
  
  .hero-banner h1 {
    font-size: 1.75rem;
  }
  
  .process-main-image {
    margin-top: 1rem;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
  }
  
  .process-point-marker {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }
  
  .process-map-controls {
    margin-top: 1rem;
  }
  
  .quick-view-item {
    font-size: 0.8rem;
  }
  
  .quick-view-label {
    font-size: 0.7rem;
  }
  
  .quick-view-value {
    font-size: 0.7rem;
  }
  
  .tabs-container {
    margin-bottom: 1rem;
  }
  
  .tab-btn {
    padding: 0.75rem;
    font-size: 0.9rem;
  }
  
  .footer-top .row {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .footer-column:not(:last-child) {
    margin-bottom: 0;
  }
  
  .process-popover {
    width: 250px;
    max-width: 90vw;
  }
  
  .section-title {
    font-size: 1.25rem;
  }
  
  .process-map-info {
    font-size: 0.85rem;
  }
  
  .process-map-info .small {
    font-size: 0.75rem;
  }
  
  .d-flex.justify-content-between {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start !important;
  }
  
  .d-flex.justify-content-between .d-flex {
    width: 100%;
    justify-content: space-between !important;
  }
  
  #process-form .btn, #basic-form .btn {
    font-size: 0.85rem;
    padding: 0.375rem 0.75rem;
  }
  
  .row.row-cols-3 {
    --bs-gutter-x: 0.5rem;
  }

  .process-quick-view {
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  
  .quick-view-category-label {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }
  
  input[type="number"] {
    font-size: 16px !important; /* iOS에서 자동 확대 방지 */
    -webkit-appearance: none;
    margin: 0;
    -moz-appearance: textfield;
  }
  
  .form-control:focus {
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.25);
  }
  
  .process-popover {
    z-index: 1100;
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  }
  
  .popover-header {
    font-size: 0.95rem;
    padding: 0.6rem 1rem;
  }
  
  .process-popover .form-label {
    font-size: 0.8rem;
  }
  
  .process-popover .input-group-sm {
    margin-bottom: 0.5rem;
  }
  
  .process-input {
    padding: 0.4rem 0.6rem;
    height: 38px; /* 모바일에서 탭하기 쉽게 높이 증가 */
  }
  
  /* 팝오버 버튼 추가 */
  .popover-footer {
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
  }
  
  .input-group-text {
    font-size: 0.8rem;
  }
  
  /* 모바일에서 터치 타겟 영역 증가 */
  .btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* 스크롤 방지 (팝오버 작동할 때) */
body.popover-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* 모바일 터치 최적화 */
@media (max-width: 576px) {
  .navbar-brand {
    font-size: 1rem;
  }
  
  .navbar-icon {
    width: 20px;
    height: 20px;
  }
  
  .section-title {
    font-size: 1.2rem;
  }
  
  .process-map-image-container {
    padding-bottom: 90%; /* 더 작은 화면에서 이미지 비율 조정 */
  }
  
  .process-point-marker {
    width: 32px; /* 더 큰 터치 영역 */
    height: 32px;
    font-size: 12px;
  }
  
  .process-point-marker:hover {
    transform: translate(-50%, -50%) scale(1.1);
  }
  
  .process-popover {
    width: 220px;
  }
  
  .card-header h5 {
    font-size: 1rem;
  }
  
  .table {
    font-size: 0.75rem;
  }
  
  .chart-container {
    height: 220px;
  }
  
  footer h5 {
    font-size: 1rem;
  }
  
  .footer-top, .footer-bottom {
    padding: 1.5rem 0;
  }
  
  .badge {
    padding: 0.35em 0.55em;
    font-size: 0.7em;
  }
  
  #results .card-body {
    padding: 0.75rem;
  }
  
  .quick-view-item {
    min-height: 45px;
  }
}

/* 퀵뷰 카테고리 레이블 스타일 */
.quick-view-category-label {
  font-size: 14px;
  color: var(--dark);
  margin-bottom: 0.8rem;
  border-left: 3px solid var(--primary);
  padding-left: 10px;
  display: flex;
  align-items: center;
}

.quick-view-category-label i {
  color: var(--primary);
}

/* 폼 카테고리 레이블 스타일 */
.form-category-label {
  color: var(--dark);
  font-weight: 600;
  padding-left: 10px;
  border-left: 3px solid var(--primary);
  display: flex;
  align-items: center;
}

.form-category-label i {
  color: var(--primary);
}

/* Label B 스타일 차별화 */
.process-label-indicator.label-b {
  background-color: var(--secondary);
}

/* 퀵뷰 카테고리별 스타일 차별화 */
#quick-view-container-b .quick-view-item.has-value {
  background-color: rgba(63, 55, 201, 0.1);
  border-color: rgba(63, 55, 201, 0.2);
}

#quick-view-container-b .quick-view-item.has-value .quick-view-value {
  color: var(--secondary);
}

/* FontAwesome 아이콘 스타일 */
.fas {
  font-size: 1.2rem;
  vertical-align: middle;
}

.section-title .fas {
  font-size: 1.4rem;
}

.navbar-brand .fas {
  font-size: 1.3rem;
}

#results .row {
  display: flex;
  flex-wrap: wrap;
}

#results .row > div {
  display: flex;
  flex-direction: column;
}

#results .card {
  flex: 1;
  height: 100%;
}

#results .card-body {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#results .chart-container {
  flex-shrink: 0;
}

#results #history-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#results #no-history {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#results #history-table {
  margin-bottom: 0;
}

.recommendation-cards {
  display: flex;
  gap: 1rem;
}

.recommendation-cards .card {
  flex: 1;
  height: 100%;
  min-height: 400px;
}

.recommendation-table-container {
  max-height: 300px;
  overflow-y: auto;
}

.recommendation-chart-container {
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 로딩 오버레이 스타일 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
  background-color: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.loading-text {
  font-size: 1.1rem;
  color: var(--dark);
  margin-top: 1rem;
  font-weight: 500;
}

/* 스피너 크기 조정 */
.loading-content .spinner-border {
  width: 3rem;
  height: 3rem;
  color: var(--primary);
}

/* 모바일 환경 최적화 */
@media (max-width: 768px) {
  .loading-text {
    font-size: 1rem;
  }
  
  .loading-content .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
  }
} 