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

:root {
  /* Geral */
  --dark: #212529;
  --light: #f8f9fa;
  --gray: #868e96;
  --danger: #fa5252;
  --success: #40c057;
  --border: #e9ecef;

  /* Manhã */
  --primary-morning: #3bafe8;
  --background-morning: #0a2f42;
  --accent-morning: #5ec9f5;

  /* Tarde  */
  --primary-afternoon: #ff8c42;
  --background-afternoon: #2d1810;
  --accent-afternoon: #ffb366;

  /* Noite  */
  --primary-night: #8b5cf6;
  --background-night: #1a0b3d;
  --accent-night: #a78bfa;

  /* Variáveis dinâmicas */
  --primary: var(--primary-night);
  --background: var(--background-night);
  --accent: var(--accent-night);
  --body-bg: color-mix(in srgb, var(--background) 5%, #f1f3f5);
}

/* APP */
body {
  font-family: 'IBM Plex Sans';
  background-color: var(--body-bg);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: var(--dark);
  overflow-x: hidden;
}

#mainContent {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app {
  width: 100%;
  max-width: 500px;
  background-color: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.09);
}

header {
  background-color: var(--background);
  color: #fff;
  padding: 20px 25px;
}

header h1 {
  font-size: 24px;
  font-weight: 600px;
}

header span {
  color: var(--primary);
}

header p {
  font-size: 14px;
  opacity: 0.9;
}

.todo-input {
  padding: 20px 25px;
  display: flex;
  gap: 10px;
  background-color: var(--light);
  border-bottom: 1px solid var(--border);
}

.todo-input input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #dee2e6;
  font-size: 1rem;
  transition: all 0.2s;
  border-radius: 6px;
}

.todo-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.todo-input button {
  background-color: var(--primary);
  color: #fff;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.todo-input button {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.todo-input button::before,
.todo-input button::after {
  content: '';
  position: absolute;
  background-color: #fff;
  border-radius: 2px;
  transition: all 0.5s;
  will-change: transform;
}

.todo-input button::before {
  width: 14px;
  height: 3px;
}

.todo-input button::after {
  width: 3px;
  height: 14px;
}

.todo-input button:hover::before,
.todo-input button:hover::after {
  transform: rotate(180deg);
}

.filters {
  display: flex;
  gap: 15px;
  border-bottom: 1px solid var(--border);
  padding: 15px 25px;
}

.filter {
  padding: 5px 3px;
  cursor: pointer;
  user-select: none;
  color: var(--gray);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  -webkit-tap-highlight-color: color-mix(
    in srgb,
    var(--primary) 20%,
    transparent
  );
  outline: none;
}

.filter:hover {
  color: var(--primary);
}

.filter.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  font-weight: 500;
}

.todo-container {
  padding: 15px 0;
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

#todo-list {
  list-style-type: none;
}

.todo-item {
  padding: 12px 15px;
  display: flex;
  align-items: center;
  transition: background-color 0.2s;
}

.todo-item:hover {
  background-color: var(--light);
}

.todo-item-date {
  color: var(--gray);
  font-size: 0.875rem;
  margin-left: 10px;
  white-space: nowrap;
}

.checkbox-container {
  margin-right: 15px;
  display: flex;
}

.todo-checkbox {
  opacity: 0;
  position: absolute;
}

.checkmark {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #dee2e6;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}

.todo-checkbox:checked + .checkmark {
  background-color: var(--success);
  border-color: var(--success);
}

.todo-checkbox:checked + .checkmark:after {
  content: '';
  position: absolute;
  left: 5px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.todo-item-text {
  font-family: 'Fira Sans';
  font-size: 1rem;
  transition: all 0.2px;
}

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

.delete-btn {
  background: none;
  border: none;
  color: var(--gray);
  cursor: pointer;
  font-size: 16px;
  opacity: 0;
  transition: all 0.2s;
  margin-left: auto;
  touch-action: manipulation;
}

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

.delete-btn:hover {
  color: var(--danger);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  color: var(--gray);
}

.empty-state i {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.7;
}

.hidden {
  display: none;
}

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  border-top: 1px solid var(--border);
  background-color: var(--light);
  font-size: 14px;
}

#items-left {
  color: var(--gray);
}

#clear-completed {
  background: none;
  border: none;
  color: var(--gray);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: color-mix(
    in srgb,
    var(--danger) 20%,
    transparent
  );
  transition: all 0.2s;
  touch-action: manipulation;
}

#clear-completed:hover {
  color: var(--danger);
}

/* Welcome-Page */
.welcome-screen {
  font-family: 'Poppins', sans-serif;
  color: var(--dark);
  background-color: var(--body-bg);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.6s ease-out;
}

.welcome-screen.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.welcome-screen.fade-out {
  animation: fadeOut 0.6s ease-out forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

.welcome-content {
  text-align: center;
  padding: 2rem;
}

.welcome-content h1 {
  font-size: 3.5rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: #1a1a1a;
  margin-bottom: 1rem;
  animation: fadeInUp 1s ease-out;
}

.welcome-content p {
  font-size: 1.1rem;
  font-weight: 400;
  color: #666;
  letter-spacing: 0.02em;
  animation: fadeInUp 1.2s ease-out;
}

.welcome-line {
  width: 60px;
  height: 2px;
  background-color: var(--background);
  margin: 2rem auto 0;
  animation: expandLine 1.5s ease-out;
}

.welcome-message span {
  color: var(--primary);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes expandLine {
  from {
    width: 0;
  }
  to {
    width: 60px;
  }
}

@media (max-width: 768px) {
  .delete-btn {
    opacity: 1;
  }

  .todo-item:nth-child(even) {
    background-color: var(--light);
  }

  .todo-item:hover {
    background-color: transparent;
  }
}


