/* SQL Mode - Caching UI Styles */

/* Cache Badge */
.cache-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #4caf50;
  color: white;
  border-radius: 12px;
  font-size: 0.8em;
  margin-left: 8px;
  animation: pulse 2s infinite;
}

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

/* Select Meal Button */
.select-meal-btn {
  padding: 10px 20px;
  background: #2196f3;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1em;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.select-meal-btn:hover {
  background: #1976d2;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

.select-meal-btn.selected {
  background: #4caf50;
}

.select-meal-btn.selected:hover {
  background: #45a049;
}

/* Cache Stats Display */
#cacheStats {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 0.9em;
  align-items: center;
}

#cacheStats span {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Cache Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  padding: 32px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

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

.modal-content h2 {
  margin-top: 0;
  color: #333;
  font-size: 1.5em;
  margin-bottom: 24px;
}

.cache-stats-details {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.cache-stats-details p {
  margin: 12px 0;
  font-size: 1em;
  display: flex;
  justify-content: space-between;
}

.cache-stats-details strong {
  color: #555;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1em;
  transition: all 0.2s ease;
}

.modal-actions button:first-child {
  background: #2196f3;
  color: white;
}

.modal-actions button:first-child:hover {
  background: #1976d2;
}

.modal-actions button:nth-child(2) {
  background: #f44336;
  color: white;
}

.modal-actions button:nth-child(2):hover {
  background: #d32f2f;
}

.modal-actions button:last-child {
  background: #757575;
  color: white;
}

.modal-actions button:last-child:hover {
  background: #616161;
}

/* Recipe Actions */
.recipe-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.recipe-actions button {
  flex: 1;
}

.favorite-btn {
  padding: 10px 20px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2em;
  transition: all 0.2s ease;
}

.favorite-btn:hover {
  border-color: #ff4081;
  transform: scale(1.1);
}

/* Cache Management Buttons */
.cache-controls {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  padding: 16px;
  background: #f5f5f5;
  border-radius: 8px;
}

.cache-controls button {
  padding: 10px 16px;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cache-controls button:hover {
  border-color: #2196f3;
  background: #e3f2fd;
}

/* Loading State for Cached Content */
.loading-from-cache {
  position: relative;
}

.loading-from-cache::before {
  content: '📦 Loading from cache...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(76, 175, 80, 0.95);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1em;
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

/* Network Status Indicator */
.network-status {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9em;
  z-index: 1000;
}

.network-status.online {
  border-left: 4px solid #4caf50;
}

.network-status.offline {
  border-left: 4px solid #f44336;
}

.network-status.online::before {
  content: '🟢';
}

.network-status.offline::before {
  content: '🔴';
}

/* Recipe Card Enhancements */
.recipe-card {
  position: relative;
  transition: all 0.3s ease;
}

.recipe-card.cached {
  border-left: 4px solid #4caf50;
}

.recipe-card.selected {
  background: #e8f5e9;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  #cacheStats {
    flex-direction: column;
    gap: 8px;
  }

  .recipe-actions {
    flex-direction: column;
  }

  .cache-controls {
    flex-direction: column;
  }

  .modal-content {
    padding: 20px;
    margin: 20px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions button {
    width: 100%;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  #cacheStats {
    background: #2c2c2c;
  }

  #cacheStats span {
    background: #3c3c3c;
    color: #fff;
  }

  .modal-content {
    background: #2c2c2c;
    color: #fff;
  }

  .cache-stats-details {
    background: #3c3c3c;
  }

  .cache-controls {
    background: #2c2c2c;
  }

  .cache-controls button {
    background: #3c3c3c;
    color: #fff;
    border-color: #555;
  }

  .recipe-card.selected {
    background: #1b5e20;
  }
}

/* Print Styles - Hide Caching UI */
@media print {
  .cache-badge,
  #cacheStats,
  .cache-controls,
  .select-meal-btn,
  .network-status,
  .modal {
    display: none !important;
  }
}
