.upload-page-container {
  width: 60vw;
  margin: 0 auto;
  padding: 2rem 1rem;
  
  // Add gradient background
  background: linear-gradient(to bottom, #a8d5e2, #b8e2c8);
  
  min-height: 100vh;
  color: rgb(0, 0, 0);
}

.upload-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 0rem;

  // Recipe steps section comes first
  .form-group:has(.steps-input) {
    margin-left: 10px;
    
    order: 0; // Moves this section to the top
  }

  // Style form inputs
  input, select, textarea {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 1rem;
    
    &:focus {
      outline: none;
      box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
    }
  }

  // Make time inputs shorter
  input[name="cooking_time"],
  input[name="prep_time"] {
    max-width: 150px;
  }

  // Make image URL and steps wider
  input[name="image_url"],
  textarea[name="steps"] {
    width: 50vw;
  }
}

.upload-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  margin-bottom: 2rem;
  padding: 1rem;

}

.upload-section.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.upload-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-button {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 9999px;
  border: 1px solid #cbd5e1;
  background-color: #f1f5f9;
  color: #1e293b;
  transition: all 0.2s;
}

.tag-button.selected {
  background-color: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

.upload-image-preview {
  height: 200px;
  width: 100%;
  object-fit: cover;
  border-radius: 0.5rem;
}

.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

.upload-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.tip {
  font-size: 0.75rem;
  color: #000000;
}

.searchboxUpload {
  width: fit-content;
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.dropdown {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: #fff;
  max-height: 150px;
  overflow-y: auto;
  position: absolute;
  z-index: 1000;
  width: fit-content;
  top: calc(100%);
  margin-top: -10px;
  padding: 5px;
}

.dropdown li {
  padding: 10px;
  cursor: pointer;
}

.dropdown li:hover {
  background-color: #f0f0f0;

}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

// Style the ingredients dropdown
.ingredient-search {
  position: relative;
    margin-left: 10px;


  .search-input {
    margin-top: 10px;
    width: 20vw;
    max-width: 50vw;
  }

  .ingredients-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 20vw;
    max-width: 50vw;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
    overflow: hidden;
    z-index: 1000;

    li {
      
      list-style: none;
      padding: 0.75rem 1rem;
      color: #333;
      cursor: pointer;
      border-bottom: 1px solid #eee;

      &:last-child {
        border-bottom: none;
      }

      &:hover {
        background-color: #f8f9fa;
      }
    }
  }
}

// Style selected ingredients
.selected-ingredients {
  margin-top: 1rem;
  display: flex;
  flex-direction: column; // Changed to column for left alignment
  align-items: flex-start; // Aligns items to the left
  gap: 0.5rem;
  
  .ingredient-item {
    background: rgba(128, 115, 115, 0.1);
    padding: 0.5rem 1rem;
    margin-left: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content; // Changed from 40vw to fit-content
    min-width: 300px; // Add minimum width to prevent too narrow items

    .quantity-input {
      width: 60px;
    }

    .unit-select {
      width: 80px;
    }

    .remove-ingredient {
      background: none;
      border: none;
      color: rgb(0, 0, 0);
      cursor: pointer;
      padding: 4px 8px; // Added padding for better hover effect
      border-radius: 4px; // Added border radius for hover effect
      
      &:hover {
        color: #ff4444;
        background-color: #e4b7b7a6;
      }
    }
  }
}

// Style form buttons
.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;

  button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    
    &[type="submit"] {
      background: #4CAF50;
      color: white;
      
      &:hover {
        background: #45a049;
      }
    }
    
    &[type="button"] {
      background: rgba(255, 255, 255, 0.2);
      color: white;
      
      &:hover {
        background: rgba(255, 255, 255, 0.3);
      }
    }
  }
}

.steps-input {
  width: 50vw;
  min-width: 50vw;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  resize: vertical;
  min-height: 150px;
  line-height: 1.6;
  margin-top: 10px;
  white-space: pre-wrap;
  font-family: inherit;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  
  &:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
  }

  // Style for each line/step
  &::placeholder {
    color: #94a3b8;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;

  label {
    margin-right: 10px; // Add margin between label and input
    margin-bottom: 5px;
  }

  input, 
  select, 
  textarea {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 1rem;
    
    &:focus {
      outline: none;
      box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
    }
  }

  // Specific widths for different inputs
  input[name="name"] {
    margin-left: 10px;
    width: 300px; // Adjust based on label width
  }
  input[name="image_url"] {
    margin-left: 10px;
    width: calc(100% - 120px); // Adjust based on label width
  }

  input[name="cooking_time"],
  input[name="prep_time"] {
    margin-left: 10px;
    max-width: 150px;
  }

  select[name="meal_type"] {
    margin-left: 10px;
    width: 200px;
  }
}
