/**
 * Recipe Extractor - Enhanced Styles
 * Complete styling for the advanced Recipe Extractor web application
 */

/* CSS Variables for consistent theming */
:root {
  --primary-50: #fff7ed;
  --primary-100: #ffedd5;
  --primary-200: #fed7aa;
  --primary-300: #fdba74;
  --primary-400: #fb923c;
  --primary-500: #f97316;
  --primary-600: #ea580c;
  --primary-700: #c2410c;
  --primary-800: #9a3412;
  --primary-900: #7c2d12;
  
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
}

.dark {
  --gray-50: #1f2937;
  --gray-100: #374151;
  --gray-200: #4b5563;
  --gray-300: #6b7280;
  --gray-400: #9ca3af;
  --gray-500: #d1d5db;
  --gray-600: #e5e7eb;
  --gray-700: #f3f4f6;
  --gray-800: #f9fafb;
  --gray-900: #ffffff;
}

/* Base styles */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

.dark ::-webkit-scrollbar-thumb {
  background: var(--gray-600);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

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

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

/* Enhanced recipe card animations */
.recipe-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(0);
}

.recipe-card:hover {
  transform: translateY(-4px) translateZ(0);
}

.dark .recipe-card:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

/* Form input enhancements */
input[type="text"], 
input[type="url"], 
input[type="email"],
textarea,
select {
  transition: all 0.2s ease-in-out;
}

input:focus, 
textarea:focus,
select:focus {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.15);
}

.dark input:focus,
.dark textarea:focus,
.dark select:focus {
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

/* Button styles */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  transition: all 0.2s ease-in-out;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

/* Loading animation */
.loading {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Pulse animation */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Enhanced modal styling */
.modal-backdrop {
  backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.dark .modal-backdrop {
  background: rgba(0, 0, 0, 0.6);
}

/* Tag styles */
.recipe-tag {
  transition: all 0.2s ease;
}

.recipe-tag:hover {
  transform: scale(1.05);
}

/* Star rating styles */
.star-btn {
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.star-btn:hover {
  transform: scale(1.1);
}

/* Advanced filter panel animations */
.filter-panel {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.filter-panel.collapsed {
  max-height: 0;
  opacity: 0;
}

.filter-panel.expanded {
  max-height: 500px;
  opacity: 1;
}

/* Shopping list item styles */
.shopping-item {
  transition: all 0.3s ease;
}

.shopping-item.completed {
  opacity: 0.6;
  transform: translateX(8px);
}

.shopping-item:hover {
  background-color: var(--primary-50);
}

.dark .shopping-item:hover {
  background-color: rgba(249, 115, 22, 0.1);
}

/* Enhanced checkbox styles */
input[type="checkbox"] {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--gray-300);
  border-radius: 0.25rem;
  background-color: white;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.dark input[type="checkbox"] {
  background-color: var(--gray-700);
  border-color: var(--gray-600);
}

input[type="checkbox"]:checked {
  background-color: var(--primary-500);
  border-color: var(--primary-500);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 0.375rem;
  height: 0.75rem;
  border: 2px solid white;
  border-top: none;
  border-left: none;
}

/* Progress bar animations */
.progress-bar {
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Theme toggle animation */
.theme-toggle {
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  transform: rotate(180deg);
}

/* Install banner animations */
.install-banner {
  animation: slideInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Notification animations */
.notification-enter {
  opacity: 0;
  transform: translateX(100%);
}

.notification-enter-active {
  opacity: 1;
  transform: translateX(0);
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-exit {
  opacity: 1;
  transform: translateX(0);
}

.notification-exit-active {
  opacity: 0;
  transform: translateX(100%);
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Form validation styles */
.form-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.form-success {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

/* Export modal styling */
.export-option {
  transition: all 0.2s ease;
}

.export-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dark .export-option:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Recipe stats cards */
.stats-card {
  background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
  transition: all 0.3s ease;
}

.dark .stats-card {
  background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-700) 100%);
}

.stats-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.dark .stats-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Advanced search styling */
.search-input-container {
  position: relative;
}

.search-input-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 0.5rem;
  padding: 1px;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.search-input-container:focus-within::before {
  opacity: 1;
}

/* Category badge styling */
.category-badge {
  background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
  transition: all 0.2s ease;
}

.dark .category-badge {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.2) 0%, rgba(249, 115, 22, 0.3) 100%);
}

.category-badge:hover {
  transform: scale(1.05);
}

/* Tag cloud styling */
.tag-cloud .tag {
  transition: all 0.2s ease;
  cursor: pointer;
}

.tag-cloud .tag:hover {
  transform: scale(1.1);
  z-index: 10;
}

/* Difficulty indicator */
.difficulty-easy {
  color: #10b981;
}

.difficulty-medium {
  color: #f59e0b;
}

.difficulty-hard {
  color: #ef4444;
}

/* Rating stars */
.rating-stars {
  color: #fbbf24;
  text-shadow: 0 0 2px rgba(251, 191, 36, 0.5);
}

/* PWA install prompt styling */
.pwa-install-prompt {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  box-shadow: 0 10px 25px rgba(249, 115, 22, 0.3);
}

/* Offline indicator */
.offline-indicator {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  animation: pulse 2s infinite;
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .recipe-card {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #e5e7eb;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .dark {
    background: white !important;
    color: black !important;
  }
}

/* Responsive improvements */
@media (max-width: 640px) {
  .recipe-card {
    margin-bottom: 1rem;
  }
  
  .modal-content {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }
  
  .filter-panel {
    padding: 0.5rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

@media (max-width: 768px) {
  .recipe-grid {
    grid-template-columns: 1fr;
  }
  
  .shopping-list-grid {
    grid-template-columns: 1fr;
  }
}

/* Focus visible improvements for accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .recipe-card {
    border: 2px solid;
  }
  
  button {
    border: 2px solid;
  }
}

/* Screen reader only content */
.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;
}

/* Custom utilities */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass-effect {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animation delays for staggered effects */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }

/* Skeleton loading animation */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

.dark .skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
}

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

/* Enhanced focus styles for better accessibility */
.focus-ring {
  transition: box-shadow 0.15s ease-in-out;
}

.focus-ring:focus {
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.3);
}