/*
 * 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.
 */

/* Use Geist font throughout */
body {
  font-family: 'Geist', sans-serif;
}

/* Custom color scheme */
:root {
  --color-background: rgb(248, 245, 240);
  --color-background-surface: rgb(255, 255, 255);
  --color-background-elevated: rgb(249, 250, 251);
  --color-accent: rgb(46, 125, 50);
  --color-accent-hover: rgb(56, 142, 60);
  --color-text: rgb(62, 39, 35);
  --color-text-muted: rgb(102, 79, 75);
  --color-border: rgb(229, 231, 235);
  --color-border-muted: rgb(209, 213, 219);
}

/* Dark mode color scheme */
.dark {
  --color-background: rgb(28, 25, 23);
  --color-background-surface: rgb(41, 37, 33);
  --color-background-elevated: rgb(55, 48, 43);
  --color-accent: rgb(76, 175, 80);
  --color-accent-hover: rgb(102, 187, 106);
  --color-text: rgb(245, 240, 235);
  --color-text-muted: rgb(168, 155, 148);
  --color-border: rgb(55, 48, 43);
  --color-border-muted: rgb(68, 60, 53);
}

/* Apply custom colors */
body {
  background-color: var(--color-background);
  color: var(--color-text);
  position: relative;
}

/* Grid pattern with fade to edges */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: -1;
  mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 50%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 50%, transparent 85%);
}

/* Accent color buttons */
.btn-accent {
  background-color: var(--color-accent);
  color: white;
}
.btn-accent:hover {
  background-color: var(--color-accent-hover);
}

/* Override blue accent colors with green */
.bg-blue-600 { background-color: var(--color-accent) !important; }
.bg-blue-500 { background-color: var(--color-accent-hover) !important; }
.hover\:bg-blue-500:hover { background-color: var(--color-accent-hover) !important; }
.hover\:bg-blue-600:hover { background-color: var(--color-accent) !important; }
.text-blue-600 { color: var(--color-accent) !important; }
.text-blue-500 { color: var(--color-accent-hover) !important; }
.hover\:text-blue-500:hover { color: var(--color-accent-hover) !important; }
.hover\:text-blue-600:hover { color: var(--color-accent) !important; }
.border-blue-200 { border-color: rgb(200, 230, 201) !important; }
.bg-blue-50 { background-color: rgb(232, 245, 233) !important; }
.text-blue-800 { color: rgb(27, 94, 32) !important; }
.text-blue-900 { color: rgb(27, 94, 32) !important; }
.ring-blue-500 { --tw-ring-color: var(--color-accent) !important; }
.focus\:ring-blue-500:focus { --tw-ring-color: var(--color-accent) !important; }

/* Override green colors to match accent green (rgb(46, 125, 50)) */
.from-green-200\/70 { --tw-gradient-from: rgba(46, 125, 50, 0.25) !important; }
.dark\:from-green-900\/30:is(.dark *) { --tw-gradient-from: rgba(46, 125, 50, 0.3) !important; }
.text-green-600 { color: rgb(46, 125, 50) !important; }
.dark\:text-green-400:is(.dark *) { color: rgb(76, 175, 80) !important; }

/* Override gray text with custom brown */
.text-gray-900 { color: var(--color-text) !important; }
.text-gray-800 { color: var(--color-text) !important; }
.text-gray-700 { color: var(--color-text-muted) !important; }
.text-gray-600 { color: var(--color-text-muted) !important; }

/* Background overrides */
.bg-gray-50 { background-color: var(--color-background) !important; }

/* Up next box styling */
.up-next-box {
  background-image: linear-gradient(to right bottom, rgba(46, 125, 50, 0.1) 0px, rgba(46, 125, 50, 0.05) 50%, rgba(0, 0, 0, 0) 100%);
  border: 1px solid rgba(46, 125, 50, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
}

.up-next-box-done {
  background-image: linear-gradient(to right bottom, rgba(46, 125, 50, 0.15) 0px, rgba(46, 125, 50, 0.08) 50%, rgba(0, 0, 0, 0) 100%);
  border: 1px solid rgba(46, 125, 50, 0.25);
  border-radius: 8px;
  padding: 12px 20px;
  text-align: center;
}

/* Pomodoro status indicator animation */
@keyframes pulse-red {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.vertical-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

/* Hide scrollbars while maintaining scroll functionality */
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Amber hover for user's own todo items */
.todo-item-self:hover {
  background-color: rgba(251, 191, 36, 0.15) !important; /* amber-400 at 15% opacity */
}

/* Drag handle touch support */
.drag-handle {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Multi-select style for sortable todos */
.sortable-selected {
  background-color: rgba(59, 130, 246, 0.15) !important; /* blue-500 at 15% opacity */
  outline: 2px solid rgba(59, 130, 246, 0.5) !important;
  outline-offset: -2px;
}

/* Multi-drag count badge */
.multi-drag-badge {
  position: fixed;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background-color: rgb(59, 130, 246); /* blue-500 */
  color: white;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  pointer-events: none;
}

.dark .multi-drag-badge {
  background-color: rgb(96, 165, 250); /* blue-400 */
  color: rgb(30, 41, 59); /* slate-800 */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Vim navigation focus style */
.vim-focused {
  background-color: rgb(253, 230, 138) !important; /* amber-200 */
  outline: 2px solid rgb(245, 158, 11) !important; /* amber-500 */
  outline-offset: -2px;
}

/* Progress bar - smooth width transition only, no barber pole animation */
.progress-bar-fill {
  transition: width 500ms ease-out;
  animation: none !important;
  background-image: none !important;
}

/* Poke notification animations */
@keyframes slide-in-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slide-out-down {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

@keyframes slide-in-right {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-out-right {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Mobile: slide up from bottom */
.animate-slide-in {
  animation: slide-in-up 0.3s ease-out forwards;
}

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

/* Desktop (sm and up): slide in from right */
@media (min-width: 640px) {
  .animate-slide-in {
    animation: slide-in-right 0.3s ease-out forwards;
  }

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

.poke-timer-bar {
  transition: width 100ms linear;
}

.poke-notification {
  margin-bottom: 0.5rem;
}

/* Section highlight animation for scroll-to navigation */
@keyframes section-highlight {
  0%, 80% {
    box-shadow: inset 0 0 0 3px rgb(234 179 8 / 0.7); /* yellow-500, bolder */
  }
  100% {
    box-shadow: inset 0 0 0 3px transparent;
  }
}

.animate-section-highlight {
  animation: section-highlight 2.5s ease-out forwards;
}

/* Wiggle animation for poke */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(-3deg); }
  20% { transform: rotate(3deg); }
  30% { transform: rotate(-3deg); }
  40% { transform: rotate(3deg); }
  50% { transform: rotate(-2deg); }
  60% { transform: rotate(2deg); }
  70% { transform: rotate(-1deg); }
  80% { transform: rotate(1deg); }
  90% { transform: rotate(0deg); }
}

.animate-wiggle {
  animation: wiggle 0.6s ease-in-out;
}

/* Sparkle animation for poke confirmation */
@keyframes sparkle {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes sparkle-ring {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.5);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.animate-sparkle {
  animation: sparkle 0.4s ease-out;
}

.animate-sparkle-ring {
  position: absolute;
  inset: -4px;
  border: 2px solid currentColor;
  border-radius: 9999px;
  animation: sparkle-ring 0.5s ease-out forwards;
  pointer-events: none;
}

/* Dark mode grid pattern */
.dark body::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
}

/* Dark mode vim navigation focus style */
.dark .vim-focused {
  background-color: rgb(120, 80, 40) !important;
  outline-color: rgb(180, 120, 60) !important;
}

/* Dark mode hover for user's own todo items */
.dark .todo-item-self:hover {
  background-color: rgba(251, 191, 36, 0.1) !important; /* amber-400 at 10% opacity */
}

/* Dark mode multi-select style for sortable todos */
.dark .sortable-selected {
  background-color: rgba(59, 130, 246, 0.2) !important; /* blue-500 at 20% opacity */
  outline-color: rgba(59, 130, 246, 0.6) !important;
}

/* Dark mode up-next box styling */
.dark .up-next-box {
  background-image: linear-gradient(to right bottom, rgba(76, 175, 80, 0.15) 0px, rgba(76, 175, 80, 0.08) 50%, rgba(0, 0, 0, 0) 100%);
  border-color: rgba(76, 175, 80, 0.3);
}

.dark .up-next-box-done {
  background-image: linear-gradient(to right bottom, rgba(76, 175, 80, 0.2) 0px, rgba(76, 175, 80, 0.1) 50%, rgba(0, 0, 0, 0) 100%);
  border-color: rgba(76, 175, 80, 0.35);
}

/* Dark mode form inputs */
.dark input[type="text"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="number"],
.dark textarea,
.dark select {
  background-color: var(--color-background-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

.dark input[type="text"]::placeholder,
.dark input[type="email"]::placeholder,
.dark input[type="password"]::placeholder,
.dark textarea::placeholder {
  color: var(--color-text-muted);
}

/* Dark mode focus rings */
.dark input:focus,
.dark textarea:focus,
.dark select:focus {
  border-color: var(--color-accent);
  --tw-ring-color: var(--color-accent);
}

/* Popovers and tooltips should always be fully opaque, even in completed/struck todos */
/* Since CSS opacity inheritance cannot be overridden, these elements need position: fixed */
/* which is handled by JavaScript to escape the parent's opacity context */
.popover-opaque {
  opacity: 1 !important;
}

/* Homepage animations */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes gentle-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.8);
  }
  50% {
    transform: translateY(6px) scale(1.03);
  }
  75% {
    transform: translateY(-2px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-bounce-in {
  animation: bounce-in 0.5s ease-out forwards;
  opacity: 0;
  display: inline-block;
}

.animate-fade-in-up {
  animation: fade-in-up 0.6s ease-out forwards;
  opacity: 0;
}

.animate-fade-in {
  animation: fade-in 0.5s ease-out forwards;
  opacity: 0;
}

.animate-gentle-float {
  animation: gentle-float 4s ease-in-out infinite;
}

/* Staggered animation delays for feature cards */
.animate-delay-100 { animation-delay: 100ms; }
.animate-delay-200 { animation-delay: 200ms; }
.animate-delay-300 { animation-delay: 300ms; }
.animate-delay-400 { animation-delay: 400ms; }
.animate-delay-500 { animation-delay: 500ms; }
.animate-delay-600 { animation-delay: 600ms; }
.animate-delay-700 { animation-delay: 700ms; }
.animate-delay-800 { animation-delay: 800ms; }

/* Feature card hover effect */
.feature-card {
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.dark .feature-card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

/* Floating flash animations (always slide from right) */
.animate-slide-in-right {
  animation: slide-in-right 0.3s ease-out forwards;
}

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

/* Command Palette (ninja-keys) theming */
ninja-keys {
  --ninja-accent-color: var(--color-accent);
  --ninja-font-family: 'Geist', sans-serif;
  --ninja-z-index: 9999;

  /* Light mode */
  --ninja-modal-background: var(--color-background-surface);
  --ninja-overflow-background: rgba(0, 0, 0, 0.5);
  --ninja-text-color: var(--color-text);
  --ninja-secondary-text-color: var(--color-text-muted);
  --ninja-selected-background: rgb(243, 244, 246); /* gray-100 */
  --ninja-footer-background: var(--color-background-elevated);

  /* Input field */
  --ninja-placeholder-color: var(--color-text-muted);

  /* Icon colors */
  --ninja-icon-color: var(--color-text-muted);

  /* Key badges */
  --ninja-key-border-radius: 4px;
}

.dark ninja-keys {
  --ninja-modal-background: var(--color-background-surface);
  --ninja-overflow-background: rgba(0, 0, 0, 0.7);
  --ninja-text-color: var(--color-text);
  --ninja-secondary-text-color: var(--color-text-muted);
  --ninja-selected-background: var(--color-background-elevated);
  --ninja-footer-background: var(--color-background);
  --ninja-placeholder-color: var(--color-text-muted);
  --ninja-icon-color: var(--color-text-muted);
  --ninja-accent-color: var(--color-accent);
}

/* Ultra-wide dashboard container for large displays */
@media (min-width: 1920px) {
  .dashboard-wide {
    max-width: 95vw;
  }
}

@media (min-width: 2560px) {
  .dashboard-wide {
    max-width: 92vw;
  }
}
