/* styles.css */
:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --secondary: #10b981;
  --text-dark: #1e293b;
  --text-light: #f8fafc;
  --bg-light: #f9fafb;
  --bg-dark: #111827;
  --gray-light: #e5e7eb;
  --gray: #d1d5db;
  --gray-mid: #9ca3af;
  --gray-dark: #374151;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --danger: #ef4444;
  --danger-hover: #dc2626;
}

.dark {
  --primary: #60a5fa;
  --primary-hover: #3b82f6;
  --secondary: #34d399;
  --text-dark: #f8fafc;
  --text-light: #1e293b;
  --bg-light: #000000; /* Consider a very dark gray like #121212 for less starkness than pure black */
  --gray-light: #374151;
  --gray: #4b5563;
  --gray-mid: #9ca3af;
  --success-bg: #163020; /* Darker success bg for dark mode */
  --success-border: #2f5c3d; /* Darker success border for dark mode */
}

body {
  background-color: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

.container {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1rem;
}

header, footer {
  text-align: center;
  margin-bottom: 1rem;
}

.theme-toggle-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

#theme-toggle {
  padding: 0.5rem;
  border-radius: 0.5rem;
  background-color: var(--gray);
  color: var(--text-dark); /* Ensure text/icon is visible */
}

.dark #theme-toggle {
    background-color: var(--gray-dark);
    color: var(--text-light);
}

h1 {
  font-size: 2.25rem; /* Consider using Tailwind's text-3xl or text-4xl for consistency if desired */
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.header-description {
  font-size: 1.125rem; /* Tailwind: text-lg */
  color: var(--gray-mid);
}

.progress-container {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.progress-bar {
  width: 80%;
  height: 0.75rem;
  background-color: var(--gray);
  border-radius: 0.75rem;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: var(--secondary);
  transition: width 0.85s ease;
}

.progress-text {
  font-size: 1rem; /* Tailwind: text-base */
  font-weight: bold;
}

.checklist-card {
  background-color: white; /* Tailwind: bg-white */
  border-radius: 0.75rem; /* Tailwind: rounded-xl */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* Tailwind: shadow-md or shadow-lg */
  overflow: hidden;
  margin-bottom: 2rem;
}

.dark .checklist-card {
  background-color: var(--gray-light); /* Or a darker shade e.g. #1f2937 (Tailwind's gray-800) */
}

.card-content {
  padding: 1rem; /* Tailwind: p-4 */
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-header h2 {
  font-size: 1.25rem; /* Tailwind: text-xl */
  font-weight: 600; /* Tailwind: font-semibold */
}

#reset-btn {
  font-size: 0.875rem; /* Tailwind: text-sm */
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 0.25rem; /* Tailwind: gap-1 */
  background: none;
  border: none;
  cursor: pointer;
}

#reset-btn:hover {
  color: var(--danger-hover);
}

.item-text {
  font-weight: bold; /* Makes the item text bold */
  cursor: pointer; /* Indicate that the text is clickable */
  flex-grow: 1; /* Allow text to take up available space */
}

.checklist-item {
  transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
  padding: 0.75rem; /* Tailwind: p-3 */
  border-radius: 0.5rem; /* Tailwind: rounded-lg */
  border: 1px solid var(--gray);
  margin-bottom: 0.5rem;
  animation: fadeSlideIn 0.5s ease-out forwards;
}

.checklist-item:hover {
  transform: translateY(-2px);
  border-color: var(--primary); /* Add some hover feedback on border */
}

.dark .checklist-item:hover {
    border-color: var(--primary);
}

.checklist-item.checked {
  background-color: var(--success-bg);
  border-color: var(--success-border);
}

.dark .checklist-item.checked {
    background-color: var(--success-bg); /* Ensure this is distinct in dark mode */
    border-color: var(--success-border);
}

.new-item-container {
  margin-top: 1rem;
  padding-top: 1rem; /* Increased padding for better separation */
  border-top: 1px solid var(--gray);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem; /* Increased gap */
}

.input-group input,
.input-group textarea {
  padding: 0.75rem 1rem; /* Tailwind: px-4 py-3 */
  border: 1px solid var(--gray);
  border-radius: 0.5rem; /* Tailwind: rounded-lg */
  outline: none;
  background-color: inherit; /* For theme consistency */
  color: inherit; /* For theme consistency */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group input:focus,
.input-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-hover); /* Focus ring */
}


.input-group textarea {
  resize: vertical;
  min-height: 48px; /* Ensure consistent initial height */
  height: auto;
  overflow-y: hidden; /* Hide scrollbar initially, will appear if content overflows min/max height */
}


.input-group button {
  padding: 0.75rem 1rem; /* Tailwind: px-4 py-3 */
  background-color: var(--primary);
  color: white;
  border-radius: 0.5rem; /* Tailwind: rounded-lg */
  transition: background-color 0.2s ease, transform 0.2s ease;
  font-weight: 500; /* Tailwind: font-medium */
}

.input-group button:hover {
  background-color: var(--primary-hover);
  transform: scale(1.03);
}

input[type="checkbox"] {
  width: 1.25rem; /* Tailwind: w-5 */
  height: 1.25rem; /* Tailwind: h-5 */
  margin-right: 0.75rem; /* Tailwind: mr-3 */
  border-radius: 0.25rem; /* Tailwind: rounded */
  border: 2px solid var(--gray-mid); /* Thicker border for better visibility */
  cursor: pointer;
  background-color: inherit;
  appearance: none; /* Remove default appearance */
  position: relative;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

input[type="checkbox"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

input[type="checkbox"]:checked::before {
  content: '✔'; /* Checkmark character */
  color: white;
  font-size: 0.8rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
}


.dark input[type="checkbox"] {
    border: 2px solid var(--gray);
}
.dark input[type="checkbox"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}
.dark input[type="checkbox"]:checked::before {
  color: var(--bg-dark); /* Ensure checkmark is visible on dark primary */
}


/* Updated Description Styles */
.description {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  visibility: hidden;
  transition: max-height 0.35s ease-in-out, opacity 0.3s ease-in-out, padding-top 0.35s ease-in-out, visibility 0s linear 0.35s; /* Delay visibility change */
  margin-left: calc(1.25rem + 0.75rem); /* Align with item text (checkbox width + margin) */
  font-size: 0.875rem; /* Tailwind: text-sm */
  color: var(--gray-mid);
  padding-top: 0; /* No padding when collapsed */
  line-height: 1.5;
}

.description.expanded {
  max-height: 300px; /* Adjust as needed, or use a larger value like '100vh' if content can be very long */
  opacity: 1;
  visibility: visible;
  padding-top: 0.5rem; /* Tailwind: pt-2. Add padding when expanded */
  transition: max-height 0.35s ease-in-out, opacity 0.3s ease-in-out, padding-top 0.35s ease-in-out, visibility 0s linear 0s;
}

/* Removed .description-textarea.hidden as Tailwind's .hidden will be used */

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

footer {
  color: var(--gray-mid);
  font-size: 0.875rem;
  padding-top: 1rem;
  margin-top: 2rem;
  border-top: 1px solid var(--gray-light);
}
.dark footer {
    border-top: 1px solid var(--gray-dark);
}


.heart-text {
  margin-top: 0.25rem;
}

.heart-text i {
  color: #ef4444; /* Tailwind: text-red-500 */
}

.support-text {
  margin-top: 0.5rem;
}

/* Confetti */
#celebration {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
  overflow: hidden; /* Prevent scrollbars if confetti goes outside */
}

.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  background: gold; /* Default color, can be randomized in JS if desired */
  border-radius: 50%;
  animation: confetti-fall 1.5s ease-out forwards; /* Adjusted duration */
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-10vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* Category Buttons */
#category-filter {
  display: flex;
  gap: 0.75rem; /* Tailwind: gap-3 */
  margin-bottom: 1.5rem; /* Increased margin */
  justify-content: center;
  flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

.category-btn {
  padding: 0.5rem 1rem; /* Tailwind: px-4 py-2 */
  border: 2px solid var(--gray);
  border-radius: 8px; /* Tailwind: rounded-lg */
  background-color: white; /* Tailwind: bg-white */
  color: var(--text-dark);
  font-weight: 600; /* Tailwind: font-semibold */
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}
.dark .category-btn {
    background-color: var(--gray-dark);
    border-color: var(--gray);
    color: var(--text-light);
}

.category-btn:hover {
  background-color: #f0f0f0; /* Lighter gray for hover */
  border-color: var(--gray-mid);
}
.dark .category-btn:hover {
  background-color: var(--gray);
  border-color: var(--gray-mid);
}

.category-btn.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(var(--primary), 0.3);
}
.dark .category-btn.active {
    color: var(--bg-dark); /* Ensure text is readable on primary color in dark mode if primary is light */
    /* If primary is dark enough, 'white' might still be fine */
}


.delete-btn {
    color: var(--danger);
    background: none;
    border: none;
    margin-left: 1rem; /* Tailwind: ml-4 */
    cursor: pointer;
    padding: 0.25rem; /* Add some padding for easier clicking */
}

.delete-btn:hover {
    color: var(--danger-hover);
}
.delete-btn i {
    font-size: 0.9rem; /* Adjust icon size if needed */
}