﻿/**
 * 5개년 손익분석 - UI/UX 통일 스타일 (개선)
 * 가독성과 정보 구조를 최적화하면서 기존 디자인 톤 유지
 */

/* ====== 기본 폼 스타일 ====== */
.pl5y-form {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px 30px;
  border-radius: 16px;
  margin-bottom: 32px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-section {
  background: white;
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section-header {
  font-size: 1.15em;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 28px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ====== 소그룹 섹션 스타일 (매출/성장/비용/분석) ====== */
.subsection {
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
}

.subsection:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.subsection h5 {
  font-size: 0.9em;
  font-weight: 600;
  color: #667eea;
  letter-spacing: 0.3px;
  margin: 0 0 16px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #667eea;
  display: inline-block;
}

/* ====== 입력 필드 그룹 ====== */
.form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  font-size: 0.9em;
  font-weight: 500;
  color: #374151;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.form-label .hint {
  font-size: 0.8em;
  font-weight: 400;
  color: #999;
}

/* ====== 입력 필드 ====== */
.number-input,
.form-group input,
.form-group select {
  padding: 11px 14px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: all 0.2s ease;
  background: white;
  height: 40px;
  line-height: 1.4;
}

.number-input:focus,
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.08);
  background: #fafbff;
}

.form-group input[type="number"] {
  text-align: right;
}

.form-group input::placeholder {
  color: #aaa;
  font-size: 0.88em;
}

/* ====== 다중 입력 행 ====== */
.multi-input-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.multi-input-group {
  display: flex;
  flex-direction: column;
}

.multi-input-group label {
  font-size: 0.8em;
  color: #6b7280;
  margin-bottom: 4px;
}

.multi-input-group input {
  padding: 8px 12px;
  font-size: 0.9em;
}

/* ====== 버튼 영역 ====== */
.button-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  background: white;
  padding: 24px 32px;
  border-radius: 12px;
  margin-top: 28px;
  margin-bottom: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn {
  padding: 12px 36px;
  font-size: 0.95em;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
  flex: 1;
  max-width: 200px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
  flex: 0 1 auto;
  min-width: 120px;
}

.btn-secondary:hover {
  background: #f5f7ff;
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* ====== 결과 영역 ====== */
#pl5yResults {
  background: #f8f9fa;
  padding: 36px;
  border-radius: 12px;
  margin-bottom: 40px;
  margin-top: 32px;
}

/* ====== KPI 카드 (개선) ====== */
#pl5yKpis {
  margin-bottom: 32px;
}

.kpi-section-title {
  font-size: 0.95em;
  font-weight: 600;
  color: #667eea;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #667eea;
  display: inline-block;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 0;
}

.kpi-card {
  background: white;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  border-top: 3px solid #667eea;
  transition: all 0.2s ease;
  text-align: center;
}

.kpi-card:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.kpi-label {
  font-size: 0.8em;
  color: #6b7280;
  margin-bottom: 10px;
  font-weight: 500;
  line-height: 1.4;
  height: 2.2em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-value {
  font-size: 1.3em;
  font-weight: 700;
  color: #667eea;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
  margin: 0;
}

/* ====== 검증 배너 ====== */
#pl5yValidation {
  margin-bottom: 24px;
  margin-top: 24px;
}

#pl5yValidation > div {
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

#pl5yValidation > div:last-child {
  margin-bottom: 0;
}

/* ====== 테이블 (개선) ====== */
#pl5yTable {
  margin-top: 32px;
  margin-bottom: 0;
}

.pl5y-table-title {
  font-size: 0.95em;
  font-weight: 600;
  color: #667eea;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #667eea;
  display: inline-block;
}

.pl5y-table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0 0 0;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.pl5y-table thead {
  background: #667eea;
  color: white;
  font-weight: 600;
  position: relative;
}

.pl5y-table thead th {
  padding: 13px 12px;
  text-align: right;
  font-size: 0.85em;
  letter-spacing: 0.3px;
  border: none;
}

.pl5y-table thead th:first-child {
  text-align: left;
}

.pl5y-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: right;
  font-size: 0.9em;
  color: #555;
  background: white;
}

.pl5y-table tbody td:first-child {
  text-align: left;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
}

.pl5y-table tbody tr:hover {
  background: #f8f9fb;
}

.pl5y-table tbody tr.loss-row {
  background: #fef2f2;
}

.pl5y-table tbody tr.loss-row td {
  background: #fef2f2;
  color: #dc2626;
}

.pl5y-table tbody tr:last-child {
  border-bottom: 2px solid #667eea;
  background: #f0f9ff;
  font-weight: 600;
  color: #667eea;
}

.pl5y-table tbody tr:last-child td {
  background: #f0f9ff;
  color: #667eea;
  padding: 13px 12px;
}

/* ====== 의사결정 해석 (개선) ====== */
#pl5yInsights {
  margin-top: 32px;
}

.insights-title {
  font-size: 0.95em;
  font-weight: 600;
  color: #667eea;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #667eea;
  display: inline-block;
}

.insight-card {
  background: white;
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 16px;
  border-left: 4px solid #667eea;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.insight-card h4 {
  margin: 0 0 12px 0;
  color: #1f2937;
  font-size: 0.95em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.insight-card p {
  margin: 8px 0;
  line-height: 1.6;
  color: #555;
  font-size: 0.9em;
}

.insight-card ul {
  margin: 12px 0;
  padding-left: 20px;
  list-style-position: outside;
}

.insight-card li {
  margin: 6px 0;
  color: #555;
  line-height: 1.5;
  font-size: 0.9em;
}

/* ====== SEO 콘텐츠 ====== */
.seo-content {
  background: white;
  padding: 40px;
  border-radius: 12px;
  margin-top: 50px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.seo-content h2 {
  font-size: 1.8em;
  color: #1f2937;
  margin: 40px 0 24px 0;
  border-bottom: 2px solid #667eea;
  padding-bottom: 12px;
}

.seo-content h2:first-child {
  margin-top: 0;
}

.seo-content h3 {
  font-size: 1.15em;
  color: #374151;
  margin: 28px 0 14px 0;
  font-weight: 600;
}

.seo-content p {
  color: #555;
  line-height: 1.7;
  margin-bottom: 12px;
  font-size: 0.95em;
}

.seo-content ul {
  color: #555;
  margin: 16px 0;
  padding-left: 24px;
  list-style-position: outside;
}

.seo-content li {
  margin: 8px 0;
  line-height: 1.6;
  font-size: 0.95em;
}

.seo-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.seo-content table th {
  background: #f3f4f6;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
  font-size: 0.9em;
}

.seo-content table td {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  color: #555;
  font-size: 0.9em;
}

.seo-content table tr:hover {
  background: #f9fafb;
}

/* ====== 헤더 ====== */
.calculator-header {
  text-align: center;
  margin-bottom: 32px;
}

.calculator-header h1 {
  font-size: 2.2em;
  color: white;
  margin: 0 0 12px 0;
  font-weight: 700;
}

.calculator-header p {
  font-size: 1.05em;
  color: white;
  margin: 0;
  line-height: 1.5;
}

/* ====== 반응형 디자인 (개선) ====== */

/* 태블릿 (768px 이하) */
@media (max-width: 768px) {
  .pl5y-form {
    padding: 28px 20px;
    margin-bottom: 24px;
  }

  .form-section {
    padding: 24px;
    margin-bottom: 0;
  }

  .subsection {
    margin-bottom: 24px;
    padding-bottom: 20px;
  }

  .section-header {
    font-size: 1.05em;
    margin-bottom: 24px;
  }

  .subsection h5 {
    font-size: 0.88em;
    margin-bottom: 14px;
  }

  .form-label {
    font-size: 0.88em;
  }

  .number-input,
  .form-group input,
  .form-group select {
    padding: 10px 12px;
    font-size: 0.9em;
    height: 38px;
  }

  .button-group {
    flex-direction: column;
    gap: 8px;
    padding: 20px 24px;
    margin-top: 24px;
    margin-bottom: 24px;
  }

  .btn {
    width: 100%;
    padding: 12px 16px;
    height: auto;
    flex: 1 !important;
    max-width: 100% !important;
    min-width: auto !important;
  }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .kpi-card {
    padding: 14px;
  }

  .kpi-label {
    font-size: 0.75em;
  }

  .kpi-value {
    font-size: 1.2em;
  }

  #pl5yResults {
    padding: 24px;
    margin-bottom: 24px;
  }

  .pl5y-table {
    font-size: 0.85em;
  }

  .pl5y-table thead th,
  .pl5y-table tbody td {
    padding: 8px 6px;
  }

  .pl5y-table thead th {
    font-size: 0.8em;
  }

  .seo-content {
    padding: 24px;
    margin-top: 30px;
  }

  .seo-content h2 {
    font-size: 1.5em;
    margin: 28px 0 16px 0;
  }

  .seo-content h3 {
    font-size: 1.05em;
    margin: 20px 0 12px 0;
  }

  .seo-content p {
    font-size: 0.92em;
  }

  .calculator-header h1 {
    font-size: 1.8em;
    margin-bottom: 8px;
  }

  .calculator-header p {
    font-size: 0.95em;
  }
}

/* 모바일 (480px 이하) */
@media (max-width: 480px) {
  .pl5y-form {
    padding: 20px 16px;
    margin-bottom: 16px;
  }

  .form-section {
    padding: 16px;
    margin-bottom: 0;
  }

  .section-header {
    font-size: 1em;
    margin-bottom: 20px;
    gap: 6px;
  }

  .subsection {
    margin-bottom: 20px;
    padding-bottom: 16px;
  }

  .subsection h5 {
    font-size: 0.85em;
    margin-bottom: 12px;
  }

  .form-group {
    margin-bottom: 12px;
    gap: 4px;
  }

  .form-label {
    font-size: 0.85em;
    flex-direction: column;
    gap: 0;
  }

  .number-input,
  .form-group input,
  .form-group select {
    padding: 9px 10px;
    font-size: 0.88em;
    height: 36px;
  }

  .button-group {
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    margin-top: 16px;
    margin-bottom: 16px;
  }

  .btn {
    padding: 11px 12px;
    font-size: 0.9em;
    height: auto;
    width: 100%;
  }

  .kpi-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .kpi-card {
    padding: 12px;
    border-top-width: 2px;
  }

  .kpi-label {
    font-size: 0.72em;
    height: 2em;
  }

  .kpi-value {
    font-size: 1.1em;
  }

  .insight-card {
    padding: 14px;
    margin-bottom: 10px;
  }

  .insight-card h4 {
    font-size: 0.9em;
  }

  .insight-card p {
    font-size: 0.85em;
  }

  .insight-card li {
    font-size: 0.85em;
  }

  #pl5yResults {
    padding: 16px;
    margin-bottom: 16px;
    margin-top: 16px;
  }

  .pl5y-table {
    font-size: 0.75em;
  }

  .pl5y-table thead th,
  .pl5y-table tbody td {
    padding: 6px 4px;
  }

  .pl5y-table thead th {
    font-size: 0.75em;
  }

  .seo-content {
    padding: 14px;
    margin-top: 20px;
  }

  .seo-content h2 {
    font-size: 1.3em;
    margin: 20px 0 12px 0;
  }

  .seo-content h3 {
    font-size: 1em;
    margin: 16px 0 10px 0;
  }

  .seo-content p {
    font-size: 0.88em;
    line-height: 1.6;
  }

  .seo-content li {
    font-size: 0.88em;
  }

  .seo-content table th,
  .seo-content table td {
    padding: 8px 6px;
    font-size: 0.8em;
  }

  .calculator-header h1 {
    font-size: 1.4em;
  }

  .calculator-header p {
    font-size: 0.88em;
  }
}

/* ====== 다크 모드 지원 ====== */
@media (prefers-color-scheme: dark) {
  .form-section,
  .button-group,
  .kpi-card,
  .pl5y-table,
  .insight-card,
  .seo-content {
    background: #1f2937;
    color: #e5e7eb;
  }

  .form-label {
    color: #d1d5db;
  }

  .number-input,
  .form-group input,
  .form-group select {
    background: #111827;
    border-color: #374151;
    color: #f3f4f6;
  }

  .number-input:focus,
  .form-group input:focus,
  .form-group select:focus {
    background: #1a202c;
    border-color: #667eea;
  }

  .form-group input::placeholder {
    color: #6b7280;
  }

  .subsection h5 {
    border-bottom-color: #667eea;
    color: #667eea;
  }

  #pl5yResults {
    background: #111827;
  }

  .pl5y-table tbody tr:hover {
    background: #1f2937;
  }

  .pl5y-table tbody tr.loss-row,
  .pl5y-table tbody tr.loss-row td {
    background: #2d2013;
  }

  .seo-content table th {
    background: #111827;
    color: #e5e7eb;
  }

  .seo-content table tr:hover {
    background: #1f2937;
  }

  .calculator-header h1,
  .seo-content h2,
  .seo-content h3 {
    color: #f3f4f6;
  }

  .calculator-header p {
    color: #9ca3af;
  }

  .seo-content p {
    color: #d1d5db;
  }

  .seo-content li {
    color: #d1d5db;
  }
}

