/*
 * Main stylesheet for Shri Mahalakshmi Nursery
 * This file contains all the custom styles for the application
 */

/* ============================================
   IMPROVED PLANT CARD STYLING - GLOBAL
   ============================================ */

/* Universal Plant Card Image Container */
.plant-image, 
.plant-card-img, 
.main-image-wrapper {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f8f5f0 0%, #f0ede5 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Reduced padding for tighter look */
  padding: 6px;
  box-shadow: 
    inset 0 1px 3px rgba(0,0,0,0.06),
    0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
}

/* Plant Images - Optimized for full visibility */
.plant-image img, 
.plant-card-img img, 
.main-image {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
  border-radius: 8px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  /* Enhanced shadow for depth */
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Hover Effects */
.plant-card:hover .plant-image img,
.plant-card:hover .plant-card-img img {
  transform: scale(1.05);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

/* Improved Plant Overlay - More transparent and less obtrusive */
.plant-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* Very subtle transparent overlay - no blur */
  background: linear-gradient(to bottom, rgba(255,255,255,0.02), rgba(255,255,255,0.08));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 15px;
  opacity: 0;
  transition: opacity 0.3s ease;
  /* Ensure proper spacing to prevent overlap */
  gap: 10px;
}

.plant-card:hover .plant-overlay {
  opacity: 1;
}

/* Enhanced plant category badges with better visibility */
.plant-category {
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  /* Ensure the badge doesn't grow too wide */
  max-width: calc(100% - 60px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Ensure it doesn't shrink below minimum readable size */
  flex-shrink: 0;
}

/* Plant actions with better visibility */
.plant-actions {
  /* Ensure the action button container doesn't shrink */
  flex-shrink: 0;
}

.plant-actions .btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #2e7d32;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.plant-actions .btn:hover {
  background: rgba(46, 125, 50, 0.9);
  color: white;
  transform: scale(1.1);
}

/* Height Optimization */
.plant-image {
  height: 280px; /* Reduced from 300px */
}

.plant-card-img {
  height: 260px; /* Reduced from 300px */
}

.main-image-wrapper {
  min-height: 380px; /* Reduced from 420px */
  max-height: 450px; /* Added max-height */
}

/* Card Structure Improvements */
.plant-card {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.12);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.plant-card:hover {
  transform: translateY(-8px);
  box-shadow: 
    0 12px 24px rgba(0, 0, 0, 0.12),
    0 4px 8px rgba(0, 0, 0, 0.08);
}

/* Tighter Card Body */
.plant-card-body {
  padding: 16px !important; /* Reduced from 20px */
}

.plant-info {
  padding: 20px !important; /* Reduced from 25px */
}

/* The following rule was causing conflicts with the plant-overlay system, so it's removed */
/* 
.plant-category {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #2e7d32;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
*/

.plant-badge {
  position: absolute;
  bottom: 10px; /* Reduced from 15px */
  right: 10px; /* Reduced from 15px */
  padding: 4px 10px; /* Slightly reduced */
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(6px);
}

/* Optimized Grid */
.plants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* Reduced from 350px */
  gap: 24px; /* Reduced from 30px */
  margin-top: 40px; /* Reduced from 50px */
}

/* Related Plants Slider Cards */
.related-plants-slider .plant-card-img {
  height: 200px; /* Reduced from 220px */
}

/* Admin Thumbnails */
.img-thumbnail {
  object-fit: contain !important;
  object-position: center !important;
  background: linear-gradient(135deg, #f8f5f0 0%, #f0ede5 100%) !important;
  border: 2px solid #e9ecef !important;
  border-radius: 8px !important;
  padding: 3px !important;
}

/* Placeholder Image Improvements */
.placeholder-image {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px dashed #ced4da;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6c757d;
  transition: all 0.3s ease;
}

.placeholder-image:hover {
  border-color: #2e7d32;
  color: #2e7d32;
}

.placeholder-image i {
  font-size: 2.5rem !important;
  margin-bottom: 8px !important;
  opacity: 0.7;
}

.placeholder-image p {
  font-size: 0.85rem;
  margin: 0;
  font-weight: 500;
}

/* Category Color Coding */
.plant-category.flowering {
  background: linear-gradient(135deg, #e91e63, #f06292);
  color: white;
}

.plant-category.medicinal {
  background: linear-gradient(135deg, #4caf50, #66bb6a);
  color: white;
}

.plant-category.fruit {
  background: linear-gradient(135deg, #ff9800, #ffb74d);
  color: white;
}

.plant-category.outdoor {
  background: linear-gradient(135deg, #795548, #8d6e63);
  color: white;
}

.plant-category.air-purifying {
  background: linear-gradient(135deg, #00bcd4, #4dd0e1);
  color: white;
}

.plant-category.climbers {
  background: linear-gradient(135deg, #9c27b0, #ba68c8);
  color: white;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 1200px) {
  .plants-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
  }
  
  .plant-image {
    height: 240px;
  }
  
  .plant-card-img {
    height: 220px;
  }
}

@media (max-width: 768px) {
  .plants-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
  }
  
  .plant-image {
    height: 200px;
    padding: 4px;
  }
  
  .plant-card-img {
    height: 180px;
    padding: 4px;
  }
  
  .main-image-wrapper {
    min-height: 280px;
    max-height: 320px;
    padding: 8px;
  }
  
  .plant-card-body {
    padding: 12px !important;
  }
  
  .plant-info {
    padding: 16px !important;
  }
  
  /* Mobile overlay adjustments to prevent overlap */
  .plant-overlay {
    padding: 10px;
    gap: 8px;
  }
  
  .plant-category {
    font-size: 0.7rem;
    padding: 4px 8px;
    max-width: calc(100% - 50px);
  }
  
  .plant-actions .btn {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 576px) {
  .plants-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .plant-image {
    height: 180px;
  }
  
  .plant-card-img {
    height: 160px;
  }
  
  .main-image-wrapper {
    min-height: 240px;
    max-height: 280px;
  }
  
  /* Extra small screen adjustments */
  .plant-overlay {
    padding: 8px;
    gap: 6px;
  }
  
  .plant-category {
    font-size: 0.65rem;
    padding: 3px 6px;
    max-width: calc(100% - 45px);
  }
  
  .plant-actions .btn {
    width: 32px;
    height: 32px;
  }
}

/* ============================================
   ENHANCED LOADING STATES
   ============================================ */

.plant-card.loading .plant-image,
.plant-card.loading .plant-card-img {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .plant-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
  
  .plant-image,
  .plant-card-img {
    box-shadow: none !important;
  }
}
