/* Mobile-specific styles for LocalGreenChain PWA */

/* Safe area padding for notched devices */
.pt-safe {
  padding-top: env(safe-area-inset-top, 0);
}

.pb-safe {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.pl-safe {
  padding-left: env(safe-area-inset-left, 0);
}

.pr-safe {
  padding-right: env(safe-area-inset-right, 0);
}

/* Scanning line animation for QR scanner */
@keyframes scan-line {
  0% {
    top: 0;
  }
  50% {
    top: 100%;
  }
  100% {
    top: 0;
  }
}

.animate-scan-line {
  animation: scan-line 2s ease-in-out infinite;
}

/* Slide up animation for install prompt */
@keyframes slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

/* Touch-friendly tap targets */
.touch-target {
  min-width: 44px;
  min-height: 44px;
}

/* Prevent text selection on interactive elements */
.no-select {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Prevent zoom on double-tap for buttons */
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

/* Smooth scrolling with overscroll behavior */
.scroll-container {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Hide scrollbar on mobile while keeping functionality */
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Pull to refresh indicator styling */
.pull-indicator {
  transition: transform 0.2s ease-out;
}

/* Swipeable card styling */
.swipeable-card {
  touch-action: pan-y;
  will-change: transform;
}

/* Bottom navigation bar styling */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav {
    padding-bottom: calc(env(safe-area-inset-bottom) + 0.5rem);
  }
}

/* Mobile form styling improvements */
@media (max-width: 768px) {
  /* Larger touch targets for form elements */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: 0.875rem;
  }

  /* Full-width buttons */
  .btn-mobile-full {
    width: 100%;
    padding: 1rem;
  }

  /* Sticky header/footer */
  .sticky-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .sticky-footer {
    position: sticky;
    bottom: 0;
    z-index: 40;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

/* Dark mode support for mobile */
@media (prefers-color-scheme: dark) {
  .dark-mode-aware {
    background-color: #1f2937;
    color: #f9fafb;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .animate-scan-line,
  .animate-slide-up,
  .animate-spin,
  .animate-pulse {
    animation: none !important;
  }

  .transition-all,
  .transition-transform,
  .transition-opacity {
    transition: none !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .border-gray-100 {
    border-color: #6b7280;
  }

  .text-gray-500 {
    color: #374151;
  }
}

/* Standalone PWA specific styles */
@media (display-mode: standalone) {
  /* Prevent overscroll on the body */
  body {
    overscroll-behavior: none;
  }

  /* Adjust padding for status bar */
  .standalone-header {
    padding-top: calc(env(safe-area-inset-top) + 0.5rem);
  }
}

/* Haptic feedback visual indicator */
.haptic-feedback:active {
  opacity: 0.7;
  transform: scale(0.98);
}

/* Camera overlay styling */
.camera-overlay {
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.6) 0%,
    transparent 20%,
    transparent 80%,
    rgba(0, 0, 0, 0.6) 100%
  );
}

/* QR scanner corner styling */
.scanner-corner {
  width: 32px;
  height: 32px;
  border-width: 4px;
  border-color: #16a34a;
}

/* Loading skeleton for mobile */
.skeleton-mobile {
  background: linear-gradient(
    90deg,
    #f3f4f6 0%,
    #e5e7eb 50%,
    #f3f4f6 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

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

/* Toast notification styling */
.toast-mobile {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 80px);
  left: 16px;
  right: 16px;
  z-index: 100;
}

/* Floating action button styling */
.fab {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 80px);
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 30;
}

/* Card swipe actions */
.swipe-action-left {
  background: linear-gradient(to left, #ef4444, #dc2626);
}

.swipe-action-right {
  background: linear-gradient(to right, #22c55e, #16a34a);
}

/* Mobile-optimized image aspect ratios */
.aspect-plant-photo {
  aspect-ratio: 4 / 3;
}

.aspect-plant-card {
  aspect-ratio: 3 / 4;
}

/* Optimized font rendering for mobile */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
