:root {
  --primary-color: #4a90e2;
  --secondary-color: #f5f6fa;
  --text-color: #2c3e50;
  --completed-color: #95a5a6;
  --danger-color: #e74c3c;
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  --border-radius: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans KR', sans-serif;
  background-color: #f0f2f5;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding-top: 40px;
  padding-bottom: 40px;
  color: var(--text-color);
}

.todo-app {
  background: white;
  width: 100%;
  max-width: 600px; /* Increased width for calendar */
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin: 0 1rem;
}

header {
  text-align: center;
  margin-bottom: 1.5rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.date-display {
  color: #7f8c8d;
  font-size: 0.9rem;
}

/* View Controls */
.view-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.view-btn {
  padding: 8px 16px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

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

/* Input Group */
.input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.date-input {
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: inherit;
  color: var(--text-color);
  cursor: pointer;
}

#todoInput {
  flex: 1;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
  outline: none;
  min-width: 200px;
}

#todoInput:focus {
  border-color: var(--primary-color);
}

#addBtn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 1rem;
  transition: background-color 0.2s;
  white-space: nowrap;
}

#addBtn:hover {
  background-color: #357abd;
}

/* Filters */
.filters {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 1rem;
}

.filter-btn {
  background: none;
  border: none;
  color: #7f8c8d;
  cursor: pointer;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 20px;
  transition: all 0.2s;
}

.filter-btn:hover {
  color: var(--primary-color);
  background-color: #f0f7ff;
}

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

/* Todo List */
.todo-list {
  list-style: none;
  margin-bottom: 1.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.todo-list::-webkit-scrollbar {
  width: 6px;
}

.todo-list::-webkit-scrollbar-thumb {
  background-color: #ddd;
  border-radius: 3px;
}

.todo-item {
  display: flex;
  align-items: center;
  padding: 12px 10px;
  border-bottom: 1px solid #f1f1f1;
  transition: background-color 0.2s;
}

.todo-item:last-child {
  border-bottom: none;
}

.todo-item:hover {
  background-color: #fafafa;
}

.todo-item input[type="checkbox"] {
  margin-right: 15px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.todo-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.todo-date {
  font-size: 0.75rem;
  color: #95a5a6;
  margin-bottom: 2px;
}

.todo-text {
  font-size: 1.05rem;
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: var(--completed-color);
}

.delete-btn {
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 5px;
  font-size: 1.1rem;
}

.todo-item:hover .delete-btn {
  opacity: 1;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #7f8c8d;
  font-size: 0.9rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.clear-btn {
  background: none;
  border: none;
  color: #7f8c8d;
  cursor: pointer;
  font-size: 0.85rem;
}

.clear-btn:hover {
  text-decoration: underline;
  color: var(--danger-color);
}

/* Calendar Styles */
.hidden {
  display: none !important;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.calendar-header h2 {
  font-size: 1.2rem;
  color: var(--text-color);
}

.nav-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px 10px;
  color: var(--text-color);
}

.nav-btn:hover {
  background-color: #eee;
  border-radius: 5px;
}

.calendar-controls {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-bottom: 1rem;
}

.cal-mode-btn {
  padding: 5px 12px;
  background: #f1f1f1;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-size: 0.85rem;
}

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

.calendar-grid {
  display: grid;
  gap: 5px;
}

/* Month View */
.calendar-grid.month {
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day-header {
  text-align: center;
  font-weight: bold;
  font-size: 0.8rem;
  color: #7f8c8d;
  padding: 5px 0;
}

.calendar-cell {
  border: 1px solid #eee;
  border-radius: 5px;
  min-height: 80px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s;
}

.calendar-cell:hover {
  background-color: #fafafa;
}

.calendar-cell.today {
  border-color: var(--primary-color);
  background-color: #f0f7ff;
}

.day-number {
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 3px;
  align-self: flex-end;
}

.calendar-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.dot {
  width: 6px;
  height: 6px;
  background-color: var(--primary-color);
  border-radius: 50%;
}

.dot.completed {
  background-color: var(--completed-color);
}

.calendar-cell.empty {
  background: none;
  border: none;
  cursor: default;
}

/* Week View */
.calendar-grid.week {
  grid-template-columns: repeat(7, 1fr);
  min-height: 300px;
}

.week-col {
  border: 1px solid #eee;
  border-radius: 5px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.week-col.today {
  background-color: #f0f7ff;
  border-color: var(--primary-color);
}

.week-header {
  text-align: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
  margin-bottom: 5px;
}

.week-day-name {
  font-size: 0.8rem;
  color: #7f8c8d;
}

.week-date {
  font-weight: bold;
  font-size: 0.9rem;
}

.week-task {
  font-size: 0.7rem;
  padding: 3px;
  background-color: white;
  border: 1px solid #eee;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.week-task.completed {
  text-decoration: line-through;
  color: #aaa;
  background-color: #f9f9f9;
}

/* Day View */
.calendar-grid.day {
  display: block; /* Stack items */
}

.day-view-container {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem;
  min-height: 300px;
}

.day-view-header {
  text-align: center;
  margin-bottom: 1rem;
  font-weight: bold;
  font-size: 1.1rem;
}
