/* Filipino Recipe PWA - Enhanced Styles */

/* Import Filipino-inspired color palette */
:root {
  --filipino-blue: #1E3A8A;     /* Philippine flag blue */
  --filipino-red: #DC2626;       /* Philippine flag red */  
  --filipino-yellow: #FCD34D;    /* Philippine flag yellow */
  --filipino-green: #059669;     /* Traditional green */
  --warm-white: #FEF7ED;         /* Warm background */
  --rice-white: #FEFEFE;         /* Rice white */
  --banana-yellow: #FEF3C7;      /* Banana leaf inspired */
  --coconut-brown: #92400E;      /* Coconut brown */
}

/* Global styles */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #374151;
  background-color: var(--warm-white);
}

/* Text truncation utility */
.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;
}

/* Recipe card enhancements */
.recipe-card {
  transition: all 0.3s ease;
  border: 1px solid #E5E7EB;
}

.recipe-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-color: var(--filipino-blue);
}

.recipe-card img {
  transition: transform 0.3s ease;
}

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

/* Filipino flag gradient */
.filipino-gradient {
  background: linear-gradient(135deg, var(--filipino-blue) 0%, var(--filipino-red) 50%, var(--filipino-yellow) 100%);
}

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

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

/* Search input enhancements */
.search-input {
  background: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%);
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: all 0.3s ease;
}

.search-input:focus {
  background: white;
  border-color: var(--filipino-blue);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Filter buttons */
.filter-btn {
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.filter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.filter-btn.active {
  border-color: var(--filipino-blue);
  box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.2);
}

/* Region-specific styling */
.region-luzon {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.region-visayas {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

.region-mindanao {
  background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
}

.region-diaspora {
  background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
}

/* Dish type icons and colors */
.dish-ulam { border-left: 4px solid var(--filipino-red); }
.dish-sabaw { border-left: 4px solid var(--filipino-blue); }
.dish-kanin { border-left: 4px solid var(--filipino-yellow); }
.dish-dessert { border-left: 4px solid #EC4899; }
.dish-pulutan { border-left: 4px solid var(--filipino-green); }
.dish-merienda { border-left: 4px solid #F59E0B; }

/* Authenticity badges */
.authenticity-traditional {
  background: linear-gradient(135deg, var(--filipino-green) 0%, #047857 100%);
}

.authenticity-modern {
  background: linear-gradient(135deg, var(--filipino-blue) 0%, #1E40AF 100%);
}

.authenticity-fusion {
  background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
}

/* Difficulty stars */
.difficulty-stars {
  color: var(--filipino-yellow);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* Ingredient list styling */
.ingredient-item {
  transition: background-color 0.2s ease;
  border-radius: 0.375rem;
  padding: 0.5rem;
  margin: 0.25rem 0;
}

.ingredient-item:hover {
  background-color: var(--banana-yellow);
}

/* Instruction steps */
.instruction-step {
  counter-increment: step-counter;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.5rem;
}

.instruction-step::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  background: var(--filipino-blue);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.875rem;
}

.instruction-list {
  counter-reset: step-counter;
}

/* Cultural context styling */
.cultural-note {
  background: linear-gradient(135deg, var(--banana-yellow) 0%, #FEF3C7 100%);
  border: 1px solid #F59E0B;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
  position: relative;
}

.cultural-note::before {
  content: '🏛️';
  position: absolute;
  top: -10px;
  left: 15px;
  background: var(--banana-yellow);
  padding: 0 8px;
  font-size: 1.2rem;
}

/* PWA install prompt */
.install-prompt {
  background: linear-gradient(135deg, var(--filipino-blue) 0%, #1E40AF 100%);
  color: white;
  padding: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
  animation: slideUp 0.3s ease-out;
}

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

/* Offline indicator */
.offline-indicator {
  background: #EF4444;
  color: white;
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Favorites heart animation */
.favorite-btn {
  transition: transform 0.2s ease;
}

.favorite-btn:active {
  transform: scale(1.2);
}

.favorite-btn.favorited {
  animation: heartBeat 0.6s ease-in-out;
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(1); }
  75% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Notification toast */
.notification-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  max-width: 300px;
  z-index: 1000;
  animation: slideInRight 0.3s ease-out;
}

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

/* Search suggestions */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #E5E7EB;
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 10;
  max-height: 300px;
  overflow-y: auto;
}

.search-suggestion {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #F3F4F6;
}

.search-suggestion:hover {
  background-color: var(--banana-yellow);
}

.search-suggestion:last-child {
  border-bottom: none;
}

/* Recipe rating stars */
.rating-stars {
  display: inline-flex;
  gap: 0.125rem;
}

.rating-star {
  color: #D1D5DB;
  transition: color 0.2s ease;
}

.rating-star.filled {
  color: var(--filipino-yellow);
}

.rating-star.half-filled {
  background: linear-gradient(90deg, var(--filipino-yellow) 50%, #D1D5DB 50%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Mobile-first responsive design */
@media (max-width: 640px) {
  .recipe-card {
    margin-bottom: 1rem;
  }
  
  .region-filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .region-btn {
    margin-bottom: 0.5rem;
  }
  
  .dish-type-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .search-input {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* Tablet styles */
@media (min-width: 641px) and (max-width: 1024px) {
  .recipe-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dish-type-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Desktop styles */
@media (min-width: 1025px) {
  .recipe-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .dish-type-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .recipe-card:hover {
    transform: translateY(-4px);
  }
}

/* Print styles for recipes */
@media print {
  .recipe-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }
  
  .no-print {
    display: none !important;
  }
  
  .recipe-instructions {
    break-inside: avoid;
  }
  
  .ingredient-item {
    break-inside: avoid;
  }
}

/* Dark mode support (system preference) */
@media (prefers-color-scheme: dark) {
  :root {
    --warm-white: #1F2937;
    --rice-white: #111827;
    --banana-yellow: #374151;
  }
  
  body {
    background-color: var(--warm-white);
    color: #F3F4F6;
  }
  
  .recipe-card {
    background-color: var(--rice-white);
    border-color: #374151;
  }
  
  .search-input {
    background-color: #374151;
    color: #F3F4F6;
    border-color: #4B5563;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    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-width: 2px;
    border-color: #000;
  }
  
  .filter-btn {
    border-width: 2px;
    border-color: #000;
  }
  
  .search-input {
    border-width: 2px;
    border-color: #000;
  }
}