:root {
  --primary-color: #1e4620;
  --primary-light: #2b6b2e;
  --accent-color: #4efa5f;
  --text-color: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --background-dark: #0d2009;
  --card-background: rgba(30, 70, 32, 0.7);
  --modal-background: #131f11;
  --tag-background: rgba(78, 250, 95, 0.15);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--background-dark);
  background-image: radial-gradient(circle at top, var(--primary-light) 0%, transparent 70%);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 2rem;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Header styles */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 5%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent-color);
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.logo:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.logo-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
}

nav a {
  color: var(--text-color);
  transition: color 0.3s;
}

nav a.active, nav a:hover {
  color: var(--accent-color);
}

/* Main content styles */
main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.hero-description {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.search-container {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 0.5rem;
  position: relative;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
}

#search-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-color);
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  outline: none;
}

#search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background-color: rgba(20, 45, 22, 0.95);
  border: 1px solid rgba(78, 250, 95, 0.2);
  border-radius: 8px;
  margin-top: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  z-index: 10;
  display: none;
}

.search-suggestions.active {
  display: block;
}

.suggestion-item {
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text-color);
  transition: all 0.2s;
  border-bottom: 1px solid rgba(78, 250, 95, 0.1);
}

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

.suggestion-item:hover,
.suggestion-item.selected {
  background-color: rgba(78, 250, 95, 0.15);
}

.suggestion-item.selected {
  color: var(--accent-color);
  font-weight: 500;
}

#search-btn {
  background-color: var(--accent-color);
  color: var(--primary-color);
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

#search-btn:hover {
  transform: scale(1.05);
}

#search-btn svg {
  width: 1.2rem;
  height: 1.2rem;
}

/* Initial state */
.initial-state {
  text-align: center;
  padding: 4rem 1rem;
}

.initial-state h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.initial-state p {
  color: var(--text-muted);
}

/* Search Results */
.search-results {
  padding: 1rem;
  display: none;
}

.search-results.active {
  display: block;
}

.results-header {
  margin-bottom: 1.5rem;
}

.results-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.results-count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.food-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.food-card {
  background-color: var(--card-background);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
  padding: 1.5rem;
}

.food-card:hover {
  transform: translateY(-5px);
}

.food-content {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.chart-container {
  width: 120px;
  height: 120px;
  margin: 0 auto 0.5rem;
  position: relative;
}

.food-name {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  font-weight: 500;
  text-align: center;
}

.chart-legend {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-right: 5px;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 3px;
}

.legend-protein { background-color: #4caf50; }
.legend-carbs { background-color: #2196f3; }
.legend-fat { background-color: #ff9800; }

.nutrition-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.nutrition-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.nutrition-label {
  white-space: nowrap;
}

.nutrition-value {
  color: var(--accent-color);
  text-align: right;
}

/* Modal */
.food-detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.food-detail-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--modal-background);
  width: 90%;
  max-width: 700px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 2;
}

.modal-body {
  padding: 2rem;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  nav ul {
    gap: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  .food-cards {
    grid-template-columns: 1fr;
  }
}

.modal-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-header {
  text-align: center;
  margin-bottom: 1rem;
}

.serving-info {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.modal-chart-container {
  width: 180px;
  height: 180px;
  margin: 0 auto 1rem;
  position: relative;
}

.nutrition-facts {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.nutrition-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nutrition-label {
  display: flex;
  justify-content: space-between;
  font-weight: 500;
}

.nutrition-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nutrition-label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  font-weight: 500;
  align-items: center;
}

.nutrition-value-large {
  color: var(--accent-color);
  font-size: 1.1rem;
  text-align: right;
}

.progress-bar {
  height: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--accent-color);
}

.daily-value {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: right;
}