* {
  margin: 0;
  padding: 0;
  font-family: "Poppins", sans-serif;
  box-sizing: border-box;
}

/* ===== Fixed Background ===== */
.bg-image {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('images/office-background.jpeg') no-repeat center center;
  background-size: cover;
  background-attachment: fixed;
  z-index: -1;
}

@media (max-width: 768px) {
  .bg-image {
    position: absolute;
    background: url('images/office-background.jpeg') no-repeat center center;
    background-size: cover;
    background-attachment: scroll;
    min-height: 100vh;
  }
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  color: #222;
  position: relative;
}

/* ===== Header ===== */
.header {
  width: 100%;
  text-align: center;
  padding: 30px 10px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.header-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-title {
  font-size: 2rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 5px;
}

.header-subtitle {
  font-size: 1rem;
  color: #555;
}

/* ===== Container ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin-top: 30px;
  padding: 0 10px;
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== Input Section (Separate Container) ===== */
.input-section {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  width: 50%;
  align-self: center;
}

.todo-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.todo-header h2 {
  font-size: 1.4rem;
  color: #000;
}

.todo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.15));
}

.row {
  display: flex;
  background: #f7f7f7;
  border-radius: 50px;
  padding-left: 20px;
  border: 1px solid #ddd;
}

.row input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  outline: none;
  color: #222;
}

.row button {
  background: #000;
  color: white;
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.2s;
}

.row button:hover {
  background: #444;
}

/* ===== Tasks Section (Separate Container) ===== */
.tasks-section {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  margin-bottom: 30px;
  min-height: 200px;
}

/* ===== Flexible Grid Layout ===== */
.todo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
  align-items: start;
}

/* ===== Main Tasks (Clickable Container) ===== */
.task-item {
  list-style: none;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #ddd;
  transition: 0.3s;
  display: flex;
  flex-direction: column;
  padding: 0;
  align-self: start;
  cursor: pointer;
  position: relative;
}

.task-item:hover {
  background: #f8f8f8;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.task-item.checked {
  background: #f0f8ff;
  border-color: #4CAF50;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.task-item.checked .task-text {
  text-decoration: line-through;
  color: #777;
}

.task-item.checked .main-task {
  background: rgba(76, 175, 80, 0.1);
}

.main-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 12px 36px;
  position: relative;
  border-bottom: 1px solid #eee;
  border-radius: 8px 8px 0 0;
  transition: 0.2s;
}

.main-check {
  position: absolute;
  left: 8px;
  width: 22px;
  height: 22px;
  background-image: url('images/unchecked.png');
  background-size: cover;
  cursor: pointer;
  z-index: 2;
}

.task-item.checked .main-check {
  background-image: url('images/checked.png');
}

.task-text {
  font-weight: 600;
  color: #222;
  flex: 1;
  text-align: left;
  font-size: 16px;
  pointer-events: none;
}

.remove-btn {
  color: #b00;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: 0.2s;
  z-index: 2;
}

.remove-btn:hover {
  color: #f00;
  background: rgba(255, 0, 0, 0.1);
}

/* ===== Subtask Input ===== */
.sub-row {
  display: flex;
  margin: 8px 12px 8px 12px;
  background: #f5f5f5;
  border-radius: 6px;
  padding: 6px;
  border: 1px solid #ddd;
  gap: 6px;
}

.sub-row input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.sub-row button {
  background: #000;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  z-index: 2;
}

.sub-row button:hover {
  background: #444;
}

/* ===== Subtasks ===== */
.subtasks {
  margin: 0;
  padding: 0;
  width: 100%;
}

.subtasks .subtask-item {
  list-style: none;
  background: #f9f9f9;
  margin: 4px 12px;
  border-radius: 6px;
  position: relative;
  font-size: 14px;
  display: flex;
  align-items: center;
  padding: 8px 8px 8px 32px;
  border: 1px solid #e5e5e5;
  min-height: 36px;
  word-wrap: break-word;
  cursor: pointer;
  transition: 0.2s;
}

.subtasks .subtask-item:hover {
  background: #f0f0f0;
}

.subtasks .subtask-item::before {
  content: "";
  position: absolute;
  left: 8px;
  width: 16px;
  height: 16px;
  background-image: url('images/unchecked.png');
  background-size: cover;
  flex-shrink: 0;
}

.subtasks .subtask-item.checked::before {
  background-image: url('images/checked.png');
}

.subtask-text {
  flex: 1;
  margin-right: 8px;
  line-height: 1.3;
  color: #444;
  pointer-events: none;
}

.subtasks .subtask-item.checked {
  background: #f0f8f0;
  border-color: #4CAF50;
}

.subtasks .subtask-item.checked .subtask-text {
  text-decoration: line-through;
  color: #777;
}

.subtask-remove {
  color: #b00;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 3px;
  transition: 0.2s;
  flex-shrink: 0;
  z-index: 2;
}

.subtask-remove:hover {
  color: #f00;
  background: rgba(255, 0, 0, 0.1);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #888;
  font-style: italic;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .header-title {
    font-size: 1.6rem;
  }

  .header-img {
    width: 50px;
    height: 50px;
  }

  .input-section {
    padding: 8px;
    width: calc(100% - 10px);
    margin: 0 5px;
  }

  .tasks-section {
    padding: 20px;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .row {
    padding-left: 5px;
    margin: 0;
    padding-right: 5px;
  }

  .row input {
    padding: 8px 5px;
    font-size: 14px;
  }

  .row button {
    padding: 8px 10px;
    font-size: 13px;
    min-width: 45px;
  }

  .todo-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .task-item {
    min-width: 100%;
  }

  .main-task {
    padding: 10px 10px 10px 32px;
  }

  .sub-row {
    margin: 6px 10px;
  }

  .subtasks .subtask-item {
    margin: 3px 10px;
    padding: 6px 6px 6px 28px;
  }
}

@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
  }

  body {
    min-height: 100vh;
  }

  .bg-image {
    position: absolute;
    min-height: 100%;
  }
}
