@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;800;900&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

/* Use CSS variables that respect Daisy UI themes */
:root {
  --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
  --border-radius: 12px;
}

/* Let Daisy UI handle the body background through themes */
body {
  position: relative;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
  /* Remove hardcoded background - let Daisy UI themes control it */
}

.author-text {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 100;
  /* Let Daisy UI control the text color through themes */
  opacity: 0.8;
}

/* Use Daisy UI base colors and let themes control the appearance */
.container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin: 20px;
  min-width: 320px;
  max-width: 1200px;
  width: 100%;
  /* Use Daisy UI's base-100 background and let themes control it */
  background: oklch(var(--b1) / 0.95);
  box-shadow: var(--shadow-medium);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  /* Use Daisy UI's border color */
  border: 1px solid oklch(var(--b3));
  padding: 24px;
  animation: slideUp 0.6s ease-out;
}

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

.container header {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: 100%;
  margin-bottom: 24px;
}

header h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 16px;
  text-align: center;
  /* Use Daisy UI's primary color for the gradient */
  background: linear-gradient(135deg, oklch(var(--p)), oklch(var(--s)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Alert Messages */
.alert-message {
  width: 100%;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(0.95);
  opacity: 0;
}

.alert-message.show {
  display: block;
  transform: scale(1);
  opacity: 1;
}

.alert-message.hide {
  display: none;
}

/* Progress Section */
.progress-container {
  width: 100%;
  margin-bottom: 20px;
}

.progress-bar {
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  /* Use Daisy UI's primary color for the progress bar */
  background: linear-gradient(90deg, oklch(var(--p)), oklch(var(--su)));
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Input Section */
header .input-section {
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.input-section input {
  flex: 1;
  min-width: 0;
  transition: all 0.3s ease;
}

.input-section input:focus {
  transform: translateY(-2px);
  box-shadow: var(--shadow-light);
}

.add-task-button {
  transition: all 0.3s ease;
  min-width: 48px;
}

.add-task-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-light);
}

/* Search and Filter */
.search-filter-section {
  width: 100%;
  margin-bottom: 16px;
}

.search-input {
  transition: all 0.3s ease;
}

.search-input:focus {
  /* Use Daisy UI's primary color with opacity */
  box-shadow: 0 0 0 3px oklch(var(--p) / 0.2);
}

/* Filter Section */
.todos-filter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

/* Table Container */
.table-container {
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  border-radius: 8px;
  /* Use Daisy UI border colors */
  border: 1px solid oklch(var(--b3));
}

.table {
  margin: 0;
}

.table th {
  position: sticky;
  top: 0;
  /* Use Daisy UI background colors */
  background: oklch(var(--b2) / 0.9);
  backdrop-filter: blur(10px);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
}

/* Todo Items */
.todo-item {
  transition: all 0.3s ease;
  /* Use Daisy UI border colors */
  border-bottom: 1px solid oklch(var(--b3) / 0.5);
}

.todo-item:hover {
  /* Use Daisy UI background colors */
  background: oklch(var(--b2) / 0.3);
  transform: translateX(4px);
}

.todo-item.dragging {
  opacity: 0.5;
  transform: rotate(2deg) scale(1.02);
  box-shadow: var(--shadow-medium);
}

.todo-item.subtask {
  /* Use Daisy UI background colors */
  background: oklch(var(--b2) / 0.2);
  /* Use Daisy UI primary color for the left border */
  border-left: 3px solid oklch(var(--p));
}

.todo-item .badge {
  font-size: 10px;
  font-weight: 600;
}

/* Buttons */
.btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  font-weight: 600;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-light);
}

.btn-xs {
  padding: 4px 8px;
  min-height: 24px;
  font-size: 11px;
}

.btn-sm {
  padding: 6px 12px;
  min-height: 32px;
  font-size: 12px;
}

.expand-btn {
  min-width: 24px !important;
  padding: 2px !important;
}

/* Theme Switcher */
.theme-switcher {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

/* Custom Modal Styles */
.modal {
  backdrop-filter: blur(4px);
}

.modal-box {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-in;
}

.animate-slide-in {
  animation: slideInDown 0.3s ease-out;
}

/* Highlight Search Results */
mark {
  background-color: rgba(255, 255, 0, 0.3);
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
}

/* Custom Scrollbar - use theme colors */
.table-container::-webkit-scrollbar {
  width: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: oklch(var(--b2) / 0.5);
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: oklch(var(--b3));
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: oklch(var(--bc) / 0.5);
}

/* Statistics Cards - use Daisy UI colors */
.stats {
  background: oklch(var(--b2) / 0.5);
  border-radius: var(--border-radius);
  border: 1px solid oklch(var(--b3) / 0.5);
}

.stat {
  padding: 16px;
}

.stat-value {
  font-weight: 800;
  font-size: 24px;
}

.stat-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Responsive Design */
@media only screen and (max-width: 768px) {
  .container {
    margin: 10px;
    padding: 16px;
    min-width: 95%;
  }

  header h1 {
    font-size: 28px;
  }

  .input-section {
    flex-direction: column;
    gap: 8px;
  }

  .input-section input {
    width: 100%;
  }

  .todos-filter {
    flex-direction: column;
    align-items: stretch;
  }

  .search-filter-section .flex {
    flex-direction: column;
  }

  .stats {
    overflow-x: auto;
  }

  .stats-horizontal .stat {
    min-width: 120px;
  }

  .table-container {
    max-height: 50vh;
  }
}

@media only screen and (max-width: 480px) {
  .container {
    margin: 5px;
    padding: 12px;
  }

  header h1 {
    font-size: 24px;
  }

  .stat-value {
    font-size: 18px;
  }

  .btn-xs {
    padding: 2px 4px;
    min-height: 20px;
    font-size: 10px;
  }

  .todo-item td {
    padding: 8px 4px;
    font-size: 12px;
  }
}

/* Remove dark mode overrides that conflict with Daisy UI themes */
/* Let Daisy UI handle all theme variations */

/* Loading States - use theme colors */
.loading-skeleton {
  background: linear-gradient(
    90deg,
    oklch(var(--b2) / 0.5) 25%,
    oklch(var(--b3) / 0.7) 50%,
    oklch(var(--b2) / 0.5) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Accessibility Improvements - use theme colors */
.btn:focus,
.input:focus {
  outline: 2px solid oklch(var(--p));
  outline-offset: 2px;
}

/* Help Modal - use theme colors */
.kbd {
  background: oklch(var(--b3) / 0.5);
  border: 1px solid oklch(var(--bc) / 0.2);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 11px;
  font-weight: 600;
}

/* Drag and Drop Visual Feedback - use theme colors */
.drag-over {
  background: oklch(var(--p) / 0.1);
  border: 2px dashed oklch(var(--p));
  border-radius: 8px;
}

.drag-placeholder {
  height: 2px;
  background: oklch(var(--p));
  border-radius: 1px;
  margin: 4px 0;
  opacity: 0.7;
}

/* Enhanced Button States */
.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-group .btn {
  margin: 0;
}

.btn-group .btn:not(:last-child) {
  border-right: 1px solid oklch(var(--bc) / 0.1);
}

/* Status Badges - use Daisy UI semantic colors */
.badge-success {
  background: linear-gradient(135deg, oklch(var(--su)), oklch(var(--su) / 0.8));
}

.badge-warning {
  background: linear-gradient(135deg, oklch(var(--wa)), oklch(var(--wa) / 0.8));
}

.badge-info {
  background: linear-gradient(135deg, oklch(var(--p)), oklch(var(--s)));
}

/* Loading Animation for Actions */
.btn.loading::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 8px;
}

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

/* Enhanced Focus States - use theme colors */
.input:focus-visible,
.btn:focus-visible {
  outline: 2px solid oklch(var(--p));
  outline-offset: 2px;
}

/* Subtask Indentation - use theme colors */
.subtask {
  position: relative;
}

.subtask::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: oklch(var(--p));
  opacity: 0.3;
}

/* Task Completion Animation */
.todo-item.completing {
  animation: taskComplete 0.5s ease-out;
}

@keyframes taskComplete {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Empty State Illustration - use theme colors */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: oklch(var(--bc) / 0.6);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Search Result Highlighting - use theme colors */
.search-highlight {
  background: oklch(var(--wa) / 0.3);
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
  animation: highlight 0.3s ease-out;
}

@keyframes highlight {
  from {
    background: oklch(var(--wa) / 0.8);
    transform: scale(1.05);
  }
  to {
    background: oklch(var(--wa) / 0.3);
    transform: scale(1);
  }
}

/* Performance optimizations */
.table-container {
  contain: layout style paint;
}

.todo-item {
  contain: layout paint;
}

/* Print Styles - make them theme-neutral */
@media print {
  body {
    background: white !important;
  }

  .container {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }

  .theme-switcher,
  .btn,
  .dropdown {
    display: none !important;
  }

  .todo-item {
    break-inside: avoid;
    color: black !important;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
