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

/* Enhanced Drag and Drop Styles */
.dragging {
  cursor: grabbing !important;
  user-select: none;
  opacity: 0.8;
  transform: rotate(2deg) scale(1.02);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.dragging * {
  pointer-events: none;
}

/* Mobile touch pressing state */
.touch-pressing {
  background-color: rgba(59, 130, 246, 0.05);
  transform: scale(1.01);
  transition: all 0.15s ease-out;
}

/* Drag clone for mobile */
.drag-clone {
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border-radius: 0.5rem;
}

/* Drop zone states */
.drop-zone-valid {
  background-color: rgba(34, 197, 94, 0.1) !important;
  border-color: rgb(34, 197, 94) !important;
  border-style: solid !important;
  border-width: 2px !important;
  transform: scale(1.02);
}

.drop-zone-invalid {
  background-color: rgba(239, 68, 68, 0.1) !important;
  border-color: rgb(239, 68, 68) !important;
  border-style: solid !important;
  border-width: 2px !important;
  transform: scale(1.01);
}

.drop-loading {
  position: relative;
}

.drop-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-top: 2px solid rgb(59, 130, 246);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.drop-success {
  background-color: rgba(34, 197, 94, 0.1) !important;
  animation: successPulse 0.6s ease-out;
}

.drop-error {
  background-color: rgba(239, 68, 68, 0.1) !important;
  animation: errorShake 0.6s ease-out;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Custom scale classes for better control */
.scale-102 {
  transform: scale(1.02);
}

/* Smooth transitions for drag and drop */
[data-drag-drop-target="card"] {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

[data-drag-drop-target="column"] {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* Enhanced hover effects */
[data-drag-drop-target="card"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Drag handle hover effect */
[data-drag-drop-target="card"] .cursor-grab:hover {
  transform: scale(1.1);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Button hover animations */
button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

/* Dropdown animations */
[data-dropdown-target="menu"] {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: top right;
}

[data-dropdown-target="menu"]:not(.hidden) {
  animation: dropdownSlideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Drop zone animations */
.drag-drop-overlay {
  animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Loading states */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Focus animations */
[data-keyboard-navigation-target="card"]:focus {
  animation: focusRing 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes focusRing {
  from {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
  }
  to {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  }
}

/* Stagger animations for multiple cards */
[data-drag-drop-target="card"]:nth-child(1) { animation-delay: 0ms; }
[data-drag-drop-target="card"]:nth-child(2) { animation-delay: 50ms; }
[data-drag-drop-target="card"]:nth-child(3) { animation-delay: 100ms; }
[data-drag-drop-target="card"]:nth-child(4) { animation-delay: 150ms; }
[data-drag-drop-target="card"]:nth-child(5) { animation-delay: 200ms; }

/* Enhanced card shadows */
.shadow-card {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.shadow-card-hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dark .shadow-card {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
}

.dark .shadow-card-hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

/* Extended gray palette utilities */
.bg-gray-25 {
  background-color: #fafafa;
}

.dark .bg-gray-850 {
  background-color: #1e1e1e;
}

.bg-blue-25 {
  background-color: #f8faff;
}

.bg-green-25 {
  background-color: #f7fef8;
}

/* Status indicator animations */
.status-dot {
  transition: all 0.2s ease-in-out;
}

.status-dot.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Enhanced card hover effects */
[data-drag-drop-target="card"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Enhanced button touch targets for mobile */
@media (max-width: 768px) {
  [data-drag-drop-target="card"] button,
  [data-drag-drop-target="card"] .min-h-\[44px\] {
    min-height: 48px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  /* Larger drag handle on mobile */
  [data-drag-drop-target="card"] .cursor-grab svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  /* Increased spacing on mobile for better card separation */
  .space-y-4 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 1.25rem;
  }
}

/* Keyboard navigation focus styles */
[data-keyboard-navigation-target="card"]:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgb(59 130 246), 0 0 0 4px rgba(59 130 246, 0.2);
}

.dark [data-keyboard-navigation-target="card"]:focus {
  box-shadow: 0 0 0 2px rgb(96 165 250), 0 0 0 4px rgba(96 165 250, 0.2);
}

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

/* Skip to main content link */
.skip-to-main:focus {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: #1F2937;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  z-index: 100;
  font-weight: 500;
}

/* Flash message animations */
@keyframes slide-down {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slide-up-fade {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-20px);
    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;
  }
}

@keyframes shrink-width {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

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

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

.animate-shrink-width {
  animation: shrink-width 3s linear;
}

/* Flash message mobile optimizations */
@media (max-width: 640px) {
  #flash-container {
    left: 1rem;
    right: 1rem;
    top: 1rem;
  }
}

/* Flash message reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .animate-slide-down,
  .animate-shrink-width {
    animation: none;
  }
}

/* Mobile safe area support for bottom navigation */
.safe-area-inset-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .safe-area-inset-bottom {
    padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
  }
}

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

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

/* Search modal mobile optimizations */
@media (max-width: 1024px) {
  #search-modal {
    border-radius: 0 !important;
    max-height: 100vh !important;
  }

  .search-result-item {
    min-height: 60px; /* Larger touch targets */
  }

  .search-result-item:active {
    background-color: rgba(0, 0, 0, 0.05);
  }

  .dark .search-result-item:active {
    background-color: rgba(255, 255, 255, 0.05);
  }
}

/* Mobile-optimized project metrics text */
@media (max-width: 640px) {
  [id^="project_"][id$="_switcher_metrics"] h2 {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  [id^="project_"][id$="_switcher_metrics"] .text-sm {
    font-size: 0.75rem;
    line-height: 1rem;
  }
}
