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

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 */

/* Mobile-first responsive design improvements */
@media (max-width: 640px) {
  /* Hide horizontal scrollbars on mobile */
  html, body {
    overflow-x: hidden;
  }

  /* Ensure cards don't break layout on small screens */
  .sm\:grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Better spacing for mobile forms */
  input, select, textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Utility classes for better component styling */
.line-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.line-clamp-3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* Custom scrollbar for better UX */
.scrollbar-thin {
  scrollbar-width: thin;
  scrollbar-color: rgb(163 163 163) rgb(245 245 245);
}

.scrollbar-thin::-webkit-scrollbar {
  width: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
  background: rgb(245 245 245);
  border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background: rgb(163 163 163);
  border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
  background: rgb(115 115 115);
}

/* Hide default number input spinners/arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type="number"] {
  -moz-appearance: textfield;
}

/* Smooth transitions for better perceived performance */
* {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

/* Loading states */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 1.5s infinite;
  content: '';
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* Safe area handling for mobile devices */
@supports (padding: max(0px)) {
  .safe-area-inset-top {
    padding-top: max(1rem, env(safe-area-inset-top));
  }

  .safe-area-inset-bottom {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .safe-area-inset-left {
    padding-left: max(1rem, env(safe-area-inset-left));
  }

  .safe-area-inset-right {
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* Custom animations for interactions */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  .bg-neutral-50 {
    background-color: white;
  }

  .bg-neutral-100 {
    background-color: #f0f0f0;
  }

  .text-neutral-600 {
    color: #333;
  }

  .border-neutral-200 {
    border-color: #666;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Dark mode preparation (for future enhancement) */

/* Enhanced button feedback animations */
.btn-feedback {
  transform-origin: center;
  transition: all 0.15s ease-out;
}

.btn-feedback:active {
  transform: scale(0.95);
}

/* Touch feedback for mobile */
@media (hover: none) and (pointer: coarse) {
  .btn-feedback:active {
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
  }
}

/* Input field feedback animation */
.input-feedback {
  transition: all 0.15s ease-out;
}

.input-feedback:focus {
  transform: scale(1.02);
}

/* Ripple effect for buttons (optional enhancement) */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

.ripple:active::before {
  width: 300px;
  height: 300px;
}
@media (prefers-color-scheme: dark) {
  /* These would be implemented when dark mode is added */
  /*
  .bg-white {
    background-color: #1f1f1f;
  }

  .text-neutral-900 {
    color: #ffffff;
  }
  */
}

/* Minimalist design enhancements */
.minimalist-shadow {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

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

/* Clean form styles */
.form-input {
  @apply w-full px-4 py-3 border border-neutral-300 rounded-lg;
  @apply focus:ring-2 focus:ring-neutral-500 focus:border-transparent;
  @apply transition-colors text-neutral-900 placeholder-neutral-400;
}

/* Minimalist button variants */
.btn-minimal {
  @apply px-6 py-3 rounded-lg font-medium transition-all duration-200;
  @apply focus:outline-none focus:ring-2 focus:ring-offset-2;
}

.btn-primary {
  @apply bg-neutral-900 text-white hover:bg-neutral-800;
  @apply focus:ring-neutral-500;
}

.btn-secondary {
  @apply border-2 border-neutral-300 text-neutral-700;
  @apply hover:bg-neutral-50 focus:ring-neutral-500;
}

.btn-ghost {
  @apply text-neutral-600 hover:text-neutral-900 hover:bg-neutral-100;
  @apply focus:ring-neutral-500;
}

/* Card improvements */
.card-minimal {
  @apply bg-white rounded-xl border border-neutral-200;
  @apply transition-all duration-200 hover:shadow-md;
}

.card-elevated {
  @apply bg-white rounded-xl shadow-sm;
  @apply transition-all duration-200 hover:shadow-lg;
}

/* Typography improvements */
.text-balance {
  text-wrap: balance;
}

/* Subtle animations */
.hover-lift {
  transition: transform 0.2s ease-out;
}

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

/* Glass effect for modern look */
.glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Improved mobile spacing */
@media (max-width: 640px) {
  .mobile-safe-padding {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .mobile-bottom-safe {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

/* PWA-specific styles */
@media (display-mode: standalone) {
  /* Hide address bar remnants */
  html, body {
    overscroll-behavior: none;
  }

  /* Improve touch interactions */
  .pwa-mode {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  /* Safe area handling for notched devices */
  .pwa-mode .safe-top {
    padding-top: env(safe-area-inset-top);
  }

  .pwa-mode .safe-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .pwa-mode .safe-left {
    padding-left: env(safe-area-inset-left);
  }

  .pwa-mode .safe-right {
    padding-right: env(safe-area-inset-right);
  }

  /* Enhanced bottom navigation for PWA */
  .pwa-mode .bottom-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding-bottom: calc(env(safe-area-inset-bottom) + 0.5rem);
  }

  /* Improved button interactions */
  .pwa-mode button,
  .pwa-mode .btn {
    touch-action: manipulation;
  }

  /* Disable zoom on input focus (iOS) */
  .pwa-mode input[type="text"],
  .pwa-mode input[type="email"],
  .pwa-mode input[type="password"],
  .pwa-mode textarea,
  .pwa-mode select {
    font-size: 16px;
  }
}

/* Additional mobile enhancements */
@media (max-width: 768px) {
  .pwa-touch-target {
    min-height: 44px;
    min-width: 44px;
  }
}
