/* ===== Font Loading (local Roboto files) ===== */
@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ===== CSS Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    "Roboto",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Oxygen,
    Ubuntu,
    sans-serif;
  font-weight: 400;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ===== Container ===== */
#container {
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

/* ===== Header ===== */
.header {
  padding: 32px 32px 20px;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  gap: 10px;
}

#task-count {
  font-size: 14px;
  font-weight: 400;
  color: #888;
  background: #f0f0f0;
  padding: 4px 12px;
  border-radius: 20px;
}

.subtitle {
  font-size: 14px;
  font-weight: 300;
  color: #999;
  margin-top: 4px;
}

/* ===== Todo Input Form ===== */
#todo-form {
  display: flex;
  padding: 0 32px 20px;
  gap: 12px;
}

#todo-form input {
  flex: 1;
  font-size: 16px;
  color: #333;
  background: #fafafa;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 12px 18px;
  outline: none;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease;
}

#todo-form input:focus {
  background: #ffffff;
  border-color: #4a90d9;
}

#todo-form input::placeholder {
  color: #bbb;
}

#todo-form input.error {
  border-color: #e74c3c;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

.add-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.2s ease,
    transform 0.1s ease;
}

.add-btn:hover {
  background: #357abd;
}

.add-btn:active {
  transform: scale(0.95);
}

/* ===== Todo List ===== */
#todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#todo-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 32px 14px 56px;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
  transition: background-color 0.15s ease;
}

#todo-list li:hover {
  background: #fafafa;
}

#todo-list li:last-child {
  border-bottom: none;
}

#todo-list li .delete {
  position: absolute;
  left: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #e74c3c;
  opacity: 0;
  transform: translateX(-8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    background-color 0.2s ease;
  cursor: pointer;
  flex-shrink: 0;
}

#todo-list li:hover .delete {
  opacity: 1;
  transform: translateX(0);
}

#todo-list li .delete:hover {
  background: #fde8ea;
}

#todo-list li .delete svg {
  width: 18px;
  height: 18px;
}

#todo-list .todo-text {
  flex: 1;
  font-size: 16px;
  color: #333;
  word-break: break-word;
  transition:
    color 0.2s ease,
    text-decoration 0.2s ease;
}

#todo-list li.complete .todo-text {
  color: #999;
  text-decoration: line-through;
}

#todo-list li.empty-state .todo-text {
  color: #aaa;
  font-style: italic;
  text-align: center;
  padding: 20px 0;
}

#todo-list li.empty-state .delete {
  display: none;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 20px;
  font-size: 13px;
}

footer a {
  color: #888;
  text-decoration: none;
  transition: color 0.2s ease;
}

footer a:hover {
  color: #4a90d9;
}

footer span {
  font-weight: 500;
}

/* ===== Responsive Design ===== */
@media (max-width: 560px) {
  #container {
    border-radius: 12px;
  }

  .header {
    padding: 24px 24px 16px;
  }

  .header h1 {
    font-size: 24px;
  }

  #todo-form {
    padding: 0 24px 16px;
  }

  #todo-list li {
    padding: 14px 16px 14px 48px;
  }

  #todo-list li .delete {
    left: 8px;
  }
}
