/* YouTube-like Theme Variables */
:root {
  --youtube-dark-bg: #181818; /* Dark background */
  --youtube-card-bg: #212121; /* Slightly lighter dark for cards/elements */
  --youtube-text-white: #ffffff; /* Main text color */
  --youtube-text-light-gray: #aaaaaa; /* For secondary text/links */
  --youtube-red: #FF0000; /* YouTube accent color (though sparingly used) */
  --youtube-blue-link: #3EA6FF; /* Common blue for links on YouTube */
  --youtube-blue-link-hover: #63B8FF;
}

/* Import Roboto font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* General Body and Container Styles */
body {
  font-family: 'Roboto', sans-serif; /* YouTube's primary font */
  background-color: var(--youtube-dark-bg);
  color: var(--youtube-text-white);
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center; /* Center horizontally */
  align-items: center; /* Center vertically */
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  width: 90%;
  max-width: 700px;
  margin: 40px auto;
  background: var(--youtube-card-bg);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  text-align: center; /* Center content within container by default */
}

/* Heading Styles */
h1, h2 {
  font-family: 'Roboto', sans-serif; /* Consistent with body, but use bolder weights */
  font-weight: 700; /* Bold */
  color: var(--youtube-text-white);
  margin-bottom: 25px;
  text-align: center;
  line-height: 1.2;
}

h1 {
  font-size: 2.8em;
  color: var(--youtube-text-white); /* Keep main title white for YouTube theme */
}

h2 {
  font-size: 2em;
}

/* Input Field Styles */
input[type="text"] {
  width: calc(100% - 24px); /* Account for padding */
  padding: 14px; /* Slightly larger padding */
  font-size: 1.1em; /* Bigger, more readable font */
  border: 1px solid #3a3a3a; /* Darker border */
  border-radius: 4px;
  background-color: #333; /* Dark background for input */
  color: var(--youtube-text-white);
  margin-bottom: 15px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]::placeholder {
  color: var(--youtube-text-light-gray);
  opacity: 0.7;
}

input[type="text"]:focus {
  border-color: var(--youtube-blue-link); /* Blue border on focus */
  box-shadow: 0 0 0 2px rgba(62, 166, 255, 0.4); /* Blue glow on focus */
  outline: none;
}

/* Button Styles */
button, .button-link {
  padding: 14px 25px;
  background-color: var(--youtube-red); /* YouTube red for primary button */
  color: var(--youtube-text-white);
  border: none;
  font-size: 1.1em;
  font-weight: 500; /* Slightly less bold for YouTube style buttons */
  border-radius: 4px; /* Less rounded buttons */
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
}

button:hover, .button-link:hover {
  background-color: #cc0000; /* Darker red on hover */
  transform: translateY(-1px);
}

button:disabled {
  background-color: #535353;
  color: #a7a7a7;
  cursor: not-allowed;
  transform: none;
}

/* Link Styles */
a {
  color: var(--youtube-text-light-gray);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--youtube-text-white);
  text-decoration: underline;
}

/* Ingredient Tag Styles */
.ingredient-tag {
  display: inline-flex;
  align-items: center;
  background-color: #333;
  color: var(--youtube-text-white);
  font-size: 1em;
  font-weight: 400; /* Normal weight */
  padding: 8px 12px;
  padding-right: 8px;
  border-radius: 4px; /* Less rounded tags */
  margin-right: 10px;
  margin-bottom: 10px;
  white-space: nowrap;
  border: 1px solid #444;
}

.ingredient-tag .remove-button {
  background: none;
  border: none;
  color: var(--youtube-text-light-gray);
  font-size: 1.3em;
  line-height: 1;
  margin-left: 10px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%; /* Still round for the 'x' button */
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ingredient-tag .remove-button:hover {
  background-color: #535353;
  color: var(--youtube-text-white);
}

/* Ingredient List Container */
#ingredientsList {
  border: 1px solid #444;
  min-height: 100px;
  padding: 20px;
  border-radius: 8px;
  background-color: var(--youtube-card-bg);
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  margin-bottom: 30px;
  text-align: left; /* Keep left-aligned within the list */
}

.text-gray-500 {
  color: var(--youtube-text-light-gray);
  font-style: italic;
  width: 100%;
  text-align: center;
  padding: 10px 0;
}

/* Utility Classes */
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-6 { margin-bottom: 1.5rem; }

/* Styles for suggestions.html - Dish Cards */
.dish-list {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center; /* Center dish cards */
}

.dish-card {
  display: flex;
  align-items: center;
  background-color: var(--youtube-card-bg);
  border: 1px solid #333;
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  width: 100%;
  max-width: 600px;
}

.dish-card:hover {
  box-shadow: 0 6px 18px rgba(0,0,0,0.7);
  transform: translateY(-2px) scale(1.01);
}

.dish-card img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 8px 0 0 8px;
  margin-right: 25px;
  flex-shrink: 0;
}

.dish-card .dish-info {
  padding: 15px;
  flex-grow: 1;
  text-align: left;
}

.dish-card h3 {
  margin: 0;
  font-size: 1.5em;
  color: var(--youtube-text-white);
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
}

/* Styles for recipe.html */
.recipe-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 30px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.recipe-content {
    white-space: pre-wrap;
    font-family: 'Roboto', sans-serif;
    font-size: 1.15em;
    background-color: var(--youtube-card-bg);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #444;
    line-height: 1.7;
    color: var(--youtube-text-light-gray);
    text-align: left;
}

.recipe-content pre {
    margin: 0;
    padding: 0;
    font-family: inherit;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Bolding for recipe content */
.recipe-content strong {
    color: var(--youtube-text-white);
    font-weight: 700;
}

.find-new-recipe-btn {
    display: block;
    width: 100%;
    margin-top: 35px;
    padding: 15px;
    background-color: var(--youtube-red);
    color: var(--youtube-text-white);
    text-align: center;
    border-radius: 4px;
    font-size: 1.1em;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
    font-weight: 500;
}

.find-new-recipe-btn:hover {
    background-color: #cc0000;
    transform: translateY(-1px);
}

/* Autocomplete Suggestions Styling */
#autocomplete-suggestions {
  position: absolute;
  width: calc(100% - 80px); /* Adjust this to match your input's effective width */
  max-width: 620px; /* Max width to align with container */
  background-color: var(--youtube-card-bg);
  border: 1px solid #444;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  margin-top: 5px; /* Adjust to sit right below the input field */
  display: none;
  text-align: left;
  left: 50%; /* Center horizontally */
  transform: translateX(-50%); /* Offset by half its width for perfect centering */
}

.suggestion-item {
  padding: 10px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--youtube-text-white);
  transition: background-color 0.2s ease;
}

.suggestion-item:hover {
  background-color: #333;
}

.suggestion-item:not(:last-child) {
  border-bottom: 1px solid #333;
}

.suggestion-image {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0; /* Prevent image from shrinking */
}

/* Adjust .input-area for proper positioning of autocomplete suggestions */
.input-area {
    position: relative; /* Essential for absolute positioning of #autocomplete-suggestions */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px; /* Add some space below the input area */
}

.input-area input[type="text"] {
    flex-grow: 1;
    margin-bottom: 0;
}

.input-area button {
    width: auto;
    min-width: 120px;
}


/* Responsive adjustments */
@media (max-width: 600px) {
  .container {
    margin: 20px auto;
    padding: 25px;
  }

  h1 {
    font-size: 2.2em;
  }

  h2 {
    font-size: 1.6em;
  }

  .dish-card {
    flex-direction: column;
    text-align: center;
    max-width: 95%;
  }

  .dish-card img {
    width: 100%;
    height: 180px;
    border-radius: 8px 8px 0 0;
    margin-right: 0;
    margin-bottom: 15px;
  }

  .dish-card .dish-info {
    padding: 10px 15px 15px;
  }

  .dish-card h3 {
    text-align: center;
  }

  input[type="text"], button, .button-link, .ingredient-tag {
    font-size: 1em;
    padding: 12px;
  }

  .ingredient-tag .remove-button {
    font-size: 1.1em;
    width: 20px;
    height: 20px;
  }

  /* Responsive autocomplete adjustments */
  #autocomplete-suggestions {
    width: calc(100% - 20px); /* Adjust width for mobile padding */
    left: 10px; /* Adjust positioning for mobile */
    transform: translateX(0);
    max-width: none; /* Remove max-width on small screens */
  }
}