:root {
  /* Modernere Farbpalette 2026 */
  --primary-color: light-dark(#0066ff, #4d94ff);
  --primary-hover: light-dark(#0052cc, #80b3ff);
  --danger-color: light-dark(#e5484d, #ff6b6b);
  --card-bg: light-dark(#ffffff, #1a1a1a);
  --text-main: light-dark(#111827, #f9fafb);
  --text-muted: light-dark(#6b7280, #9ca3af);
  --border-color: light-dark(#e5e7eb, #2d2d2d);

  /* Weichere, modernere Schatten */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  --radius: 10px;
  --radius-lg: 16px;
}

body {
  max-width: 550px; /* Minimal breiter für bessere Lesbarkeit */
  margin: 4rem auto;
  padding: 0 1.5rem;
  color: var(--text-main);
  background-color: light-dark(#fcfcfc, #0d0d0d);
  transition: opacity 0.3s ease;
}

@scope (.app-header) {
  :scope {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    font-size: 0.95rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
  }

  .welcome-text {
    color: var(--text-muted);
    font-weight: 450;
  }

  .logout-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;

    &:hover {
      color: var(--primary-hover);
      text-decoration: none;
    }
  }
}

input,
textarea,
button {
  padding: 12px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 15px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  &:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px light-dark(rgba(0, 102, 255, 0.1), rgba(77, 148, 255, 0.15));
  }
}

textarea {
  width: 100%;
  min-height: 120px;
  line-height: 1.6;
}

.post-item {
  background: var(--card-bg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  list-style: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;

  &:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
  }
}

.post-content {
  white-space: pre-wrap;
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

.post-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.post-detail {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.post-detail .post-content.detail {
  font-size: 1.25rem;
  margin-bottom: 2.5rem;
  letter-spacing: -0.01em;
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.post-actions {
  display: flex;
  gap: 12px;
  margin-top: 1rem;
}

.btn-primary,
.btn-publish {
  background: var(--primary-color);
  color: white;
  border: none;
  font-weight: 600;

  &:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
  }
}

.btn-delete {
  background: light-dark(#fff, transparent);
  color: var(--danger-color);
  border: 1.5px solid var(--danger-color);

  &:hover {
    background: var(--danger-color);
    color: white;
  }
}

.btn-unpublish {
  background: light-dark(#f3f4f6, #2d2d2d);
  color: var(--text-muted);
  border: none;

  &:hover {
    background: light-dark(#e5e7eb, #3d3d3d);
    color: var(--text-main);
  }
}

.post-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 6px;
  background: light-dark(#f3f4f6, #2d2d2d);
  color: var(--text-muted);
}

.post-status.public {
  background: light-dark(#dcfce7, rgba(34, 197, 94, 0.2));
  color: light-dark(#166534, #4ade80);
}

button {
  font-weight: 600;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Kapselung der Todo-Eingabe */
@scope (.todo-create-form) {
  :scope {
    display: flex;
    gap: 12px;
    margin-bottom: 2.5rem;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
  }

  input {
    flex: 1;
    border-color: transparent;
    background: light-dark(#f9fafb, #252525);

    &:focus {
      background: var(--card-bg);
    }
  }
}

/* Kapselung der Todo-Elemente */
@scope (.todo-item) {
  :scope {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    list-style: none;
  }

  .todo-checkbox {
    margin-right: 14px;
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
  }

  .todo-content {
    flex: 1;
    font-size: 1rem;
    color: var(--text-main);

    &.completed {
      text-decoration: line-through;
      color: var(--text-muted);
      opacity: 0.7;
    }
  }

  .todo-delete {
    margin-left: 10px;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 6px;

    &:hover {
      color: var(--danger-color);
      background: light-dark(#fff1f2, rgba(229, 72, 77, 0.1));
    }
  }
}

@scope (.todo-list) {
  :scope {
    padding: 0;
    margin: 0;
  }
}

/* Kapselung des Auth-Formulars */
@scope (.auth-form) {
  :scope {
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
  }

  h2 {
    margin-bottom: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
  }

  input {
    display: block;
    margin-bottom: 1rem;
    width: 100%;
  }

  button {
    width: 100%;
    padding: 14px;
    margin-top: 0.5rem;

    &.btn-secondary {
      background-color: transparent;
      border: 1.5px solid var(--border-color);
      color: var(--text-main);

      &:hover {
        background: light-dark(#f9fafb, #252525);
      }
    }
  }

  p {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);

    a {
      color: var(--primary-color);
      font-weight: 600;
      &:hover {
        color: var(--primary-hover);
      }
    }
  }
}

/* Spinner Modernisierung */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border-color);
  border-top: 2.5px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
