/* ---------- GLOBAL RESET & BASE ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  background: #f5f7fb;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  line-height: 1.5;
  color: #1e293b;
}

.demo-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ---------- CARD COMPONENT ---------- */
.todo-card {
  max-width: 560px;
  width: 100%;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.02);
  padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeInUp 0.4s ease;
}

.todo-card:hover {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Card states */
.todo-card--completed .todo-card__title {
  text-decoration: line-through;
  color: #94a3b8;
  background: #f8fafc;
}

.todo-card--overdue {
  border-left: 4px solid #dc2626;
}

.todo-card--in-progress {
  background: linear-gradient(to bottom, #ffffff, #fefce8);
}

/* ---------- HEADER: CHECKBOX + TITLE ---------- */
.todo-card__header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.todo-card__checkbox-wrapper {
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.todo-card__checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: #3b82f6;
  border-radius: 4px;
}

.todo-card__checkbox:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.todo-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  color: #0f172a;
  transition: all 0.2s ease;
  word-break: break-word;
}

/* ---------- DESCRIPTION & EXPAND ---------- */
.todo-card__description-wrapper {
  margin-bottom: 1rem;
}

.todo-card__description {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.todo-card__collapsible-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eef2f6;
}

.todo-card__description-full {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.5;
}

.expand-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: #3b82f6;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.expand-toggle:hover {
  background: #eff6ff;
}

.expand-toggle__icon {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s;
}

.expand-toggle[aria-expanded="true"] .expand-toggle__icon {
  transform: rotate(180deg);
}

/* ---------- META ROW ---------- */
.todo-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}

/* Priority badges */
.priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: #f1f5f9;
  color: #1e293b;
}

.priority-badge--high {
  background: #fee2e2;
  color: #b91c1c;
  border-left: 3px solid #ef4444;
}

.priority-badge--medium {
  background: #fff3e3;
  color: #c2410c;
  border-left: 3px solid #f97316;
}

.priority-badge--low {
  background: #e0f2e9;
  color: #15803d;
  border-left: 3px solid #22c55e;
}

/* Priority indicator dot */
.priority-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  background: #f8fafc;
  border-radius: 20px;
}

.priority-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.priority-dot--high {
  background: #ef4444;
  box-shadow: 0 0 0 2px #fee2e2;
}

.priority-dot--medium {
  background: #f97316;
  box-shadow: 0 0 0 2px #fff3e3;
}

.priority-dot--low {
  background: #22c55e;
  box-shadow: 0 0 0 2px #e0f2e9;
}

.priority-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: #475569;
}

/* Status control */
.status-select {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-family: inherit;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

.status-select:focus {
  outline: 2px solid #3b82f6;
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge--pending {
  background: #f1f5f9;
  color: #475569;
}

.status-badge--in-progress {
  background: #fef3c7;
  color: #92400e;
}

.status-badge--done {
  background: #dff9e6;
  color: #166534;
}

/* ---------- DUE DATE & TIME ---------- */
.todo-card__date-info {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 0;
  border-top: 1px solid #eef2f6;
  border-bottom: 1px solid #eef2f6;
}

.todo-card__due-date,
.todo-card__time-remaining {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: #334155;
  background: #fafcff;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
}

.icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: #64748b;
}

#time-remaining-text {
  font-weight: 500;
  color: #3b82f6;
}

.overdue-indicator {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  background: #fee2e2;
  color: #dc2626;
  display: inline-flex;
  align-items: center;
}

/* Overdue state */
.todo-card__time-remaining.overdue #time-remaining-text {
  color: #dc2626;
  font-weight: 600;
}

/* ---------- TAGS ---------- */
.todo-card__tags-container {
  margin-bottom: 1.5rem;
}

.todo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.todo-tags__item {
  background: #f1f4f9;
  color: #334155;
  padding: 0.25rem 0.85rem;
  border-radius: 40px;
  font-size: 0.7rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: default;
}

.todo-tags__item:hover {
  background: #e6edf4;
  transform: translateY(-1px);
}

/* ---------- EDIT FORM ---------- */
.todo-card__edit-form {
  margin: 1rem 0;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
}

.edit-form__field {
  margin-bottom: 1rem;
}

.edit-form__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #334155;
}

.edit-form__input,
.edit-form__textarea,
.edit-form__select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  transition: border-color 0.2s;
}

.edit-form__input:focus,
.edit-form__textarea:focus,
.edit-form__select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.edit-form__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ---------- BUTTONS ---------- */
.todo-card__actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 40px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
}

.btn__icon {
  width: 1rem;
  height: 1rem;
  stroke-width: 1.5;
}

.btn--primary {
  background: #3b82f6;
  color: white;
}

.btn--primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.btn--secondary {
  background: #f8fafc;
  color: #1f3a6b;
  border: 1px solid #e2e8f0;
}

.btn--secondary:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

.btn--danger {
  background: #fff5f5;
  color: #b91c1c;
  border: 1px solid #ffcdcd;
}

.btn--danger:hover {
  background: #fee2e2;
  transform: translateY(-1px);
}

button:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ---------- ACCESSIBILITY ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }
  
  .todo-card {
    max-width: 100%;
    padding: 1rem;
    will-change: transform;
  }
  
  .todo-card__meta {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .edit-form__actions {
    flex-direction: column;
  }
  
  .edit-form__actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 520px) {
  .todo-card__actions {
    justify-content: stretch;
  }
  
  .btn {
    flex: 1;
    justify-content: center;
  }
  
  .todo-card__date-info {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* ---------- ANIMATIONS ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}