:root {
  --primary-color: #ff6b6b;
  --secondary-color: #4ecdc4;
  --text-color: #2d3436;
  --background-color: #f8f9fa;
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* Header Styles */
header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 1rem 0;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.nav-link {
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 0.3s;
}

.nav-link:hover {
  opacity: 0.8;
}

.hero {
  text-align: center;
  padding: 3rem 1rem;
}

.hero h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

/* Search Container Styles */
#search-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.search-box {
  display: flex;
  align-items: center;
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  box-shadow: var(--card-shadow);
}

.search-box i {
  color: #666;
  margin-right: 1rem;
}

input {
  flex: 1;
  padding: 0.8rem;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
}

/* Enhanced Button Styles */
button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
}

button:active::after {
  width: 200px;
  height: 200px;
  opacity: 0;
}

/* Recipe Cards Styles */
#recipes-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.recipe-card {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.recipe-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.recipe-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.recipe-content {
  padding: 1.5rem;
}

.recipe-card h3 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.recipe-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.recipe-actions button {
  flex: 1;
  font-size: 0.9rem;
}

/* Success State Animations */
.save-btn.success, .remove-btn.success {
  animation: successPulse 0.4s ease;
  background-color: #4CAF50 !important;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 15px;
  position: relative;
  padding: 2rem;
  box-shadow: var(--card-shadow);
  animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-color);
  padding: 0.5rem;
}

.view-count {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.view-count i {
  color: var(--primary-color);
}

/* Loading and Error States */
.loading {
  text-align: center;
  padding: 2rem;
}

.loading i {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
  animation: spin 1.2s linear infinite;
}

.error {
  text-align: center;
  padding: 2rem;
  color: var(--primary-color);
  animation: shakeError 0.5s ease-in-out;
}

.error i {
  font-size: 2rem;
  margin-bottom: 1rem;
}

/* Animation Keyframes */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero h2 {
    font-size: 2rem;
  }
  
  .search-box {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .search-box button {
    width: 100%;
  }
  
  .modal-content {
    width: 95%;
    padding: 1rem;
  }
}