/* 초기화 및 기본 설정 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Pretendard', sans-serif;
  background-color: #f0f4f8;
  color: #333;
  padding: 2rem;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* 전체 앱 컨테이너 */
.todo-app {
  max-width: 600px;
  margin: auto;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* 헤더 영역 */
.todo-header h1 {
  text-align: center;
  color: #64b5f6;
  margin-bottom: 0.5rem;
}

.sub-title {
  text-align: center;
  font-size: 1rem;
  color: #777;
}

.sub-title span {
  font-weight: bold;
  color: #222;
}

/* 다크 모드 토글 스위치 */
.toggle-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0;
  right: 0; bottom: 0;
  background-color: #ccc;
  border-radius: 24px;
  transition: 0.4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #64b5f6;
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* 입력 폼 영역 */
.todo-form {
  display: flex;
  gap: 0.5rem;
}

.todo-form input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
}

.todo-form button {
  background-color: #64b5f6;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.todo-form button:hover {
  background-color: #42a5f5;
}

/* 할 일 목록 리스트 */
.todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100px;
}

.todo-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f9f9f9;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  transition: transform 0.3s, opacity 0.3s;
}

.todo-list li span {
  flex: 1;
  margin-left: 0.75rem;
}

.todo-list li.done span {
  text-decoration: line-through;
  color: #aaa;
}

.todo-list input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

/* 하단 버튼 영역 */
.btn-nav {
  display: flex;
  gap: 0.5rem;
}

.btn-nav button {
  flex: 1;
  padding: 0.5rem;
  background-color: #90caf9;
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-nav button:hover {
  background-color: #42a5f5;
}

/* 할 일이 없을 때 표시되는 문구 */
.empty-text {
  text-align: center;
  color: #bbb;
  font-size: 1rem;
  display: none;
}

/* 다크 모드 스타일 */
body.dark-mode {
  background-color: #1e1e1e;
  color: #eee;
}

body.dark-mode .todo-app {
  background-color: #2c2c2c;
  box-shadow: none;
}

body.dark-mode .todo-list li {
  background-color: #3a3a3a;
  color: #ddd;
}

body.dark-mode .todo-form input {
  background-color: #444;
  border: 1px solid #666;
  color: #eee;
}

body.dark-mode .todo-form button,
body.dark-mode .btn-nav button {
  background-color: #616161;
}

body.dark-mode .btn-nav button:hover {
  background-color: #424242;
}

/* 반응형 - 모바일 화면 대응 */
@media (max-width: 480px) {
  .todo-form {
    flex-direction: column;
  }
  .todo-form input,
  .todo-form button {
    width: 100%;
    height: 30px;
    line-height: 30px;
  }
}
