/* 공통 스타일 */
* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
}
body {
  min-height: 100vh;
  background-color: #f9f9f9;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 16px;
  overflow-x: hidden;
}
.container {
  display: flex;
  flex-direction: column;
  width: 80%;
  max-width: 800px;
  min-height: calc(100vh - 69px);
  height: 100%;
  margin: 0 auto;
  padding: 1.25rem;
  background: #ffffff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.emoji {
  font-size: 2rem;
}
.calculator {
  padding: 0.938rem;
  background: #fff;
  border-radius: 0.625rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  margin-bottom: 2rem;
}
.calculator.hidden {
  display: none;
}
.calculator h2 {
  margin: 0 0 2rem;
  font-size: 1.25rem;
}
.info {
  margin-top: 2rem;
  padding-top: 0.875rem;
  border-top: 1px solid #034286;
}
.desc {
  margin: 0;
  color: darkslategrey;
  font-size: 0.875rem;
  line-height: 1.5;
}
.desc + .desc {
  margin-top: 0.5rem;
}
.f-bold {
  font-weight: bold;
}
.ml-0 {
  margin-left: 0.5rem;
}
.ml-auto {
  margin-left: auto;
}
.hide {
  display: none;
}
.m-0 {
  margin: 0;
}
.text-end {
  text-align: end;
}
.text-center {
  text-align: center;
}

/* Flexbox 유틸리티 */
.d-flex {
  display: flex;
}
.flex-wrap {
  flex-wrap: wrap;
}
.align-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.row {
  margin: 0 -0.5rem;
}
.row + .row {
  margin-top: 0.5rem;
}
.row .col {
  flex-grow: 1;
  padding: 0 0.5rem;
}

/* 폼 스타일 */
label {
  margin-right: 0.5rem;
  font-weight: bold;
}
input {
  flex: 1;
  padding: 0.625rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}
input[type="date"] {
  appearance: none;
  background-color: #ffffff;
  /* border: 2px solid #4CAF50; */
  border-radius: 8px;
  padding: 0.625rem 0.75rem;
  font-size: 1rem;
  color: #333;
  outline: none;
  cursor: pointer;
  transition: border-color 0.3s, box-shadow 0.3s;
}
/* 달력 아이콘 추가 (Webkit 계열 브라우저용) */
input[type="date"]::-webkit-calendar-picker-indicator {
  background: url('https://cdn-icons-png.flaticon.com/512/747/747310.png') no-repeat center;
  background-size: 1.25rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.3s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}
/* Placeholder 스타일 (기본 날짜 입력값이 없을 때) */
input[type="date"]:invalid {
  color: #aaa;
}
select {
  flex: 1;
  padding: 0.625rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  background-image: url('./images/arrow_down.svg');
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 1rem 0.75rem;
  font-size: 1rem;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
  appearance: none;
}

/* 버튼 스타일 */
button {
  margin: 0;
  padding: 0.875rem 1rem;
  border: none;
  border-radius: 8px;
  background-color: #034286;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s;
}
button:hover {
  background-color: #0768d0;
}
.btn-default {
  background-color: #bebebe;
}
.btn-default:hover {
  background-color: #f9f9f9;
  color: #333;
}
button + button {
  margin-left: 0.5rem;
}
.btn-wrap {
  margin: 1rem 0;
}
button#showPopup {
  padding: 0;
  background-color: #fff;
  font-size: 0.875rem;
  color: #333;
  text-decoration: underline;
}

/* 테이블 스타일 */
table {
  border: 1px solid #333;
}
th, td {
  padding: 0.5rem 0.5rem;
  border: 1px solid #333;
  text-align: center;
  font-size: 0.875rem;
}
th:first-child,
th:nth-child(2),
td:first-child,
td:nth-child(2) {
  font-size: 0.875rem;
}

/* 팝업 스타일 */
.popup {
  display: none; 
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0,0.4); /* 검은색 배경 */
}
.popup-content {
  background-color: #fefefe;
  margin: 15% auto;
  padding: 1.25rem;
  border: 1px solid #888;
  width: 80%; /* 팝업 너비 */
  max-width: 800px;
}
.popup p {
  margin: 0.5rem 0;
}
.close {
  color: #aaa;
  float: right;
  font-size: 1.75rem;
  font-weight: bold;
}
.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

/* 기타 스타일 */
footer {
  margin-top: auto;
  padding-top: 1.25rem;
  font-size: 0.75rem;
  color: #777;
}
.totalPay {
  margin: 0.5rem 0;
  padding: 0.5rem;
  border-top: 1px solid #034286;
  border-bottom: 1px solid #034286;
  font-size: 1.125rem;
  font-weight: bold;
}

/* 다크 모드 대응 */
/* @media (prefers-color-scheme: dark) {
} */

/* 헤더 스타일 */
header {
  position: sticky;
  display: flex;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  -webkit-box-shadow: 0 4px 4px -1px rgba(145,145,145,1);
  -moz-box-shadow: 0 4px 4px -1px rgba(145,145,145,1);
  box-shadow: 0 4px 4px -1px rgba(145,145,145,1);
}
header h1 {
  margin-right: auto;
  font-size: 1.5rem;
  color: #333;
}
header ul {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
header ul li + li {
  margin-left: 1rem;
}
header ul li a {
  padding: 0;
  font-size: 0.875rem;
  color: #333;
}

/* 출산 휴가 계산기 */
.maternity-leave-form {
  margin-bottom: 2rem;
}
#maternityStart {
  max-width: 250px;
}
#maternityResult{
  font-size: 1.25rem;
  color: #034286;
}

/* 육아 휴가 계산기 */
.parental-leave-select {
  width: 200px;
  margin-bottom: 1rem;
}
.calculator-table-caption {
  font-size: 0.875rem;
  color: #777;
}
.calculator-table {
  width: 100%;
  margin: 0.5rem 0 2rem;
  border-collapse: collapse;
}
.calculator-table td input[type="date"] {
  padding: 0.5rem 0.75rem;
}
.calculator-table tfoot td {
  padding: 0.5rem 0;
  font-size: 1.125rem;
  font-weight: bold;
}
.parental-leave-error {
  margin: -1rem 0 0;
  color: red;
}
.parental-leave-result {
  margin: 2rem 0 0;
  font-size: 1.25rem;
  color: #034286;
}
#parentalPay .row + .row {
  margin-top: 1rem;
}
#parentalPay .btn-wrap {
  margin: 2rem 0;
}
#parentalPay > .d-flex:first-child {
  margin-bottom: 2rem;
}
#parentalPay h2 {
  margin-bottom: 0;
}

/* 반응형 스타일 */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  .calculator h2 {
    margin-bottom: .5rem;
  }
  header {
    flex-direction: column;
    padding: 1rem 0;
  }
  header h1 {
    margin: 0 0 .5rem 0;
  }
  .container {
    width: 100%;
    min-height: calc(100vh - 96px);
  }
  .row .col + .col {
    margin-top: 1rem;
  }
  .maternity-leave-form button {
    margin: 1rem auto 0;
  }
  #parentalPay > .d-flex:first-child {
    flex-direction: column;
  }
  .calculator-table {
    display: block;
    width: 100%;
    border: none;
  }

  .calculator-table thead {
    display: none; /* 헤더 숨기기 */
  }

  .calculator-table tbody,
  .calculator-table tfoot {
    display: block;
    width: 100%;
  }

  .calculator-table tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    padding: 0.5rem;
    border-radius: 8px;
    background: #f9f9f9;
  }

  .calculator-table td {
    display: flex;
    align-items: center;
    padding: 0.4rem 0;
    border: none;
    font-size: 1rem;
  }
  .calculator-table td::before {
    content: attr(data-label); /* data-label 값을 앞에 표시 */
    font-weight: bold;
    padding-right: 6px;
    font-size: 0.875rem;
  }
  .calculator-table td:first-child,
  .calculator-table td:nth-child(4),
  .calculator-table td:last-child {
    font-weight: bold;
  }
  .calculator-table td:first-child:after,
  .calculator-table td:nth-child(4):after,
  .calculator-table td:last-child:after {
    content: attr(data-label); /* data-label 값을 뒤에 표시 */
    font-weight: bold;
    padding-left: 2px;
    font-size: 0.875rem;
  }
  .calculator-table td:first-child:before,
  .calculator-table td:nth-child(4):before,
  .calculator-table td:last-child:before {
    display: none;
  }
  button#showPopup {
    margin-top: 0.5rem;
  }
}