@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

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

:root {
  /* colors */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef2ff;

  --grey-50: #f9fafb;
  --grey-100: #f3f4f6;
  --grey-200: #e5e7eb;
  --grey-300: #d1d5db;
  --grey-600: #4b5563;
  --grey-900: #111827;

  --white: #ffffff;
  --black: #000000;

  --green: #22c55e;
  --red: #ef4444;

  /* typography */
  --headingFont: 'Inter', sans-serif;
  --bodyFont: 'Inter', sans-serif;

  /* layout */
  --borderRadius: 0.75rem;
  --transition: 0.25s ease-in-out;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.12);
  --max-width: 720px;
}

/* ========== GLOBAL ========== */
html {
  font-size: 100%;
}

body {
  font-family: var(--bodyFont);
  background: var(--grey-50);
  color: var(--grey-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--headingFont);
  font-weight: 600;
  line-height: 1.3;
  color: var(--grey-900);
}

h2 {
  line-height: 2.5;
}

h4 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-block;
  cursor: pointer;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--borderRadius);
  padding: 0.6rem 1rem;
  font-weight: 500;
  transition: var(--transition);
  text-align: center;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.btn.block {
  width: 100%;
}

.submit-btn {
  margin-top: 1rem;
}

.back-link {
  display: block;
  margin: 3rem auto 0;
  background: var(--grey-900);
  color: var(--white);
  padding: 0.7rem 1rem;
  width: max-content;
  border-radius: var(--borderRadius);
  transition: var(--transition);
}

.back-link:hover {
  background: var(--grey-600);
}

.back-icon {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.183);
  backdrop-filter: blur(6px);
  color: white;
  transition: background 0.25s ease, transform 0.2s ease;
}

.back-icon svg {
  width: 22px;
  height: 22px;
}

.back-icon:hover {
  background: rgba(79, 70, 229, 0.402);
  transform: scale(1.05);
}

/* ========== FORM ========== */
form {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--borderRadius);
  box-shadow: var(--shadow-md);
  width: 90vw;
  max-width: var(--max-width);
  margin: 2rem auto;
}

.form-control {
  margin-bottom: 1rem;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
  display: block;
  margin-bottom: 0.4rem;
  color: var(--grey-600);
}

input,
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--borderRadius);
  border: 1px solid var(--grey-300);
  font-size: 1rem;
  transition: var(--transition);
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-light);
}

::placeholder {
  color: var(--grey-600);
}

/* alert */
.form-alert {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  text-align: center;
}

.text-success {
  color: var(--green);
}

.text-danger {
  color: var(--red);
}

/* ========== TASKS LIST ========== */
.tasks-container {
  width: 90vw;
  max-width: var(--max-width);
  margin: 2rem auto;
}

.tasks {
  display: grid;
  gap: 1rem;
}

.single-task {
  background: var(--white);
  padding: 1rem 1.25rem;
  border-radius: var(--borderRadius);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.single-task:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.single-task h5 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.single-task .fa-check-circle {
  font-size: 1rem;
  color: var(--green);
  visibility: hidden;
}

.task-completed h5 {
  text-decoration: line-through;
  color: var(--grey-600);
}

.task-completed {
  display: flex;
}

.task-completed .fa-check-circle {
  visibility: visible;
}

/* task actions */
.task-links {
  display: flex;
  gap: 0.5rem;
}

.edit-link {
  color: var(--green);
  font-size: 1rem;
  transition: var(--transition);
}

.edit-link:hover {
  color: #16a34a;
}

.delete-btn {
  background: none;
  border: none;
  color: var(--red);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.delete-btn:hover {
  color: #b91c1c;
}

/* ========== SINGLE TASK EDIT PAGE ========== */
.single-task-form .form-control {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1rem;
  align-items: center;
}

.single-task-form .form-alert {
  margin-top: 1rem;
}

input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  display: inline-block !important;
}

/* loading */
.loading-text {
  text-align: center;
  color: var(--grey-600);
  font-size: 1rem;
}

@media (max-width: 500px) {
  .container {
    margin-top: 6rem;
  }
  .single-task-form .form-control {
    display: block;
  }
}