/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Task Completion Animations */

/* Base styles for all animations */
.task-row {
  transition: background-color 0.3s ease;
  position: relative;
}

/* 1. Bounce animation */
.task-complete-bounce {
  transform-box: fill-box;
  /* SVG: use element's own bounding box as transform reference */
  transform-origin: center;
  /* SVG: scale from the element's own center */
  animation: task-bounce 0.9s ease-in-out forwards;
}

@keyframes task-bounce {
  0% {
    transform: scale(1);
    background-color: transparent;
  }

  20% {
    transform: scale(1.14);
    background-color: rgba(74, 222, 128, 0.25);
  }

  40% {
    transform: scale(0.93);
    background-color: rgba(74, 222, 128, 0.1);
  }

  60% {
    transform: scale(1.08);
    background-color: rgba(74, 222, 128, 0.15);
  }

  80% {
    transform: scale(0.97);
    background-color: transparent;
  }

  100% {
    transform: scale(1);
    background-color: transparent;
  }
}

/* 2. Sparkle animation */
.task-complete-sparkle {
  position: relative;
  overflow: hidden;
  /* clip gradient sweep to node border */
  animation: task-sparkle-bg 1s ease-in-out forwards;
}

@keyframes task-sparkle-bg {
  0% {
    background-color: transparent;
  }

  35% {
    background-color: rgba(74, 222, 128, 0.3);
  }

  100% {
    background-color: transparent;
  }
}

.task-complete-sparkle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 1) 50%, transparent 70%);
  background-size: 300% 300%;
  animation: task-sparkle-gradient 1s ease-in-out forwards;
  pointer-events: none;
}

@keyframes task-sparkle-gradient {
  0% {
    background-position: 150% 150%;
    opacity: 0;
  }

  40% {
    opacity: 1;
  }

  100% {
    background-position: -50% -50%;
    opacity: 0;
  }
}

/* 3. Glow animation */
.task-complete-glow {
  animation: task-glow 1.2s ease-in-out forwards;
}

@keyframes task-glow {
  0% {
    filter: drop-shadow(0 0 0px rgba(74, 222, 128, 0));
  }

  50% {
    filter: drop-shadow(0 0 14px rgba(74, 222, 128, 0.95));
  }

  100% {
    filter: drop-shadow(0 0 0px rgba(74, 222, 128, 0));
  }
}

/* 4. Checkmark animation */
.task-complete-checkmark {
  position: relative;
  overflow: hidden;
}

.task-complete-checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  color: #4ade80;
  font-size: 5rem;
  opacity: 0;
  animation: task-checkmark 1s ease-in-out forwards;
  pointer-events: none;
}

@keyframes task-checkmark {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }

  30% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.8;
  }

  70% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.9;
  }

  100% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
}

/* 5. Wave animation */
.task-complete-wave {
  position: relative;
  overflow: hidden;
  /* clip ripple expansion to node border */
  animation: task-wave-node 1s ease-out forwards;
}

@keyframes task-wave-node {
  0% {
    transform: scale(1);
  }

  30% {
    transform: scale(1.07);
  }

  100% {
    transform: scale(1);
  }
}

.task-complete-wave::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle, rgba(74, 222, 128, 1) 0%, rgba(74, 222, 128, 0) 70%);
  transform: scale(0);
  transform-origin: center;
  border-radius: 50%;
  animation: task-wave-ripple 1s ease-out forwards;
  pointer-events: none;
}

@keyframes task-wave-ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }

  100% {
    transform: scale(5);
    opacity: 0;
  }
}

/* Custom fixes for Task Nibbler UI issues */

/* Fix dropdown selected items in dark mode */
.dark .multiselect-selected,
.dark [data-multiselect-target="option"].multiselect-selected {
  background-color: #2563eb !important;
  /* blue-600 */
  color: white !important;
}

/* Make tree view nodes focusable for keyboard shortcuts */
.task-node {
  outline: none;
}

.task-node:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Fix autofill input contrast issues */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
input[type="tel"]:-webkit-autofill,
input[type="tel"]:-webkit-autofill:hover,
input[type="tel"]:-webkit-autofill:focus,
input[type="tel"]:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px white inset !important;
  -webkit-text-fill-color: #111827 !important;
  background-color: white !important;
  background-image: none !important;
  transition: background-color 5000s ease-in-out 0s;
}

input:-webkit-autofill::first-line {
  color: #111827 !important;
  font-size: inherit !important;
}

/* Dark mode autofill styles */
.dark input:-webkit-autofill,
.dark input:-webkit-autofill:hover,
.dark input:-webkit-autofill:focus,
.dark input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px #1f2937 inset !important;
  -webkit-text-fill-color: #f9fafb !important;
  background-color: #1f2937 !important;
  background-image: none !important;
}

.dark input:-webkit-autofill::first-line {
  color: #f9fafb !important;
}

/* Hide scrollbar for horizontal scroll containers */
.scrollbar-hide {
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari and Opera */
}

/* Undo reappear glow animation for tasks that reappear after undo */
.task-undo-reappear {
  animation: task-undo-glow 1.5s ease-in-out forwards;
}

@keyframes task-undo-glow {
  0% {
    filter: drop-shadow(0 0 0px rgba(99, 102, 241, 0));
  }

  25% {
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 1));
  }

  50% {
    filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.8));
  }

  75% {
    filter: drop-shadow(0 0 18px rgba(99, 102, 241, 0.9));
  }

  100% {
    filter: drop-shadow(0 0 0px rgba(99, 102, 241, 0));
  }
}

/* Documentation Prose Styles */

.docs-prose {
  color: #374151;
  font-size: 0.9375rem;
  line-height: 1.75;
}

.docs-prose h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  margin-top: 0;
  margin-bottom: 1rem;
  line-height: 1.25;
}

.docs-prose h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid #e5e7eb;
  line-height: 1.3;
}

.docs-prose h2:first-child {
  margin-top: 0;
}

.docs-prose h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #1f2937;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.docs-prose h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #374151;
  margin-top: 1.25rem;
  margin-bottom: 0.375rem;
}

.docs-prose p {
  margin-top: 0;
  margin-bottom: 1rem;
}

.docs-prose a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.docs-prose a:hover {
  color: #1d4ed8;
}

.docs-prose strong {
  font-weight: 600;
  color: #111827;
}

.docs-prose ul,
.docs-prose ol {
  margin-top: 0;
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.docs-prose li {
  margin-bottom: 0.375rem;
}

.docs-prose li>ul,
.docs-prose li>ol {
  margin-top: 0.375rem;
  margin-bottom: 0.375rem;
}

.docs-prose ul>li {
  list-style-type: disc;
}

.docs-prose ol>li {
  list-style-type: decimal;
}

.docs-prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.docs-prose thead {
  background-color: #f3f4f6;
}

.docs-prose th {
  text-align: left;
  font-weight: 600;
  color: #374151;
  padding: 0.5rem 0.875rem;
  border: 1px solid #e5e7eb;
}

.docs-prose td {
  padding: 0.5rem 0.875rem;
  border: 1px solid #e5e7eb;
  color: #4b5563;
  vertical-align: top;
}

.docs-prose tr:nth-child(even) td {
  background-color: #f9fafb;
}

.docs-prose code {
  background-color: #f3f4f6;
  color: #1f2937;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.docs-prose pre {
  background-color: #1f2937;
  color: #e5e7eb;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.docs-prose pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.docs-prose blockquote {
  border-left: 4px solid #4f46e5;
  background-color: #eff6ff;
  margin: 0 0 1.25rem 0;
  padding: 0.75rem 1rem;
  border-radius: 0 0.375rem 0.375rem 0;
  color: #1e40af;
}

.docs-prose blockquote p {
  margin-bottom: 0;
}

.docs-prose hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 2rem 0;
}

.docs-prose figure.docs-screenshot {
  margin: 1.5rem 0;
  text-align: center;
}

.docs-prose figure.docs-screenshot img {
  max-width: 100%;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.docs-prose figure.docs-screenshot figcaption {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: #6b7280;
  font-style: italic;
}

/* Dark mode docs prose */
.dark .docs-prose {
  color: #d1d5db;
}

.dark .docs-prose h1,
.dark .docs-prose h2,
.dark .docs-prose h3,
.dark .docs-prose h4 {
  color: #f9fafb;
}

.dark .docs-prose h2 {
  border-bottom-color: #374151;
}

.dark .docs-prose strong {
  color: #f9fafb;
}

.dark .docs-prose a {
  color: #60a5fa;
}

.dark .docs-prose a:hover {
  color: #93c5fd;
}

.dark .docs-prose table thead {
  background-color: #374151;
}

.dark .docs-prose th {
  color: #e5e7eb;
  border-color: #4b5563;
}

.dark .docs-prose td {
  color: #d1d5db;
  border-color: #4b5563;
}

.dark .docs-prose tr:nth-child(even) td {
  background-color: #1f2937;
}

.dark .docs-prose code {
  background-color: #374151;
  color: #e5e7eb;
}

.dark .docs-prose blockquote {
  background-color: #1e3a5f;
  border-left-color: #818cf8;
  color: #bfdbfe;
}

.dark .docs-prose hr {
  border-top-color: #374151;
}

.dark .docs-prose figure.docs-screenshot img {
  border-color: #374151;
}

/* Mobile Task Move Styles */
.mobile-task-move-sheet {
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-task-move-sheet.open {
  transform: translateY(0);
}

.mobile-task-move-backdrop {
  transition: opacity 0.3s ease-in-out;
}

/* Ensure proper touch targets on mobile */
@media (max-width: 640px) {
  .mobile-task-move-button {
    min-width: 44px;
    min-height: 44px;
  }

  .mobile-task-move-option {
    min-height: 44px;
  }
}